This is the basic functionality I’m targeting.
My take
/register
POST method endpoint that runs a which captures the details from the user in a sharded MySQL database, and any files that they submitted in a BLOB storage (references updated in MySQL)./audit
POST method endpoint which the auditor will call to fetch one entry from the queue (SQS) and also update the status of this case, so other auditors don’t end up getting the same case. If they were able to obtain a lock for this case, good otherwise try again with the next item from the queue./register
and /audit
would be separate services, so they can be scaled up and down independently.I’m having second thoughts about introducing a queue in the first place. Am I better off just querying the database? Something like SELECT Id FROM USER WHERE status = ‘Pending’ FOR UPDATE
How would you build a system that can handle scale according to /registration usage and /auditor usage? How would you build a system that can handle dynamically scale according to registration load and auditor load?
I’m having second thoughts about introducing a queue in the first place. Am I better off just querying the database? Something like SELECT Id FROM USER WHERE status = ‘Pending’ FOR UPDATE
Queues are usually introduced in automatic pipelines to desynchronize and decouple the single processing steps, but this does not seem to be your case. Also, at this level, a queue per se is very similar to a plain table, it mainly adds a notification system on top of it (locking you already get in SQL), so, if you can send an email or similar from your program, that on top of some dedicated tables should be all you need.
So, I think you do are fine with a table (or rather, group of related tables) representing the registration data and approval state (the approval state definition itself coming from a state-transition diagram or similar that specifies the approval life-cycle).
On the other hand, I would advice against just doing it all within the main USER table: certainly so if you want scalability, but I think this would be advisable in any case for clarity and manageability of such an implementation.
How would you build a system that can handle dynamically scale according to registration load and auditor load?
Saying "dynamically scale" is a bit improper, either the system is designed to scale, or it isn't: in other words, we may "dynamically scale" on e.g. server resources, not on application logic and code. That said, I would go with dedicated tables as explained above, which does scale.