Creating System design diagrams is not easy, so we have started a new series on @YouTube
- System Diagrams using Drawio
if you want to take your diagram skill to the next level, subscribe and watch
here is the link - https://t.co/v6KT80XfT0
How to improve API performance?
The diagram below shows 5 common tricks to improve API performance.
1. Pagination
This is a common optimization when the size of the result is large. The results are streaming back to the client to improve the service responsiveness.
2. Asynchronous Logging
Synchronous logging deals with the disk for every call and can slow down the system. Asynchronous logging sends logs to a lock-free buffer first and immediately returns. The logs will be flushed to the disk periodically. This significantly reduces the I/O overhead.
3. Caching
We can cache frequently accessed data into a cache. The client can query the cache first instead of visiting the database directly. If there is a cache miss, the client can query from the database. Caches like Redis store data in memory, so the data access is much faster than the database.
4. Payload Compression
The requests and responses can be compressed using gzip etc so that the transmitted data size is much smaller. This speeds up the upload and download.
5. Connection Pool
When accessing resources, we often need to load data from the database. Opening the closing db connections add significant overhead. So we should connect to the db via a pool of open connections. The connection pool is responsible for managing the connection lifecycle.
Over to you: What other tricks do you use to improve API performance?
–
Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): https://t.co/90RMwmA3Mu
📢 Introducing JUST 🚀
Just is a command line toolkit for developing @springboot applications:
👉 https://t.co/FQdPowCCL9
It's like a superpower for 🍃Spring - makes you not only faster developer but also a happier person!
Lets dive into Just features 🧵