Skip to main content
  1. Posts/

Tips on Microservices

··648 words·4 mins
Author
Hairizuan Noorazman
Software engineering experiments, implementation notes, and lessons learned.

Setting up microservices is really quite hard. Its not just about the technology but it involves culture and habits that the team have in order to have the discipline and also the ease in order to create services that would scale well. One would have to kind of switch the thinking behind all the best practices and theory. I kind of summarized some points that are found interesting about how some of the companies deal with and manage microservices.

Important: These are not best practises but it is more of tips of how to get microservices working.

  • Use some sort of cloud/virtualization technology (although I say it is not really just the technology but this is like the minimum needed). Why do you need this? It is so that you can easily scale your individual components. Imagine if you were using the traditional way of buying hardware in order to scale up? The moment you attempted to scale, you will be told that you will be told that you would have to wait a couple of months just to get that hardware up and running.
  • Some components one would need in order to get the whole thing up and running would be:
    • VMs or Docker containers to host the compute services
    • Event bus - The one component that would handle all the messages generated by services. The events that occur would distribute among all the services in a pubsub way of doing things.
    • Centralized logging - For convenience in trying to understand what is happening in each service within the microservices world.
  • Services/apps in the microservices architecture has to be small and nimble and has to ensure that it should only do 1 thing and it should do it well. It should be coded such that the whole model of that services can be maintained in a single developer’s head after just reading it and it is maintainable that way; ideally. But with these small codebases for each service, it should be easily replaceable. If you try to scale a component and it starts straining beyond a certain point? Just kill it.
  • If you need a library of some code base to be distributed among your service, just don’t do that. Instead, one you could do is to create a distributed service instead and let that handle all that load/work
  • Each service should just already just expect errors. Network fails, Other components will fail. Only thing you would need to just ensure that the service would be able to withstand all that.
  • Centralize your logging with a distributed service. If you have like tens/hundreds of microservices and each one runs like 4-5 copies of itself, you would need to be crazy to go into each and every single one of those service to get the logs.
  • Battle between async and sync services. Some of the speakers were all for async microservices as that seems to be the natural tendency of the microservices world. However, async services are not easily understood by developers; developers tend to think more of the synchronous way of doing things where processes occur in some sort orderly linear fashion. But whatever it is, one should just stick with paradigm of communicating any events that occur back to event bus.

References

Here are some of the videos as reference for all the points that I mentioned above:

Related

Nginx as API Gateway - focusing on auth_request directive

··1245 words·6 mins
On virtual machine How to “protect” api requests https://www.nginx.com/blog/deploying-nginx-plus-as-an-api-gateway-part-1/ Mostly is the auth_request directive Microservices are a software architectural style that structures an application as a collection of loosely coupled, independently deployable services. Each service in a microservices architecture represents a specific business capability and communicates with other services through well-defined APIs (Application Programming Interfaces). These services are designed to be small, focused, and can be developed, deployed, and scaled independently. Its a somewhat common architectural pattern that many companies go to when it comes to scaling out their development teams to build out their product.

System Design Notes

·1227 words·6 mins
General framework for system design interviews # From the following website: https://www.youtube.com/watch?v=i7twT3x5yv8 Specify Requirements Design High Level Functional Components

comments powered by Disqus