Availability: The service must be highly available; users should always be able to read existing pastes.
We expose a simple RESTful API for our read and write paths.
POST /api/v1/pastePayload: { "text": "string", "expiration_minutes": int, "custom_alias": "string" (optional) }201 Created with { "url": "https://paste.bin/xyz123" }GET /api/v1/paste/{url_hash}Response: 200 OK with { "text": "string", "created_at": timestamp, "expires_at": timestamp }DELETE /api/v1/paste/{url_hash}Response: 200 OK or 204 No ContentThe architecture relies on decoupled microservices to optimize both the read and write paths:
1.API_Gateway: Centralized entry point handling SSL termination, rate limiting, and request routing.
2.App_Servers: Horizontally scaling, stateless instances executing the core paste business logic.
3.Key_Generation_Service(KGS): A standalone, isolated service continuously pre-generating unique 7-character Base62 strings. It stores them in a localized KGS database, ensuring URL assignments operate at O(1) time complexity without runtime collision checks.
4.Caching_Layer: A distributed Redis or Memcached cluster sitting in front of the database to absorb the 99% read-heavy traffic.
5.Metadata_Database: A NoSQL datastore (e.g., DynamoDB or Cassandra) housing paste metadata (URL hash, TTL, author, and storage pointers).
To satisfy our stringent non-functional metrics and safeguard against extreme operational states, the components are engineered as follows:
1.Performance_&_Scalability: