I'm covering a new trend in distributed enterprise architecture – microservices. How the leading technology companies like Netflix and Amazon come to use that approach. How does it help them to scale their infrastructure. And how the newest set of tools in the Spring family would help you to apply those design principles in practice.
Spring has always been about patterns and Spring Cloud brings you implementation of several widespread ones for distributed apps.
And we'll try to show why DevOps should come in front of Microservices approach
7. ●
Traditional approach
●
Easy to deploy
●
Availability challenges
●
Hard to scale
●
Centralized release cycle
●
Single Responsibility Principle?
Monolithic .war
20. ●
Best set of tools for each service
●
Inherently loosely coupled
●
Reduced time to market
●
Parallel development
●
Independent and frequent releases
●
Designed to scale
Benefits
21. ●
Distributed are inherently hard
●
Significant operation overhead
●
Service discovery
●
Redundancy
●
Loadbalancing
●
Performance penalty
●
Requires DevOps skills
Challenges
39. Service Discovery: Eureka Server
@SpringBootApplication
@EnableEurekaServer
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
40. Service Discovery: Eureka Server
server:
port: ${PORT:8761}
eureka:
client:
registerWithEureka: false
fetchRegistry: false
server:
waitTimeInMsWhenSyncEmpty: 0
41. Service Discovery: Eureka Server
src/main/resources/bootstrap.yml
spring:
application:
name: my-service
42. @Autowired
private DiscoveryClient discoveryClient;
@Override
public void listMyServiceInstances {
discoveryClient.getInstances("my-service")
.forEach((ServiceInstance s) -> {
System.out.println(
ToStringBuilder.reflectionToString(s));
});
}
Service Discovery: Eureka Server