Microservices Architecture for Enterprise Software Development
Microservice architecture is a method of enterprise software development, as a suite of independently deployable, small, modular services in which each service runs a unique process and communicates through a well-defined, lightweight mechanism to serve a business goal.
Also, Microservices architecture is suitable when it is required to support different kinds of a client like desktop browsers, mobile browsers, and native mobile applications, and it is required to integrate with other applications via web services or message broker.
Advantages: Microservices Pattern for Enterprise Software Development
- Small teams of developers working on an application.
- New team members quickly become productive.
- Easy to understand the application.
- Enables the continuous delivery and deployment of applications.
- Scalability of multiple copies of the application.
- Taking advantages of emerging technologies.
Drawbacks: Microservices Pattern
- Testing is more difficult.
- It has some deployment complexities.
- Developer must implement inter-process communication.
- Increased memory consumption. The microservice architecture replaces N monolithic application instances with NxM services instances. Correspondingly if each service runs in its own JVM (or equivalent), which is usually necessary to isolate the instances, then there is the overhead of M times as many JVM runtimes.
- As it is a distributed system, so it can result in duplication of effort
- Business Capability Decomposing – e.g Order Management, Delivery Management
- Subdomains Decomposing– Domain Driven Design (DDD) refers to dividing application as per the business subdomains
- Multiple service instances per host- Run multiple instances of different services on a host (Physical or Virtual machine)
- Single Service Instance per Host – Each service is deployed as a set of service instances for throughput and availability
Microservice chassis frameworks
Microservices can be developed with below frameworks:
- JAVA- Spring Boot, Dropwizard
- Go – Gizmo, Micro, Go Kit
- Remote Procedure Invocation – REST, Apache Thrift
- Messaging– Messaging channels like Apache Kafka, RabbitMQ can be used as messaging channels.
API Gateway – API gateway is the single entry point for all clients. e.g Netflix API, Zuul Gateway.
As services instances are hosted at a particular location, therefore, a number of instances and IP address changes dynamically, virtual machines are allocated dynamic IP, so service discovery servers are required.
- Clustering solutions such as Kubernetes and Marathon run a proxy on each host that functions as a server-side discovery router.
- Server-side discovery server – When making a request to a service, the client makes a request via a router (a.k.a load balancer) that runs at a well-known location. Then, the router queries a service registry, which may be there inside the router, and forwards the request to an available service instance. e.g AWS Elastic Load Balancer.
Used to determine if the request to a particular service returned a successful response e.g Netflix Hystrix.
- saga pattern – (to maintain data consistency)A saga is a sequence of local transactions, where each local transaction updates the database and publishes a message or event to trigger the next local transaction in the saga. Now, if a local transaction fails because of violation of a business rule then, the saga executes a series of compensating transactions that undo the changes resulting from the preceding local transactions.
- shared database
- The database can be database per service
- We can use the JSON Web Token to API gateways for authorization.
Health check API
- Spring Boot Actuator module helps to implement health check API for any service.
Hire the best enterprise app development company!
Though Microservices is great architecture, but we need to follow some basic guidelines while designing an application.
- It should follow the Single responsibility principle. Because this with a limited and focused business scope will help in agility and delivery of service.
- During the design phase, must find boundaries, and align them with business capabilities.
- Make sure to design independent deployment and developing component. Also, the focus should be on the scope of microservices and not on making the service smaller.
- We should keep in mind to reduce the Database hits to get minimum throughput. Also, implementing cache is a great idea to save database interaction.
Latest posts by Jayendra Kumar (see all)
- Custom Web Designs or Website Templates – What Should You Prefer? - May 10, 2019
- Microservices Architecture for Enterprise Software Development - September 1, 2018