Microsoft | Onsite | Modify an OTP generation system to handle more requests

Q1. I have a system where the user requests for an OTP and the OTP gets generated and sent via SMS from the Service Provider. The request from the user is put to a Database and a service runs and extracts those requests from the DB, generates a Random number and calls the Service Provider APIs. This system currently can serve 20 requests per second, how can I tweak it to serve 30 requests per second?

A. My first answer was that we can use a Message broker in a Pub-Sub model instead of a DB, because Message brokers are optimized for these tasks and if needed add one more worker processes in the background

Followup Q. He said, He doesn't have the bandwidth or resources to change the entire infrastructure. He wants me to do smart tweaks to the existing Infra

A. I felt out of depth here as I didn't remember DB optimizations and I felt that was the key, I mentioned that if you are using an RDBMS, the writes are slow and one way to improve them is to move to NOSQL. I also suggested that to distribute the load to DB Server, we can have a read replica which will handle the reads while the master handles the writes.

Q. This will not solve the problem and it will create new problems. Think more

A. I thought about the other components. Generating a pseudo-random no. is not that difficult and the sending the OTP is the Service providers responsibility, So I zeroed in on the DB again but couldn't come up with anything new

I needed some pointers on what went wrong and what could have been better answers

Comments (12)