Microservices Introduction

microservice is a small, loosely coupled distributed service. Microservice Architectures evolved as a solution to the scalability and innovation challenges with Monolith architectures (Monolith applications are typically huge – more 100, 000 line of code). It allows you to take a large application and decompose or break into easily manageable small components with narrowly defined responsibilities.

Reasons for using Microservice:
In monolith application, there are 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. For small change, the whole application needs to be built and deployed.
  4. The heavy application slows down start-up time.

Benefits of Microservices:

  1. Small Modules –
    Application is broken into smaller modules which 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), based upon their needs.
  4. Unaffected –
    Large applications remain largely unaffected by the failure of a single module.
  5. DURS –
    Each service can be independently DURS (deployed, updated, replaced, and scaled).

Restrictions of Microservices:

  1. Configuration Management –
    As it becomes granular the headache comes for 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 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.

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, light-weight 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.

 

Related Articles

post a comment