Microservices

Challenges in Microservices  Architecture

Microservices are an architectural approach to software development where software is composed of small independent services that communicate over well-defined APIs.

However, there are some challenges that we should be aware of before implementing Microservices architecture in projects.

Challenges of Microservices architecture and proposed solutions:

1)Data Synchronization: We have an event-sourcing architecture to address this issue using the async messaging platform. SAGA design pattern can address this challenge.

2)Security: An API Gateway can solve these challenges. Kong is popular open-source, and is being used by many companies in production. Custom solutions can also be developed for API security using the JWT token, Spring Security, and Netflix Zuul/ Zuul2.

There are enterprise solutions available, too, like Apigee and Okta (2-step authentication).

3)Services Communication: It’s complex to communicate between microservices.

There are different ways to communicate – Point to point using API Gateway and pub/sub-event-driven model.

4)Discovery: This will be addressed by API discovery tools like Kubernetes orchestration, Pivotal Application Services (PAS), container services (PKS), and OpenShift.

It can also be done using Netflix Eureka at the code level. However, doing it with the orchestration layer will be better and can be managed by these tools rather than doing and maintaining it through code and configuration.

5) Data Staleness: The database has to be continually up to date to provide current records. The API will fetch records from the current and up-to-date database. A timestamped access also can be introduced with every document withinside the database to test and affirm the current records. Caching may be used and custom designed with an appropriate eviction coverage primarily based totally on commercial enterprise requirements.

6)Distributed Logging, Cyclic Dependencies of Services, and Debugging :

There are multiple solutions for this.

Externalized logging can be used by pushing log messages to an async messaging platform like Kafka, Google PubSub, Built-in Kibana dashboard of OpenShift PAAS solution, which reads console logs from the container and aggregates in its ElasticSearch persistence on the server, It persisted even when POD is crashed and restarted, etc.

It’s difficult to identify issues between microservices when services are dependent on each other and they have a cyclic dependency. Correlation ID can be provided by the client in the header to REST APIs to track the relevant logs across all the pods/Docker containers.

7)Testing: This issue can be addressed with unit testing by mocking REST APIs or integrated/dependent APIs which are not available for testing using WireMock, BDD, Cucumber, integration testing, performance testing using JMeter, and any good profiling tool like Jprofiler, DynaTrace, YourToolKit, etc.

8)Monitoring & Performance: Monitoring can be done using opensource tools like Prometheus in combination with Grafana by creating gauge and matrices, GCP StackDriver, OpensShift, Influx DB, combined with Dynatrace, Amazon CloudWatch, VisualVM, JProfiler, Graphite, etc.

Tracing can be done by the latest Open tracing project or Uber’s open-source Jaeger. It will trace all microservices communication and show requests/response, and errors on its dashboard.

9)DevOps Support: Microservices deployment and support-related challenges can be addressed using DevOps tools like GCP, Kubernetes, OpenShift, and PCF with Jenkins.

10)Fault Tolerance: Netflix Hystrix can be used to break the circuit if there is no response from the API for the given SLA/ETA and provide a mechanism to re-try and graceful shutdown services without any data loss.

Please refer my blog for more relevant blogs: https://skolaparthi.com

Loading

Translate »