I assume:
Estimation:
User Management :
Reservations Management
Payment:
Database Choice: The user solution suggests using relational databases without additional context. Since this is a parking reservation system with a requirement for strong consistency (to prevent double booking) and considering the estimated data size, choosing an RDBMS is appropriate.
User Table:
Company table:
Vehicle table
Reservation table:
Spot table:
Payment table:
flowchart TD
CL[Client] --> |HTTP Request| GW[API Gateway]
GW --> |Filter Requests| RL[Rate Limiter]
RL --> |Distribute Load| LB[Load Balancer]
LB --> |Handle Reservations| RES[Reservation Server]
RES --> |Query Cache| CC[Cache]
RES --> |SQL Queries| DB[Database]
RES --> |Send Messages| MQ[Message Queue]
MQ --> |Process Payments| PAY[Payment System]
RES --> |Send Notifications| NS[Notification System]
NS --> |Real-Time Alerts| CL
LB --> |User Data Handling| UX[User Server]
UX --> |SQL Queries| DB[Database]
sequenceDiagram
participant User
participant Load Balancer
participant APIGateway
participant ReservationService
participant PaymentService
participant UserService
participant Cache
participant Database
User->>Load Balancer: Request Reservation In POST/api/reservation()
Load Balancer->>APIGateway: Forward request
APIGateway->>Cache: Check Authorization
APIGateway->>ReservationService: Make reservation
ReservationService->>Cache: Insert new reservation
ReservationService-->>APIGateway: Return Message success
APIGateway-->>Load Balancer: Return Message success
Load Balancer-->>User: Return Message success
PaymentService->>Cache: Create Payment
Cache->>Database: write-behind caching
User->>Load Balancer: Request Reservation Out PUT/api/reservation()
Load Balancer->>APIGateway: Forward request
APIGateway->>Cache: Check Authorization
ReservationService->>Database: Update reservation
Database-->>ReservationService: Return Message success
ReservationService->>PaymentService: Update Payment Daily
PaymentService-->>ReservationService: Update Payment Daily Success
ReservationService-->>APIGateway: Reservation Status
APIGateway-->>User: Reservation Status
User->>Load Balancer: Get User info get api/user/{user_id}
Load Balancer->>APIGateway: Forward request
APIGateway->>Cache: Check Authorization
UserService->>Database: GET User Info
Database-->>UserService: Return Message success
UserService-->>APIGateway: Return Message success
APIGateway-->>User: User Info
User->>Load Balancer: Request User POST api/user()
Load Balancer->>APIGateway: Forward request
APIGateway->>Cache: Check Authorization
UserService->>Database: Create User Info
Database-->>UserService: Return Message success
UserService-->>APIGateway: Return Message success
APIGateway-->>User: User Status
User->>Load Balance: Request Payment GET api/payment()
Load Balancer->>APIGateway: Forward request
APIGateway->>Cache: Check Authorization
PaymentService->>Database: Get User payment
Database-->>PaymentService: Return total number
PaymentService-->>APIGateway: Return total number
APIGateway-->>User: Return total number
User->>Load Balancer: Payment confirm POST api/confirmPayment()
Load Balancer->>APIGateway: Forward request
APIGateway->>Cache: Check Authorization
PaymentService->>Database: Get User payment
Database-->>PaymentService: Update staus payment
PaymentService-->>APIGateway: Return Message success
APIGateway-->>User: Return Message success
Database: we choose SQL
Cache:
API Gateway:
2. Cache Invalidation/Failure:
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?