Skip to content
Related Articles

Related Articles

Microservices Introduction

Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 20 Jun, 2022
Improve Article
Save Article

Microservice is a small, loosely coupled distributed service. Microservice architecture evolved as a solution to the scalability, independently deployable, and innovation challenges with Monolithic architecture (Monolithic applications are typically huge – more than 100,000 lines of code). It allows you to take a large application and decompose or break it into easily manageable small components with narrowly defined responsibilities. It is considered the building block of modern applications. Microservices can be written in a variety of programming languages, and frameworks, and each service acts as a mini-application on its own. Microservice can be considered as the subset of SOA(Service Oriented Architecture). 

Reasons for using Microservice: 

In monolithic applications, there are a few challenges:

  1. For a large application, it is difficult to understand the complexity and make code changes fast and correctly, sometimes it becomes hard to manage the code.
  2. Applications need extensive manual testing to ensure the impact of changes.
  3. An application typically shares a common relational database to support the whole application.
  4. For small changes, the whole application needs to be built and deployed.
  5. The heavy application slows down start-up time.

Benefits of Microservices:

  1. Small Modules – Application is broken into smaller modules that are easy for developers to code and maintain.
  2. Easier Process Adaption – By using microservices, new Technology & Process Adaption becomes easier. You can try new technologies with the newer microservices that we use.
  3. Independent scaling – Each microservice can scale independently via X-axis scaling (cloning with more CPU or memory) and Z-axis scaling (sharding), Y-axis scaling (functional decomposition) based on their needs.
  4. Removes dependency – Microservice eliminates long-term commitment to any single technology stack.
  5. Unaffected – Large applications remain largely unaffected by the failure of a single module.
  6. DURS – Each service can be independently DURS (deployed, updated, replaced, and scaled).
  7. Increased Security: –Microservices enable data separation. Each service has its own database, making it harder for hackers to compromise your application.
  8. Open Standards: –APIs enable developers to build their microservices using the programming language and technology they prefer.

Restrictions of Microservices:

  1. Configuration Management – As it becomes granular the headache comes with configuring the services and monitoring those. You need to maintain configurations for hundreds of components across environments.
  2. Debugging – Tracking down the service failure is a painstaking job. You might need to look into multiple services across different components. Centralized Logging and Dashboards are essential to make it easy to debug problems.
  3. Automation – Because there are a number of smaller components instead of a monolith, you need to automate everything – Builds, Deployment, Monitoring, etc.
  4. Testing – Needs a greater effort for end-to-end testing as it needs all the dependent services to be up and running.
  5. Coordination – While handling requests across multiple independent services there is a requirement for proper workflow management.

Microservice Frameworks for Java: There are several microservices frameworks that you can use for developing for Java. Some of these are:

  1. Spring Boot – This is probably the best Java microservices framework that works on top of languages for Inversion of Control, Aspect-Oriented Programming, and others.
  2. Dropwizard – Dropwizard pulls together stable, mature libraries from the Java ecosystem into a simple, lightweight package that lets you focus on getting things done.
  3. Restlet – Restlet Framework helps Java developers build better web APIs that follow the REST architecture style.
  4. Spark – A micro-framework for creating web applications in Kotlin and Java 8 with minimal effort.

Others that you can consider include Ninja Web Framework, Play Framework, RestExpress and Restx Framework.

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!