SPRING CLOUD AGIM EMRULI - MIMACOM
AGIM EMRULI @AEMRULI AEMRULI AGIM.EMRULI@ MIMACOM.COM
XD BOOT GRAILS CLOUD IO EXECUTION STREAMS, TAPS, JOBS FULL STACK, WEB SERVICE REGISTRY, CIRCUIT BREAKER, METRICS IO COORDINATION BOOTABLE, MINIMAL, OPS-READY INTEGRATION BATCH BIG DATA WEB IO FOUNDATION CHANNELS, FILTERS, ADAPTERS, TRANSFORMERS DATA JOBS, STEPS, READERS, WRITERS RELATIONAL DATA INGESTION, EXPORT, ORCHESTRATION, HADOOP NON-RELATIONAL DATA CONTROLLERS, REST, WEBSOCKET CORE FRAMEWORK SECURITY GROOVY REACTOR
TOOLBOX FOR DISTRIBUTED SYSTEMS
DISTRIBUTED SYSTEM DEPLOYMENTS @GITHUB 175 DEPLOYMENTS / DAY
NETFLIX SERVICE ORIENTED ARCHITECTURE
Config Bus Netflix Starters Spring Cloud AWS SPRING CLOUD INTRODUCTION Connectors CLI Cloud Foundry
Application JNDI Application CONFIGURATION MANAGEMENT MONOLITHIC VS. DISTRIBUTED
Spring Cloud Config GIT Spring Cloud Config Server SVN File
Config Server @Configuration @EnableAutoConfiguration @EnableConfigServer public class ConfigServerApplication { public static void main(string[] args) { SpringApplication.run(ConfigServerApplication.class, args); } }
Application Spring Cloud Config Client Application Spring Cloud Config Client Spring Cloud Config Server Application Spring Cloud Config Client
Bootstrap Application Spring Cloud Config Client @SpringBootApplication public class CustomerApp { public static void main(string[] args) { SpringApplication.run(CustomerApp.class, args); } }
Spring Cloud Bus 02 /bus/refresh Application AMQP Spring Cloud Config Server Application
PATTERNS STABILITY CAPACITY TRANSPARENCY
Hystrix Circuit Breaker Turbine Stream Aggregator Eureka Registry Ribbon Load Balancer Zuul Edge Feign HTTP Communication SPRING CLOUD NETFLIX
Execute Command Queue Pool available Run Fallback HYSTRIX CIRCUIT BREAKER
Thread - 1 Thread - 2 Thread - 3 Thread - 4 Thread - 5 Thread - 6 Thread - 7 Thread - 8 Tomcat Thread Pool X HYSTRIX BULKHEADS
Execute Command Queue Pool available Execute Command Queue Pool available Execute Command Queue Pool available HYSTRIX BULKHEADS
class SearchGateway { } @HystrixCommand(fallbackMethod = "fallback") public List<SearchHit> search(string query) { return ; } public List<SearchHit> fallback() { return Collections.emptyList(); } HYSTRIX EXAMPLE SERVICE CONSUMER
HYSTRIX TRANSPARENCY
@EnableCircuitBreaker @EnableHystrixDashboard public class HystrixApp { public static void main(string[] args) { SpringApplication.run(HystrixApp.class, args); } } HYSTRIX DASHBOARD EXAMPLE
Dashboard Dashboard TURBINE AGGREGATOR
X Eureka EUREKA SERVICE DISCOVERY
@SpringBootApplication @EnableDiscoveryClient public class CustomerApp { public static void main(string[] args) { SpringApplication.run(CustomerApp.class, args); } } spring.application.name=customers EUREKA REGISTRATION EXAMPLE
Application Discovery Client Host Port URI EUREKA REGISTRATION EXAMPLE
Eureka Eureka Load Balacner RIBBON LOAD-BALANCER
@ public class { @Autowired @LoadBalanced RestTemplate resttemplate; public String call() { return resttemplate.getforobject("http://customers/{id}", String.class,"23"); } }
Web Browser Eureka Web Browser Eureka Edge Proxy Load Balacner ZUUL EDGE-SERVICE
@EnableAutoConfiguration @EnableZuulProxy public class SimpleZuulServerApplication { public static void main(string[] args) { SpringApplication.run(SampleZuulProxyApplication.class, args); } } http://localhost:9090/customers http://localhost:9090/stores ZUUL REVERSE PROXY SETUP
Browser Web Server Load Balancer Config Server Customers Stores Discovery Eureka Circuit Breaker Dashboard
SPRING CLOUD AMAZON WEBSERVICES
Instance Meta-data @Component public class ApplicationInfoBean { @Value("${ami-id}") private String amiid; @Value("${hostname}") private String hostname; @Value("${instance-type}") private String instancetype; @Value("${services/domain}") private String servicedomain; }
Amazon RDS Schema Design Query construction / tuning Availability Backup & Recovery Patch Management Storage Upgrades
Amazon RDS @EnableRdsInstance( dbinstanceidentifier = test", password = secret", readreplicasupport = true) public static class AppConfig {}
RDS Instance Support @ public class JdbcPerson implements Person { private final JdbcTemplate jdbctemplate; @Autowired public JdbcPerson(DataSource datasource) { this.jdbctemplate = new JdbcTemplate(dataSource); } @Override @Transactional(readOnly = true) public List<Person> all() { return this.jdbctemplate.query("select * FROM Person, ); } @Override @Transactional public void store(person person) { this.jdbctemplate.update("insert INTO Person ); } }
Amazon SQS HTTP Messaging Only String payload No Transactions Visibility Rules
Message Listeners @Component public class SqsController { @MessageMapping("myQueue") @SendTo("replyQueue") private String receivemessage(messagetoprocess message, @Header( ApproximateFirstReceiveTimestamp ) String timestamp) { return "somereply"; } }
Application Instance Application Instance Application Instance
SNS Controllers @RestController @RequestMapping("/sns/receive") public class SnsEndpointController { @NotificationSubscriptionMapping public void confirmsubscription( NotificationStatus notificationstatus) { notificationstatus.confirmsubscription(); } @NotificationMessageMapping public void receivenotification( @NotificationMessage String message, @NotificationSubject String subject) { } }
Elasticache Application Instance Application Instance Application Instance Application Instance
Caching @ public class Expensive { @Cacheable("CacheCluster") public String calculateexpensivevalue(string key){ return ; } }
{ } "Resources": { "ec2instance": { "Type": "AWS::EC2::Instance", "Properties": { "ImageId": "ami-6a56b81d", "InstanceType": "m1.small", } }, "database": { "Type": "AWS::RDS::DBInstance", "Properties": { "AllocatedStorage": "5", "DBInstanceClass": "db.m1.small", "DBName": "test", } }
Other talks Talk Speaker Time From Zero To Hero with Spring Boot Stéphane Nicoll 11:00 Modern Enterprise Java Architectures with Spring 4.1 Jürgen Höller 12:00 Anatomy of Microservice Landscapes Michael Plöd 17:00 Master Spring Boot auto-configuration Stéphane Nicoll 11:00 Cloud Patterns on AWS Agim Emruli 16:00
Agim Emruli - mimacom @aemruli