Image your eCommerce business is growing fast and need to scale your app to serve million request per day and thousands transaction per day. Your current entire app is built in micro-services based. Micro-Services architecture is the system architecture concept that break your entire app in to small app – independent services that communicate each other over network. Let say for your eCommerce app has catalog, product, payment, notification, user services which is run independently (loose coupling). Each services is focus to handle the specific task (use-case). Then your app is growing so good and you need to scale your app.
Strategy to Scale the Micro Services Based
Before you do something to scale your app better you need to think the strategy first that meet your operation cost and wish it will be approved by your client or company.
First, Optimize Individual Services
Take a look on your each services and optimize on every part such as do caching, database optimization and asynchronous function. Implement specific services for caching to reduce load on databases or downstream services by using memcached or redis. The other way is by set indexing on your database and optimize the query usage of your application.
Second, Vertical Scaling (Scale Up)
You may to increase the storage, RAM and used the new/faster machines for your services that need to scale (very busy workload). At this stage, you are not required to scale for all services. You just scale-up for which services that need to scale up, this is the different from monolith-services that need you to scale your entire app.
Third, Horizontal Scaling (Scale out)
At this stage, you may create more that one instance for you services to serve the request by implementing dockerized. You can use load balancer such as nginx or AWS ELB to distributed request for your instance services. You are not required to create multiple instance for all your services for cost consideration, you may focus on the services that need to scale-out.
The other one is by scale-out your database by create replicas, shard database and consider database per service pattern. Another one is by implementing message queue and data streaming to help asynchronous communication among services.
Read : Message Broker using Rocket MQ in Java Spring Boot
Fourth, Orchestration & Automation
At this stage, you may implement container orchestration such as using kubernetes, set auto-scaling config rules for services to add or remove instances based on metrics such as the CPU usage, memory or request latency.
Another advanced technique is by implementing event-driven-architecture that reduce direct services dependency and improve scalability, CDN integration to serve fast load for static assets and inject monitoring and observability.

If you are need to scale your monolith application, please take a look at this post.
What’s makes different when scaling the microservices based from monolith is you may do granular scaling—only the stressed services need more resources, not the entire app.
If you need help or discussion how to scale your application, send me a message.

Leave a Reply