LeetCode API Design Evaluation and Latency Budget
Explore the design and evaluation of the LeetCode API with a focus on achieving non-functional requirements such as scalability, security, and low latency. Understand how techniques like GraphQL, containerization, and pub-sub systems enhance performance. Analyze response times and latency budgets, especially in high-demand scenarios like coding contests, to ensure efficient user experience.
Introduction
This lesson will discuss how to achieve the non-functional requirements to increase efficiency and improve the response time of LeetCode API. We’ll analyze the response time, especially for contest service, which will be a key factor for the efficiency of the service.
Non-functional requirements
The following section discusses how different non-functional requirements are achieved.
Availability and scalability
GraphQL architecture's implementation helps us reduce the number of calls by bundling multiple requests into one. This enables the service to be available and scalable to more users. Also, the use of the pub-sub service decouples different microservices and enables asynchronous communication between them. Moreover, pagination improves the availability and scalability of the overall service by reducing the burden on the network and backend.
Security
The security of the service focuses on the users and backend services. The following steps are taken to ensure the security of the service:
Only authenticated and authorized users are allowed to access the services. The users with basic authentication (registered users) can perform different basic operations, such as listing problems, reading comments, and so on, in the LeetCode service. Moreover, authorized users ...