We will create a system to handle 100k+ rps.
UserProfile Entity
CREATE TABLE user_profile (
'user_id' string primary key,
'email_id' string,
'phone_number' string,
'active' boolean,
'address' varchar(255),
)
CREATE TABLE slot (
'slot_id' string primary key,
'available' string,
'location_id' string
)
CREATE TABLE user_slot_mapping (
'user_id' string primary key,
'slot_id' string primary key,
'active' string,
'valid_till' string
)
Backend:
Load balancer to route request to healthy instances constantly, cache to reduce load on database,
rabbit MQ for asynchronous request handling, Push notification system for notifying agents.
Clients make a request, request is routed from APP to API gateway which then sends it it load balancer from where request is routed to servers.
Client ->APP -> API Gateway -> Load balancer -> Server -> Cache -> Database.
For handling multiple request we can do scaling like adding more servers, increasing RAM size.
Tech Stacks: Java, Dropwizard, Maria DB, Aerospike, Caffeine, Singleton, Indexing.
Using a microservices architecture for scalability and independent deployments, instead of a architecture.
Java for its performance and robust libraries.
Use caching (e.g., Redis or Memcached) to improve performance by reducing database load.
Use of load balancers to distribute traffic evenly across servers. Load balancing increases fault tolerance and server utilization but adds complexity to network setup.
Prevention:
2. Description: The system could struggle under heavy traffic, leading to slow performance or downtime.
Backup and Data Recovery: