2. About me
Sascha Möllering
sascha.moellering@zanox.com
Lead Engineer / DevOps Hipster
zanox AG
http://www.der-maschinenstuermer.de/
@sascha242
3. About me
Java Magazin 11.14
Architektur im Kontext der Cloud: Patterns und
Best Practices
AWS Virtual Cloud Summit
Continuous delivery in AWS using Docker
http://aws-summit.de/
Entwickler Spezial: Docker
Über den Wolken: Ein Erfahrungsbericht zum
Docker-Einsatz in der Amazon Cloud
4. Agenda
• AWS Overview
• Creating a cloud service
• Real World example
• Cloud deployment
• Q&A
7. AWS Overview
Region
US-WEST (N. California) EU-WEST (Ireland)
ASIA PAC
(Tokyo)
ASIA PAC
(Singapore)
US-WEST (Oregon)
US-EAST (Virginia)
SOUTH AMERICA (Sao
Paulo)
GOV CLOUD
ASIA PAC
(Sydney)
EU-CENTRAL (Frankfurt)
9. AWS Overview
EC2: Resizable compute capacity
AutoScaling: scale up or down
Route 53: Domain Name System
ELB: Load Balancing
Elastic IP: Static IP address
10. AWS Overview
RDS: Managed database service
DynamoDB: NoSQL implementation
Redshift: data warehouse solution
ElastiCache: Managed cache
Kinesis: Service for streaming data
12. Starting point
• How can we leverage the Cloud?
• Our application:
– Simple Java based web application
– One application
– One database
– Runs in our own DC
13. Creating a cloud service
• Initial setup:
– Route53 for DNS
– One Elastic IP (static IPs for the Cloud)
– One EC2 instance
• Web Application
• Database
– One AZ
15. Creating a cloud service
• Simple approach to scale:
– More RAM
– More CPU power
– More IOPS
– Different EC2 instance type
• Approach will hit a barrier
16. Creating a cloud service
• Problems:
– No failover
– No redundancy
– Database and application on one instance
– Does not scale very well
17. Creating a cloud service
• Separate Web Application from DB
– One EC2 instance for the Web Application
– One EC2 instance for the DB
– Or: Managed DB service (RDS)
• One AZ
22. Creating a cloud service
Availability Zone
Database
Availability Zone
Database
23. Creating a cloud service
• Problems:
– Still limited scaling capabilities
– If one EC2 instance crashes, 50% less
capability
24. Creating a cloud service
• Add additional EC2 instances
• Add read replicas in RDS
25. Creating a cloud service
Availability Zone
Database
Availability Zone
Database
26. Creating a cloud service
• Problems:
– Naive implementation
– Does not leverage AWS services
– Limited scaling
– Can be quite expensive
27. Creating a cloud service
• Refactoring
• Introduce caches to take load from DB
• Use S3 and CloudFront to ship static
content
• Store session data in DynamoDB
• Add Autoscaling
28. Creating a cloud service
• Autoscaling
– Automatic resizing of compute clusters
based on demand
– Integrated to Amazon CloudWatch
– Maximum and minimum pool sizes
– Autoscaling policies triggered by
CloudWatch alarms
30. Creating a cloud service
• Started with a simple web application
• Added several Amazon services
• Managed to shift load from application
to services
• Added caches and CDN
• Added Autoscaling
31. Creating a cloud service
• Next steps:
– SOA
– Loose coupling: decouple interactions
– Amazon services, don‘t reinvent the wheel
– Database federation
– Database sharding
32. Real world example
• Elastic architecture that grows and
shrinks
• Multiple AZs
• Use case: streaming data
• Decoupling using Kinesis
• IAM Roles for managing credentials
• CloudWatch for monitoring
35. Vert.x
“Vert.x is a lightweight, high performance application
platform for the JVM that's designed for modern
mobile, web, and enterprise applications.”
36. Architecture
• Main framework Vert.x
• mod-kinesis (Kinesis-Adapter for Vert.x)
• AWS Java SDK
• IAM roles for Amazon EC2 instances
• Coda Hale metrics and CloudWatch reporter
• Jedis (Redis client for Java)
• …
Frage: wie können wir Skalieren?
AWS als Basis
Zeige heute:
Patterns und Best Practices in der Cloud anhand von AWS
Beispielapplikation in Java, die skaliert werden soll
9 bzw. 10 verschiedene Regionen
Region: separierte geographische Bereiche
Neu: EU-Central in Frankfurt
Regions werden in Availability Zones unterteilt
Jede AZ is isoliert, aber durch Leitungen mit niedriger Latenz verbunden
A group of AZ is a Region
A group of Datacenter is an AZ
Elastic IP addresses are static IP addresses designed for dynamic cloud computing.
An Elastic IP address is associated with your account, not a particular instance, and you control that address until you choose to explicitly release it
Im Fehlerfall (EC2-Instanz ist down) kann die EIP umgemappt werden
RDS: fully managed database service
Supports: MySQL, Oracle, Microsoft SQL Server, PostgreSQL
automatically patches the database software and backs up your database
- Multi AZ: Multi-AZ deployment option you can run mission critical workloads with high availability and built-in automated fail-over from your primary database to a synchronously replicated secondary database
- Multi AZ: Multi-AZ deployment option you can run mission critical workloads with high availability and built-in automated fail-over from your primary database to a synchronously replicated secondary database
- Minimum poolsizes is great if you have crashing EC2 instances,
Alle Bestandteile der Applikation in Services auslagern, die unabhängig voneinander skaliert werden können
Loose Kopplung der Komponenten über Messaging Systeme
S3
DynamoDB
RDS
RedShift
EMR
----- Meeting Notes (26/10/14 22:22) -----
Fabric -> Boto
----- Meeting Notes (26/10/14 22:22) -----
Fat JAR
User-data script for ec2
- ein Mal bei initialen Setup der ec2-Instanz ausgeführt
- Aktualisiert die Pakete
- Installiert Docker
- Startet Docker Service
- Starten der Docker Instanzen mit den passenden Parametern