Transformation Monolith To Micro Service

Nowadays , in software development , all the companies aim the products that scalable ,sustainable and easy to maintain.Especially for huge domains,microservices come up as best alternative to succeed this process.

As Healthcare Solutions , we try to transform gigantic hospital information system that consist of almost 13532 classes ,17165 endpoints and over a million lines of code into approximately 15–20 micro services to handle all issues come from monolith structure easily.Today i am going to tell you what are the products and how we use them while the transformation happening.

Framework: we pick spring boot as a framework over quarkus because we need a thing that proven itself.May be in the future quarkus will be an option for us.We start creating config(parent) project that all the microservices derived from and also config derives from spring boot parent(version 2.5.4).

Structure of project.

Cache: Our choice is redis over hazelcast as cache mechanism .Performance issues and ease of use pointed out redis to choose.

source : https://stackshare.io/stackups/hazelcast-vs-redis

Database versioning : we select liquibase over flyway.Consequently flyway undo feature requires license and liquibase support many databases in many form(json,xml,sql).If change of database in your plans liquibase is one step ahead.

source : https://stackshare.io/stackups/flyway-vs-liquibase

Mapping Tools : If you don’t want to write mapper classes and don’t want to see mapper classes in the source code , mapstruct is the best alternative as (data transfer object(d.t.o)← →entity) mapping tool due to performance.It doesn’t use reflection and spend time while mapping.It creates mappers during compilation and addressed them under to target folder.You can see your mapper class smoothly and they don’t take a space project source classes.

Auth-Server: In this kind of project you have to think financial side.Our project run on closed network and Keycloak is the open source authorization server.So we don’t need ultra secure application beside compared to its competitors(Auth or Okta) it doesn’t have a cost.Additionally It has perfect spring integration ,these features direct us to the Keycloak.

Api-Documentation: OpenApi3 is the first draft from the pool.In plain words when we see how it readily customize and fit our project, we didn’t look the alternatives.

Micro-Service-Communication: Feign client was the simplest solution for us.Unlikely web client or rest template there are plenty of pros .

  1. The developer need not worry about the implementation. Just to create abstract Feign interface and few annotations — declarative principle. (If you want customized configuration, then it will hold some code)
  2. With Spring Cloud Eureka, Ribbon client-side load-balancer will be equipped with Feign client.
  3. No need to worry about the unit test, because there is no implementation from you to test. (Arguable)
  4. Supports Feign annotations and JAX-RS annotations.
  5. Highly compatible and easily configurable with Spring Cloud (Specially with Eureka server registry)
  6. Allows Feign client configuration via @Configuration class or application properties.
  7. Allows us to add interceptors. (Add interceptors via @Configuration or application properties. Alternatively can use Spring Cloud provided interceptors as well. Example — BasicAuthRequestInterceptor)
  8. Hystrix support for fall-back mechanism.
  9. Logging
  10. Error handling

Log-Tracing: There is a confusion between splunk and elastic stack , at the end of day we are limited by prices.Due to being open source elastic stack promoted.

Splunk is proprietary software with a price tag. After one integrates several data sources with the platform, the cost will increase greatly as data is continuously generated.

The open-source ELK Stack is free, but the true picture is not so black and white. The cost of the platform’s hardware and maintenance also adds up. To lower the cost of using ELK, features, plugins and tools must be developed.

source: https://stackshare.io/stackups/kibana-vs-splunk

Monitoring : Grafana and Prometheus, both help us in tackling issues related to complex data in a simplified manner.Grafana is an open-source visualization software, which helps the users to understand the complex data with the help of data metrics.It equips the users with features like alert systems, sharing of the dashboard.It also helps users in studying time-series analytics.

Prometheus is an open-source event monitoring and alerting tool.We use both of them together to monitor our application.Beside Spring boot admin is the one of the tool we benefit.It gives us capable of changing log level at run time.

Xss-Protection : As we mentioned above our application runs on closed network so we use antisamy as protector by filtering requests.

System-Tracing : Zipkin is our favorite over jaeger due to simplicity.Zipkin provides Docker images and Java programs. Unlike Jaeger, Zipkin is a single process that includes the collector, storage, API, and UI. This makes deployment easier, but the story is less clear. Jaeger has a dedicated deployment documentation section.

Criteria-Api : Blaze-Persistence is easy to use and allows you to write complex queries with a consistent builder API.

source : https://persistence.blazebit.com/

On next topics we will mention details of these tools by code examples.

--

--