Availability: The service must be highly available; users should always be able to read existing pastes.
To ensure robust data handling and address critical operational edge cases, the RESTful APIs are structured as follows:
1.CreatePaste(api_dev_key, paste_content, expiration_date, idempotency_key)
idempotency_key ensures that if a client retry occurs due to network timeouts, the server does not generate a duplicate paste.The 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: