What are, or aren't, microservices?
There's a lot of hype and buzz, but microservices emerged organically vs how some of the other distributed architectural styles were "handed down to us", so I believe there's some good things once you cut through the hype. In this talk I discussed what are and are NOT microservices, introduced some concepts, and discussed some concrete open-source libraries and frameworks that can help you develop and manage microservice style deployments.
14. A term that helps describe distributed systems
that organically evolve into scalable, loosely
coupled, modular sets of services that work
together to deliver business value
with acceptable tradeoffs.
So what are microservices?
15. • If my services are isolated at the
process level, I’m doing
#microservices
• If I use REST/Thrift/ProtoBuf
instead of SOAP, I’m doing
#microservices
• If I use JSON, I’m doing
#microservices
• If I use no-container / SpringBoot
/ Dropwizard / embedded Jetty,
I’m doing #microservices
I’m doing microservices if…
16. • Agile methodology
• SOA principles
• Domain Driven Design
• Hexagonal Architectures
• Pipes and Filters
• Actor Model
• REST
• SEDA
Microservices emerged as a result…
19. • No silver bullet; distributed systems are
*hard*
• Dependency hell, custom shared libraries
• Fragmented and inconsistent management
• Team communication challenges
• Health checking, monitoring, liveness
• Over architecting, performance concerns,
things spiraling out of control fast
Challenges ahead…
22. 2
Apache Camel
Apache Camel is an open-source,
light-weight, integration library.
Use Camel to integrate disparate systems
that speak different protocols and data
formats
24. Features
● Enterprise Integration Patterns (EIPs)
● Domain Specific Language to write “flows” or “routes”
● Large collection of adapters/components for legacy
systems, B2B, and SaaS
● Strong Unit test/Integration test framework
● Expression languages
● Data Formats
● Tooling with JBoss Developer Studio
25. Java DSL
public class OrderProcessorRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
from(“activemq:orders”)
.choice()
.when(header(“customer-rating”).isEqualTo(“gold”))
.to(“ibmmq:topic:specialCustomer”)
.otherwise()
.to(“ftp://user@host/orders/regularCustomers”)
.end()
.log(“received new order ${body.orderId}”)
.to(“ibatis:storeOrder?statementType=Insert”);
}
}
26. Spring XML DSL
<route id=“processOrders”>
<from uri=“activemq:orders”/>
<choice>
<when>
<simple>${header.customer-rating} == ‘gold’</simple>
<to uri=“wmq:topic:specialCustomer”>
</when>
<otherwise>
<to uri=“ftp://user@host/orders/regularCustomers” />
</otherwise>
</choice>
<log message=“received new order ${body.orderId}”/>
<to uri=“ibatis:storeOrder?statementType=Insert”/>
</route>
29. • “Smart endpoints, dumb pipes”
• Endpoint does one thing well
• Metadata used for further routing
• Really “dynamic” with rules engine (eg,
Drools/BRMS)
Dynamic Routing
30. • Content Based Router
• Dynamic Router
• Routing Slip
• Recipient List
Dynamic Routing
31. • Expressive way to define REST endpoints
• POST, REST, PUT
• Auto binding to POJOs
• Plugs into Swagger for interface
definition/documentation
• Uses configurable HTTP engine
• camel-netty-http
• camel-jetty
• camel-reslet
• camel-sevlet (deploy into other containers)
• camel-spark-rest
REST DSL (2.14)
32. REST DSL
public class OrderProcessorRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
rest().post(“/order/socks”)
.description(“New Order for pair of socks”)
.consumes(“application/json”)
.route()
.to(“activemq:topic:newOrder”)
.log(“received new order ${body.orderId}”)
.to(“ibatis:storeOrder?statementType=Insert”);
}
}
33. • Backpressure is a way for a service to flow
control callers
• Detecting when can be difficult
• Need to bound processing queues in a
SEDA
• Take advantage of built in TCP flow control
for socket/http requests
Backpressure with Camel
34. • Throttle EIP
• http://camel.apache.org/throttler.html
• Blocking SEDA Queue
• from(“seda:name?size=100&blockWhenFull=true)
• Configure jetty/netty to use blocking acceptor
queues
• https://wiki.eclipse.org/Jetty/Howto/High_Load
• Using Exception handling/retry and DLQ
logic when getting flow controlled
• http://camel.apache.org/error-handling-in-camel.html
Backpressure with Camel
35. • Useful to keep from overloading a system
(use in conjunction with backpressure if you
can)
• Smart loadbalancing
• Sticky
• Random
• Failover
• Circuit breaker
Loadbalance/Circuit breaker
41. RED HAT JBOSS FUSE
Development and tooling
Develop, test, debug, refine,
deploy
JBoss Developer Studio
Web services framework
Web services standards, SOAP,
XML/HTTP, RESTful HTTP
Integration framework
Transformation, mediation, enterprise
integration patterns
Management and
monitoring
System and web services metrics,
automated discovery, container
status, automatic updates
JBoss Operations Network
+
JBoss Fabric Management
Console
(hawtio)
Apache CXF Apache Camel
Reliable Messaging
JMS/STOMP/NMS/MQTT, publishing-subscribe/point-2-point, store and forward
Apache ActiveMQ
Container
Life cycle management, resource management, dynamic deployment,
security and provisioning
Apache Karaf + Fuse Fabric
RED HAT ENTERPRISE LINUX
Windows, UNIX, and other Linux
45. • Simplifies deployments
• Provides centralized configuration
• Versioning
• Visualization of your middleware
• Service discovery
• Smart load balancing
• Failover
• Provides cluster capabilities, coordination
http://fabric8.io
46. • Implemented with Zookeeper and git
• Intended to be used with a dynamic
JVM/Apache Karaf
• Profiles store configuration, metadata, end-
state deployments
• Networking, JVM isolation, orchestration,
auto-scaling, health checks, cloud
deployments: all up to you
Fabric8 V1.x
47. • Registry
• Where configs are stored, everything centrally
managed
• Profiles
• Description of end-state deployment of a server
• Agent
• Listens on the server that can respond to registry
changes/profile updates
Fabric8 V1.x
49. • Implemented with Docker and Kubernetes
• Use any JVM (or any technology)
• Docker images, encourage static, well-
defined, well-tested deployments
• Provides networking, JVM isolation,
orchestration, auto-scaling, health checks,
cloud deployments
• Still in community! Proving this out!
Fabric8 V2