I have to create a Service, Which has to persist a flag against a userId using the api void register(String userId) and also the service has to vend a api boolean isRegistered(String userId) which says whether a UserID has registered for the service or not.. I’m planning to have a No-SQL database as a Backend as reads and writes are O(1).
Expected Request Per Second for create api is : 10 (10 writes per sec to db)
Expected Request Per Second for isRegistered api is : 10000 (10000 reads per second to db). which means for more than 95% of the request this API will return false and userId for isRegistered are mostly distinct values, So caching would need a more ttl to reap its benefit.
Now I’m trying to optimize number of database reads made by isRegistered() call.
What is the best way to design this System/DB. Is there an existing design pattern which I can use to Solve this Problem? like a better way to cache.
Thanks in Advance
Aucun commentaire:
Enregistrer un commentaire