Spring Cloud
In our last microservices-springboot article, we went through some of the ways that Spring helps us create REST microservices. But developing an application is just one piece of the puzzle. As developers, we are so focused on developing the application that we sometimes forget about what happens once its deployed to production. We work hard to ensure we keep up to date with all of the best practices such as using SOLID principles, design patterns, Test Driven Development, and Continuous Integration. Nothing makes us happier than delivering a product with zero known defects. It makes the production support team happy too. Of course, that happiness can quickly turn to frustration if the application is a nightmare to deploy and configure. Even worse, if the application cannot be monitored forcing the support team to constantly be in reactive mode. Spring Cloud along with Netflix OSS can create an environment that addresses a lot of these common issues. Configuration Having to maintain configuration files for multiple services can be time-consuming and error-prone. Spring Cloud provides a configuration server that maintains all of the configuration files in one central repository. Springboot applications can automatically tie into the config server by simply including the appropriate starter project. Discovery Without discovery, service locations would have to be hard-coded or maintained in a list. Each time a service was moved, every client would need to be modified. Even with small applications, this can quickly get out of hand. Luckily Spring provides a Netflix discovery service called Eureka which allows services to register their location. Clients now only need to know the location of the discovery service and the service id. A gateway can further simplify this. Gateway Netflix has also shared their reverse proxy which is known as Zuul. It can proxy calls to microservices. This is extremely helpful as clients only need to know about the gateway. The gateway would determine where to route the request based on the url passed in. There are multiple configurations, but one of the more common ones is for the url to contain the service-id which the gateway uses to lookup the actual location from the discovery service. In addition to routing, the gateway can also execute filters before and after a request is executed. This opens the door to many possibilities such as:
Circuit Breakers and Fallbacks Netflix provides Hystrix which does the following (taken from their description on Github):
Health and Metrics Spring provides many ways to monitor the health of the system. This can be achieved through :
Next This article just scratches the surface on what Spring Cloud has to offer. In upcoming articles, we look at AD Cloud and how it can help tie everything together. Comments are closed.
|
Visit our Code Repository for samples and demos.
ARTICLES
All
|