ABN Tech Week trains engineers on the most important issues in building highly scalable software systems. The topic today is: How to improve API performance?
The diagram below shows 5 common tricks to improve API performance.
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.
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.
How do you do it?
We offer ABN Oppa, the IT managed service that takes your software operation problems away from you, to us. The magic combo is real: It’s cheaper, better, and more reliable than you do it yourself. Visit www.AbnAsia.org to check out our services.