Eberhard Wolff http://ewolff.com

Java Architectures
A New Hope
Eberhard Wolff
http://ewolff.com
What happens
with a talk titled
like this?
Eberhard Wolff - @ewolff
Architecture
of Enterprise
Java Apps
Eberhard Wolff - @ewolff
Eberhard Wolff - @ewolff
How can I
implement a
new feature???
Eberhard Wolff - @ewolff
!
Eberhard Wolff - @ewolff
ECommerce System
New Stuff
Spring &
OSGi
Eberhard Wolff - @ewolff
ECommerce System
New Stuff
New
Stuff
Spring
&
OSGi
Eberhard Wolff - @ewolff
No legacy code
HTTP
Links
Any technology
Small code base
New
Stuff
"
Eberhard Wolff - @ewolff
Micro Services
•  Component Model
•  Component…
•  Separate process
•  Individual deployment unit
•  GUI+Logic
•  Small services+GUI – unlike SOA
Eberhard Wolff - @ewolff
Online Shop
Order
Billing
Catalog
Search
Eberhard Wolff - @ewolff
Online Shop
Order
Billing
Spring Batch
Oracle
Catalog
Spring MVC
MongoDB
elasticsearch
Search
Eberhard Wolff - @ewolff
Service might
be even
smaller Continuous
Delivery
Eberhard Wolff - @ewolff
Continuous Delivery:
Build Pipeline
Automated
Acceptance
Testing
Commit
Stage
Manual
Explorative
Testing
Automated
Capacity
Testing
Release
Eberhard Wolff - @ewolff
Without Micro Services
•  Modify order process slightly
•  Billing, Search & Catalog unchanged
Order
Billing
Catalog
Search
Eberhard Wolff - @ewolff
Order
Billing
Catalog
Search
Eberhard Wolff - @ewolff
Continuous Delivery:
Everything Tested etc
Automated
Acceptance
Testing
Commit
Stage
Order
Billing
Catalog
Search
Manual
Explorative
Testing
Automated
Capacity
Testing
Release
Eberhard Wolff - @ewolff
Build Pipeline
•  Just one component changed!
•  Lots of unneeded work
•  Takes much too long
Eberhard Wolff - @ewolff
With Micro Services
Automated
Acceptance
Testing
Commit
Order
Stage
Manual
Explorative
Testing
Automated
Capacity
Testing
Release
Eberhard Wolff - @ewolff
Release
•  Just a single component
•  Faster feedback
•  Easier deployment
•  Rollback of single service also easier
Eberhard Wolff - @ewolff
How to scale
agile?
Implement
more feature
Eberhard Wolff - @ewolff
Conways Law
Architecture
copies
communication structures
of the organization
Eberhard Wolff - @ewolff
Online Shop
Order
Billing
Catalog
Search
Component = Team
Eberhard Wolff - @ewolff
Micro Service •  Team independent from each other
•  No code dependencies
•  Can use individual technology stack
•  Can even deploy independently
•  Speed up development
Eberhard Wolff - @ewolff
Architecture Challenges
•  Code Reuse?
•  Handling interfaces?
•  Managing dependencies between
(>100) Services?
•  Global architecture?
•  Global refactorings?
Eberhard Wolff - @ewolff
Install and
configure App
Server for each
Microservice??
Simple Java
Application?
What about
Operations?
Spring Boot
Demo
Why Spring Boot?
•  Easier deployment
•  i.e. just a JAR
•  Built in operations support
Eberhard Wolff - @ewolff
Other Technologies
•  Dropwizard by Yammer
•  vert.x
•  Play Framework
Eberhard Wolff - @ewolff
Micro Services
as a
Component
System
Components Collaborate
Link
Micro
Service
REST
Micro
Service
Messaging
Data Replication
Eberhard Wolff - @ewolff
Micro Service
can easily
integrate
with Legacy
Deploy &
Operate?
Component Model
• 
• 
• 
• 
No restriction on language etc
Individual processes
+ infrastructure (database etc)
JARs, WARs, EARs: No good fit
•  Virtual machines as components?
•  Overhead??
Eberhard Wolff - @ewolff
Docker
•  No true virtualization
•  Linux Containers (lxc)
•  i.e. shared kernel
•  i.e. separate file systems
Eberhard Wolff - @ewolff
Docker File Systems
•  Read only base images
•  +read/write image
•  Can be stacked
Read / Write
Application
Java
Ubuntu
Eberhard Wolff - @ewolff
Docker
•  Linux only
•  So: Run it in VM
•  Controlled by Vagrant
Eberhard Wolff - @ewolff
Docker Demo
Vagrant VM
Docker Container
Redis
6379
6379
Port
6379
Eberhard Wolff - @ewolff
Communication Between
Docker Container
•  Via ports
•  Via data volumes
Eberhard Wolff - @ewolff
Docker is a
Component
System
Example
• 
• 
• 
• 
• 
• 
• 
Log file analysis
ELK Stack
Elasticsearch: Store
Logstash: Parse
Kibana: Web based GUI
Install three servers
Automate installation ... !
Eberhard Wolff - @ewolff
Dockerized ELK Stack
• 
• 
• 
• 
1 Vagrantfile (25 lines)
6 Dockerfiles (total 28 lines)
1 HTML file (11 lines)
1 Config (Logstash) (29 lines)
•  Total: 93 lines, 9 files
•  Including one RegExp !
Eberhard Wolff - @ewolff
Vagrant VM
Container
user-registration
8080
8081
Port
8081
Container
logstash
9200
Volume
/log
link
Container
elasticsearch
Container
kibana
9200
8080
9200
8080
Port
9200
Port
8080
Browser
Eberhard Wolff - @ewolff
Demo ELK
Stack
Links
•  https://github.com/ewolff/userregistration
•  http://www.heise.de/developer/
artikel/Episode-44-ModularisierteArchitektur-fuer-grosseSysteme-2195818.html
•  http://projects.spring.io/spring-boot/
•  http://www.docker.com/
•  http://www.docker.com/tryit
Eberhard Wolff - @ewolff
Eberhard Wolff - @ewolff
Micro Services
•  A new hope against Java Monoliths
•  Also great for legacy
•  Spring Boot for implementation
•  Docker as component model &
runtime
Eberhard Wolff - @ewolff
Thank You!!
[email protected]
@ewolff
Eberhard Wolff - @ewolff