I asked this system design question to 3 guys during a developer interview and none of them gave the answer
A Common system design question.
Weeks ago, a candidate came in and we started the interview (senior dev, 3rd round) process. Since he has internet company working experience, a famous ecoms company.
The first question I asked him “what do you do in your team? tell me the details of the current project you are working on, as detailed as possible”.
TBH, This is a pretty standard question. I was expecting a solid very prepared answer.
He replied “Sure our team is dealing with payment, integration with payment gateways, and sync invoices with banks. and since our architecture is microservice, our team is working on payment service. to provide payment service to other teams”.
Then I asked “Since your system is dealing with payment gateway, have you ever faced any issues? like payment went through in the gateway but however failed on your side? or found double invoiced in the bank ?”
He replied, “Well, this sometimes happens, when It happened, we manually fix it”.
“How do you manually fix”? I asked again.
“Trigger some script to sync the data or status,” he said.
“Do you mean manually roll back the transaction either your side or the gateway or any banking”?
He said yes.
I asked again, “Let me ask this way, how do you make sure transactions are committed successfully in a distributed system?”.
“Manually fix,” he said again.
If you interviewing for any position for an internet company or companies dealing with distributed systems.
you need to look into distributed system transaction handling.
Let’s dive into the details straightaway.
The 2 phase commit
The idea is simple as above.
Here the coordinator is to make sure the calls to seriveA and serviceB happen…