In the previous blog post we defined the overall micro service concerns.
This blog series we will see the what are operations models or components using spring framework with some supporting services from Spring Cloud, Netflix OSS, etc.. to fix the Micro Service concerns. The source code is available on GitHub
The below table Maps the java technology to identify most common challenges on Micro Service operations model.
A SYSTEM LANDSCAPE
This diagram covers the run time aspects of the system, but doesn’t touch on the packaging, continuous integration, scaling, high availability, self healing side which are also very important in the MSA world. Click the link Zero Downtime Deployment
Config Service: Spring Cloud Config is centralized configuration server for distributed systems. It uses a pluggable repository layer that currently supports local storage, Git, and Subversion. Spring Cloud Config provides a way to Changing configurations on running services with out restart the service.
Service Discovery: Netflix Eureka allows micro services (Client) to register themselves at run time as they appear in the system landscape. A service registry is useful because it enables client-side load-balancing.
To set up the server you must:
- annotate the registry application with
@EnableEurekaServer(e.g. in RegistryApplication.java)
- annotate the Client application with
- Test the end-to-end result by starting the eureka-service first and then, once loaded, starting the eureka-client. The eureka-client will take about a minute to register itself in the registry
- Service Registry contain the eureka-client IP address with port or host name
In the service discovery web app we should now be able to see our three business services and the API Gateway server (http://localhost:8761):
API Gate Way: Netflix Zuul is (of course) our gatekeeper to the outside world, not allowing any unauthorized external requests pass through. Zulu also provides a well known entry point to the micro services in the system landscape
Netflix Ribbon is Dynamic Routing and Load Balancing can be used by service consumers to lookup services at run time. Eureka registry to locate appropriate service instances. If more than one instance is found, Ribbon will apply load balancing to spread the requests over the available instances. Ribbon does not run as a separate service but instead as an embedded component in each service consumer.
Swagger REST API: REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic
Monitor Dashboard: Circuit breaker Netflix Hystrix provides circuit breaker capabilities to a service consumer. If a service doesn’t respond (e.g. due to a timeout or a communication error), Hystrix can redirect the call to an internal fallback method in the service consumer. If a service repeatedly fails to respond, Hystrix will open the circuit and call on every subsequent (HTTP) fallback method until the service is available again. Hystrix dashboard can be used to provide a graphical overview of all circuit breakers in a system landscape.
Centralized log analysis: To be able to track messages and detect when they got stuck we need a centralized log analysis function that is capable to reaching out to the servers and collect the log-files that each micro service produce. The log analysis function stores this log information in a central database and provide search and dashboard capabilities.
OAuth2 Security: Spring Security OAuth2 we can quickly create systems that implement common patterns like single sign on, token relay and token exchange between resource servers. Using interceptor to make a Feign client behave like
OAuth2RestTemplate (fetching tokens etc.)