Open abhijeetsingh26 opened 3 years ago
That is an interesting suggestion, just wondering from technical implementation - having so many centres is it possible to implement pub-sub model on this? If it is then definitely this should be a better approach.
They can leave their internal implementation of how they get the slots updated as it is also.
They just need to run a scheduler which will internally poll their private endpoint and see if there has been a change.
While this isn't a fully pub-sub model from ground up but still since their internal scheduler is the only one that is polling their private endpoint, they can keep the polling frequency sufficiently low and keep the resource utilization minimal vs the current model.
Just from a quick google search on the max limits of concurrent websockets an application can handle I can say it shouldn't be a blocker to them.
https://alexhultman.medium.com/millions-of-active-websockets-with-node-js-7dc575746a01 https://blog.jayway.com/2015/04/13/600k-concurrent-websocket-connections-on-aws-using-node-js/
Instead of websockets which is bulky and has 2 way communication, why not to user Sever Sent Events? It is a very lightweight as compared to Web Sockets and 2 way communication for notification use case doesn't fit. A publisher subscriber model with Sever sent events is a good approach.
Webhooks is a better option.
IMHO webhooks will put down the service into same problems as it is having now i.e. "SCALING". As soon as they have sufficiently big number of webhooks to process, some will always trigger first.
Pub-Sub should be the way out so all clients received the data at the same time and if something at their end fails, all clients will have what we call as 'common-fate'.
It will solve the following things
Will reduce the un-necessary load on the schedules public API which is being polled by literally everyone who has the basic knowledge of hitting a endpoint and fetching/parsing the data. System is unnecessarily overburdened by these calls.
No need of putting stringent rate limits on APIs as well as serving cached data saving the efforts.
All the clients will have a real time view of the availability of the slots which will help reduce the gray area that people have around having some backdoors to the system for booking.