How to improve microservice architecture
In one of the previous posts, it was explained the microservice architecture. This post will explain what can be done to improve microservices architecture.
Microservices should be organized, in such a way, that each service has all the necessary functionality, acts as a separate component that has no dependencies on other components and has its own data warehouse. Splitting the database into multiple smaller ones results in reduced data volume and quicker response. That way, the application can be scaled to a great extent.
Microservice architecture provides us with high availability mode(is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher than normal period). However, this means that requests can be sent to multiple instances of the same microservice. This problem is solved with a load balancer (improves the distribution of workloads across multiple computing resources). There are several types of load balancer algorithms, such as Round Robin, Least connections, Least traffic … It is necessary to do the research and choose the best algorithm.
Further improvements could be made with the introduction of the Content Delivery Network (CDN). It solves two problems. The first problem is client distance from the server. CDN would redirect requests to the nearest server and thus allow the shortest waiting time. Another problem is retrieving a large amount of the same static data. CDN would use his resources (HDD, SSD, or RAM) to cache the data for a certain amount of time (Time To Live).
Caching improves performance by keeping recent or often-used data items in memory locations that are faster or computationally cheaper to access than normal memory stores. When the cache is full, the algorithm must choose which items to discard to make space for the new ones.
The more the most used data is cached, the greater is the savings on returning results