SlideShare ist ein Scribd-Unternehmen logo
1 von 46
Downloaden Sie, um offline zu lesen
Johan Edstrom
SOA Executive and Apache developer.
Apache Member
Apache Camel PMC
Apache ServiceMix committer
Original CXF Blueprint Author
Cassandra client library developer
Author
jedstrom@savoirtech.com
joed@apache.org
Using common frameworks
Asynchronous applications
Savoir Technologies - This is where we started
Where are we now?
lWe have worked heavily with
• Governments
• Insurance
• Utilities
• Network companies
• Education companies
• Medical processing companies
What is this all about?
lScaling
• It is hard
• How it is done - depends
• Is this a blueprint?
lTips n’ Tricks
• Things we’ve learned over time
lExperience
• Do’s and Don't
Before we start
lWhat are we looking to change
JVM
DB
Actor
Business Logic
We will look a little at these tools and libraries
lApache Camel
lApache Karaf, Savoirtech Aetos, ServiceMix
lApache ActiveMQ
lApache Cassandra / Savoirtech Hecate
lApache CXF
lAnd somewhat on AKKA
• We really are just peeking at AKKA to validate some ideas
Apache Camel
lApache Camel is an open source Java framework with
• Concrete implementations of all the widely used EIP patterns
• Connectivity to a great variety of transports and API
• Easy to use Domain Specific Languages (DSL)
Apache Camel
lCamel is a Domain Specific Language (DSL) focused on
implementing Enterprise Integration Patterns (EIPs)
• Examples: multicast, splitter, content-based router, routing slip, “dynamic
routers”, aggregator
lEIPs are implemented by Camel “Processors”
• Users can develop their own processors
• A processor is a fundamental building block
• Bean language and bindings exists so that not a single piece of Apache
Camel Imports will be necessary when integrating your existing code
lCamel can connect to a wide variety of integration
technologies
• Examples: JMS, HTTP, FTP, SOAP, File - There are ~ 180 components
Apache Camel
Do I need all of that?
lNope, many solutions will need just a few things
• jaxb, camel, jms, soap, rest and perhaps jdbc
• Cut the container down to fit your needs
• We don’t need to load all of the 100+ Apache Camel components
• Pick and choose!
lShould I run that messaging solution inside the “ESB”
• Entirely up to you, let us look a little deeper at that in a sec.
lCan I test these solutions or am I stuck with
System.out.println and a remote debugger?
Apache Karaf
lMini OSGi Container
• Foundation of Apache ServiceMix, Aetos, Talend ESB, Cisco Prime, ODL
platforms and quite a few other offerings
• For scaling you certainly don’t need Karaf - all of the concepts are
theoretically possible in pretty much any language and platform if you do it
correctly.
§ That said, Karaf enforces modular code (OSGi), controlled deployment
and offers up many nice things like a remote console for “free”.
JMS JAX-WS JAX-RS Camel Spring Aries
OSGi
Console Logging Provision Admin Spring-DM Aries
Decoupling with OSGi
lEnforces knowledge of imports and exports
lAllows us to version
lProgramming model with micro-services allows 

for re-use on an Api level vs code level
lPromotes contracts
Apache ActiveMQ
lFast, powerful and flexible messaging system
lEasily embeddable
lCan create complex topologies
lTons of connection possibilities
lCan be scaled up / down / right / left
• Note - Currently merging with HornetMQ
Apache Cassandra
lEntered Apache as Incubator Project in 2009
• Went through incubation to build community of committers
lBecame Top Level Apache Project in February 2010
lHas proven to be a very flexible and widely used distributed
big data solution.
lCQL3 changes data-modeling “slightly”
lCassandra was named after the Greek goddess
• Cassandra could accurately predict things that would come
• She spurred the Oracle of Delphi (thus a possible pun)
What are some language tools we can use?
lFutures, Promises, Continuations (Async JaxRs, RIFE),
JMS, Executors, Actors, Consumers, Producers, Runnables

• Let’s not go too deep here; frameworks in Java land

are there to help you not have to write super duper

low level code, like Mina / Netty for networking.

Guava for concurrency and collection handling. 

CXF for JaxWs / JaxRs abstraction to just name a

few.

Traditional “full stack” application
lSynchronous in design
• Browser -> Servlet container is response time sensitive and expensive
• Servlet code -> Service code can be time consuming
• Service code -> Connection factories can easily block 

• Probably uses a Java / JSP framework, some JS
§ Developers tend to be forced to know Java, JS, a bit of RDBMS, fiddle with
servlet containers, rely quite a bit on QA for testing and shows weird and
spurious errors during load testing

JVM
DB
Actor
Business Logic
Persistence - Are you a noSQL candidate?
• Do you need to do complex queries on your data
• Many JOINs and foreign keys with many relationships
• Can be done in Cassandra with Hadoop or other MapReduce (Spark)
• Need to weigh the development effort vs. just writing a SQL query
• Do you need very strict ACID transactionality
• Banking/Financial transactions could be difficult
• ACID/Transactions can be built in Cassandra with complex application
code using tools such as ZooKeeper (Distributed locks exist)
• Need to weigh the development effort vs. using a RDBMS which
supports transactionality out-of-the-box
• Do you have very complex indexing requirements
• Are you indexing multiple fields and having to create many Column
Families to access your data many different ways?
Let us say we are.
lThe work here would be in data modeling
• The benefits we’d reap are eventual/controllable consistency
• Extremely fast and Asynchronous writes
• Automatic Data distribution and partitioning
• No single point of failure
• You have to unlearn some things
*Images courtesy of DataStax
What does that look like in Java?
lTo create our keyspace.
lTo use it with CQL3 - DataStax driver

lUsing it with Hecate - Hecate maps POJO’s to prepared and
async statements.
Compared to a traditional RDBMS?
lIn one project we mapped in 17 registry services
• ~20 million users in the system more than 40 mil transactions / day
§ Handled all load-test scenarios on a 5 node Cassandra ring.
• We are talking about average response times < 100ms

end to end.
• We also don’t need to worry much about
§ Second and 1st level caches
§ Cache synchronization or distribution
§ Locking
§ Select for update
§ Autoscaling
§ Building out
§ Building out geographically
JVM
Actor
Business Logic
To sum up Cassandra
lIf you are looking at doing this
lselect a,b,c from table_X where y > 15 allow filtering;
• You need to rethink your data model, you are looking at something that with
sufficient amounts of data can take down pretty much any cluster if y is not
part of a partition key, index (Indexes are bad for other reasons as well).
• Solve these types of problems by writing your data the way you want to
retrieve it.
Front facing stuff
JVM
Actor
Business Logic
Apache CXF
lLibrary that is passing the TCK for the Web Profile
lBuilds on the base JaxWS / JaxRs in the JDK
lAlso does esoteric stuff like Corba / RMI
lCan be used to do JMS
lYou can build pub sub systems (WSN Notification)
Now lets look at the browser facing part
lJAXRS 2.0 Provides for Async
Sync
Async
And the execution of the response
lUsing an executor service, with timeouts
lSame thing but without lambdas
Lets put some load on this
lWe use Gatling (You could use JMeter or any other tool)
l500 user load
l500.000 Requests
lWe measure the total time, time / request, mean avg.
With a delay of 200-500ms - Async
Async ResponseTimes
With a delay of 10-100ms - Sync
Sync responsetimes
Observations
lWith a fast response that is linear
• Async creates overhead, response times are worse
• With just a minimal blocking introduced, sync starts choking pretty fast
• It is hard to simulate on one machine
lWhere this these techniques are utilized
§ A Large EC2 system is currently hitting around 163 r/s going against
Cassandra with prepared (sync) statements and utilizing Async JaxRs
§ It is slated to be a replacement for a sync system that uses JSP and
Cassandra (or Mongo), it does about the same load over 3 physical
machines, 16GB JVM’s and yes…. 



There were better developers involved on the second system
Onto the last part!
lLet’s make that business thing Async too!
lWe’ll make it an almost “BPEL’ey” process.
lWS Call from our main

web service, response

coming via a queue
lNow we could solve this

over JMS request/reply

but we want to cluster too.
JVM
Actor
Business Logic
What is it we want to solve?
lWe want some storage
lWe treat that as completely transient
lWe want to share data between nodes
lWe don’t want to re-invent the wheel
HazelCast
We really need a MemoryGrid!!!!
lWe can use HazelCast as it has neat side effects
Init()
loadConfig()
A HazelCast Config
lYou can setup Hazelcast
• To be unicast
• Multicast
• EC2 aware
• Implement persistence if you want
• Use existing adaptors for things like Hibernate
Why the HazelCast use?
Could we do this differently
lJMS Request reply
• But then you need to watch for
• Connectivity, queue speed, timeout
• If you don’t use Camel it is
§ Significantly more complex code
§ More error prone
lAnd it is down the road interesting with a Grid
lThis grid could be used for “slip” patterns, park
transactional stuff, be a lock / mutex
And the callback
lWe rely on HazelCast to inform us
And once we correlate
lWe can now resume our Webservice out of band!
What happened there?
lThe entry listener is the nice part
All done.
JVM
Actor
Business Logic
Business Logic
Business Logic
MEMORY GRID
QUEUEING
Summary
lWe had a monolithic app
lAnd we ended up with
• Replaced persistence with a more non blocking solution
• Replaced all of the synchronous web side
• Introduced queueing
• Introduced a memory grid
• We added asynchronous behavior to something BPEL’ey so that we can run
the process across multiple callers or multiple systems in parallel
Thank you!

Weitere ähnliche Inhalte

Was ist angesagt?

Enterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache CamelEnterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache CamelIoan Eugen Stan
 
Integration made easy with Apache Camel
Integration made easy with Apache CamelIntegration made easy with Apache Camel
Integration made easy with Apache CamelRosen Spasov
 
Akka-chan's Survival Guide for the Streaming World
Akka-chan's Survival Guide for the Streaming WorldAkka-chan's Survival Guide for the Streaming World
Akka-chan's Survival Guide for the Streaming WorldKonrad Malawski
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache CamelFuseSource.com
 
High Availability Perl DBI + MySQL
High Availability Perl DBI + MySQLHigh Availability Perl DBI + MySQL
High Availability Perl DBI + MySQLSteve Purkis
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache CamelClaus Ibsen
 
Using Apache Camel connectors for external connectivity
Using Apache Camel connectors for external connectivityUsing Apache Camel connectors for external connectivity
Using Apache Camel connectors for external connectivityClaus Ibsen
 
Getting Started with Apache Camel - Devconf Conference - February 2013
Getting Started with Apache Camel - Devconf Conference - February 2013Getting Started with Apache Camel - Devconf Conference - February 2013
Getting Started with Apache Camel - Devconf Conference - February 2013Claus Ibsen
 
Apache Camel - The integration library
Apache Camel - The integration libraryApache Camel - The integration library
Apache Camel - The integration libraryClaus Ibsen
 
Integration using Apache Camel and Groovy
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and GroovyClaus Ibsen
 
ApacheCon EU 2016 - Apache Camel the integration library
ApacheCon EU 2016 - Apache Camel the integration libraryApacheCon EU 2016 - Apache Camel the integration library
ApacheCon EU 2016 - Apache Camel the integration libraryClaus Ibsen
 
Integrating systems in the age of Quarkus and Camel
Integrating systems in the age of Quarkus and CamelIntegrating systems in the age of Quarkus and Camel
Integrating systems in the age of Quarkus and CamelClaus Ibsen
 
Getting Started with Apache Camel at DevNation 2014
Getting Started with Apache Camel at DevNation 2014Getting Started with Apache Camel at DevNation 2014
Getting Started with Apache Camel at DevNation 2014Claus Ibsen
 
State of Akka 2017 - The best is yet to come
State of Akka 2017 - The best is yet to comeState of Akka 2017 - The best is yet to come
State of Akka 2017 - The best is yet to comeKonrad Malawski
 
A tour of Java and the JVM
A tour of Java and the JVMA tour of Java and the JVM
A tour of Java and the JVMAlex Birch
 
Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Networks and Types - the Future of Akka @ ScalaDays NYC 2018Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Networks and Types - the Future of Akka @ ScalaDays NYC 2018Konrad Malawski
 
Peeling back the Lambda layers
Peeling back the Lambda layersPeeling back the Lambda layers
Peeling back the Lambda layersPatrick McCaffrey
 
Developing, Testing and Scaling with Apache Camel - UberConf 2015
Developing, Testing and Scaling with Apache Camel - UberConf 2015Developing, Testing and Scaling with Apache Camel - UberConf 2015
Developing, Testing and Scaling with Apache Camel - UberConf 2015Matt Raible
 
Building a Reactive System with Akka - Workshop @ O'Reilly SAConf NYC
Building a Reactive System with Akka - Workshop @ O'Reilly SAConf NYCBuilding a Reactive System with Akka - Workshop @ O'Reilly SAConf NYC
Building a Reactive System with Akka - Workshop @ O'Reilly SAConf NYCKonrad Malawski
 
Getting started with Apache Camel - May 2013
Getting started with Apache Camel - May 2013Getting started with Apache Camel - May 2013
Getting started with Apache Camel - May 2013Claus Ibsen
 

Was ist angesagt? (20)

Enterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache CamelEnterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache Camel
 
Integration made easy with Apache Camel
Integration made easy with Apache CamelIntegration made easy with Apache Camel
Integration made easy with Apache Camel
 
Akka-chan's Survival Guide for the Streaming World
Akka-chan's Survival Guide for the Streaming WorldAkka-chan's Survival Guide for the Streaming World
Akka-chan's Survival Guide for the Streaming World
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache Camel
 
High Availability Perl DBI + MySQL
High Availability Perl DBI + MySQLHigh Availability Perl DBI + MySQL
High Availability Perl DBI + MySQL
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache Camel
 
Using Apache Camel connectors for external connectivity
Using Apache Camel connectors for external connectivityUsing Apache Camel connectors for external connectivity
Using Apache Camel connectors for external connectivity
 
Getting Started with Apache Camel - Devconf Conference - February 2013
Getting Started with Apache Camel - Devconf Conference - February 2013Getting Started with Apache Camel - Devconf Conference - February 2013
Getting Started with Apache Camel - Devconf Conference - February 2013
 
Apache Camel - The integration library
Apache Camel - The integration libraryApache Camel - The integration library
Apache Camel - The integration library
 
Integration using Apache Camel and Groovy
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and Groovy
 
ApacheCon EU 2016 - Apache Camel the integration library
ApacheCon EU 2016 - Apache Camel the integration libraryApacheCon EU 2016 - Apache Camel the integration library
ApacheCon EU 2016 - Apache Camel the integration library
 
Integrating systems in the age of Quarkus and Camel
Integrating systems in the age of Quarkus and CamelIntegrating systems in the age of Quarkus and Camel
Integrating systems in the age of Quarkus and Camel
 
Getting Started with Apache Camel at DevNation 2014
Getting Started with Apache Camel at DevNation 2014Getting Started with Apache Camel at DevNation 2014
Getting Started with Apache Camel at DevNation 2014
 
State of Akka 2017 - The best is yet to come
State of Akka 2017 - The best is yet to comeState of Akka 2017 - The best is yet to come
State of Akka 2017 - The best is yet to come
 
A tour of Java and the JVM
A tour of Java and the JVMA tour of Java and the JVM
A tour of Java and the JVM
 
Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Networks and Types - the Future of Akka @ ScalaDays NYC 2018Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Networks and Types - the Future of Akka @ ScalaDays NYC 2018
 
Peeling back the Lambda layers
Peeling back the Lambda layersPeeling back the Lambda layers
Peeling back the Lambda layers
 
Developing, Testing and Scaling with Apache Camel - UberConf 2015
Developing, Testing and Scaling with Apache Camel - UberConf 2015Developing, Testing and Scaling with Apache Camel - UberConf 2015
Developing, Testing and Scaling with Apache Camel - UberConf 2015
 
Building a Reactive System with Akka - Workshop @ O'Reilly SAConf NYC
Building a Reactive System with Akka - Workshop @ O'Reilly SAConf NYCBuilding a Reactive System with Akka - Workshop @ O'Reilly SAConf NYC
Building a Reactive System with Akka - Workshop @ O'Reilly SAConf NYC
 
Getting started with Apache Camel - May 2013
Getting started with Apache Camel - May 2013Getting started with Apache Camel - May 2013
Getting started with Apache Camel - May 2013
 

Ähnlich wie Building Asynchronous Applications

Succeding with the Apache SOA stack
Succeding with the Apache SOA stackSucceding with the Apache SOA stack
Succeding with the Apache SOA stackJohan Edstrom
 
ENT309 scaling up to your first 10 million users
ENT309 scaling up to your first 10 million usersENT309 scaling up to your first 10 million users
ENT309 scaling up to your first 10 million usersAmazon Web Services
 
ENT309 Scaling Up to Your First 10 Million Users
ENT309 Scaling Up to Your First 10 Million UsersENT309 Scaling Up to Your First 10 Million Users
ENT309 Scaling Up to Your First 10 Million UsersAmazon Web Services
 
ENT309 Scaling Up to Your First 10 Million Users
ENT309 Scaling Up to Your First 10 Million UsersENT309 Scaling Up to Your First 10 Million Users
ENT309 Scaling Up to Your First 10 Million UsersAmazon Web Services
 
ENT309 Scaling Up to Your First 10 Million Users
ENT309 Scaling Up to Your First 10 Million UsersENT309 Scaling Up to Your First 10 Million Users
ENT309 Scaling Up to Your First 10 Million UsersAmazon Web Services
 
Eventual Consistency @WalmartLabs with Kafka, Avro, SolrCloud and Hadoop
Eventual Consistency @WalmartLabs with Kafka, Avro, SolrCloud and HadoopEventual Consistency @WalmartLabs with Kafka, Avro, SolrCloud and Hadoop
Eventual Consistency @WalmartLabs with Kafka, Avro, SolrCloud and HadoopAyon Sinha
 
The Why and How of Scala at Twitter
The Why and How of Scala at TwitterThe Why and How of Scala at Twitter
The Why and How of Scala at TwitterAlex Payne
 
AWS Summit London 2014 | Scaling on AWS for the First 10 Million Users (200)
AWS Summit London 2014 | Scaling on AWS for the First 10 Million Users (200)AWS Summit London 2014 | Scaling on AWS for the First 10 Million Users (200)
AWS Summit London 2014 | Scaling on AWS for the First 10 Million Users (200)Amazon Web Services
 
Overview of PaaS: Java experience
Overview of PaaS: Java experienceOverview of PaaS: Java experience
Overview of PaaS: Java experienceIgor Anishchenko
 
Overview of PaaS: Java experience
Overview of PaaS: Java experienceOverview of PaaS: Java experience
Overview of PaaS: Java experienceAlex Tumanoff
 
What is Mean Stack Development ?
What is Mean Stack Development ?What is Mean Stack Development ?
What is Mean Stack Development ?Balajihope
 
20160524 ibm fast data meetup
20160524 ibm fast data meetup20160524 ibm fast data meetup
20160524 ibm fast data meetupshinolajla
 
Advanced Container Management and Scheduling
Advanced Container Management and SchedulingAdvanced Container Management and Scheduling
Advanced Container Management and SchedulingAmazon Web Services
 
OpenStack: Toward a More Resilient Cloud
OpenStack: Toward a More Resilient CloudOpenStack: Toward a More Resilient Cloud
OpenStack: Toward a More Resilient CloudMark Voelker
 
Scaling with Symfony - PHP UK
Scaling with Symfony - PHP UKScaling with Symfony - PHP UK
Scaling with Symfony - PHP UKRicard Clau
 
Scalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYC
Scalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYCScalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYC
Scalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYCCal Henderson
 
Migrating enterprise workloads to AWS
Migrating enterprise workloads to AWSMigrating enterprise workloads to AWS
Migrating enterprise workloads to AWSTom Laszewski
 
Big data pipeline with scala by Rohit Rai, Tuplejump - presented at Pune Scal...
Big data pipeline with scala by Rohit Rai, Tuplejump - presented at Pune Scal...Big data pipeline with scala by Rohit Rai, Tuplejump - presented at Pune Scal...
Big data pipeline with scala by Rohit Rai, Tuplejump - presented at Pune Scal...Thoughtworks
 

Ähnlich wie Building Asynchronous Applications (20)

Succeding with the Apache SOA stack
Succeding with the Apache SOA stackSucceding with the Apache SOA stack
Succeding with the Apache SOA stack
 
ENT309 scaling up to your first 10 million users
ENT309 scaling up to your first 10 million usersENT309 scaling up to your first 10 million users
ENT309 scaling up to your first 10 million users
 
ENT309 Scaling Up to Your First 10 Million Users
ENT309 Scaling Up to Your First 10 Million UsersENT309 Scaling Up to Your First 10 Million Users
ENT309 Scaling Up to Your First 10 Million Users
 
ENT309 Scaling Up to Your First 10 Million Users
ENT309 Scaling Up to Your First 10 Million UsersENT309 Scaling Up to Your First 10 Million Users
ENT309 Scaling Up to Your First 10 Million Users
 
ENT309 Scaling Up to Your First 10 Million Users
ENT309 Scaling Up to Your First 10 Million UsersENT309 Scaling Up to Your First 10 Million Users
ENT309 Scaling Up to Your First 10 Million Users
 
Eventual Consistency @WalmartLabs with Kafka, Avro, SolrCloud and Hadoop
Eventual Consistency @WalmartLabs with Kafka, Avro, SolrCloud and HadoopEventual Consistency @WalmartLabs with Kafka, Avro, SolrCloud and Hadoop
Eventual Consistency @WalmartLabs with Kafka, Avro, SolrCloud and Hadoop
 
The Why and How of Scala at Twitter
The Why and How of Scala at TwitterThe Why and How of Scala at Twitter
The Why and How of Scala at Twitter
 
Apache Drill (ver. 0.2)
Apache Drill (ver. 0.2)Apache Drill (ver. 0.2)
Apache Drill (ver. 0.2)
 
AWS Summit London 2014 | Scaling on AWS for the First 10 Million Users (200)
AWS Summit London 2014 | Scaling on AWS for the First 10 Million Users (200)AWS Summit London 2014 | Scaling on AWS for the First 10 Million Users (200)
AWS Summit London 2014 | Scaling on AWS for the First 10 Million Users (200)
 
Overview of PaaS: Java experience
Overview of PaaS: Java experienceOverview of PaaS: Java experience
Overview of PaaS: Java experience
 
Overview of PaaS: Java experience
Overview of PaaS: Java experienceOverview of PaaS: Java experience
Overview of PaaS: Java experience
 
What is Mean Stack Development ?
What is Mean Stack Development ?What is Mean Stack Development ?
What is Mean Stack Development ?
 
Intro to Sails.js
Intro to Sails.jsIntro to Sails.js
Intro to Sails.js
 
20160524 ibm fast data meetup
20160524 ibm fast data meetup20160524 ibm fast data meetup
20160524 ibm fast data meetup
 
Advanced Container Management and Scheduling
Advanced Container Management and SchedulingAdvanced Container Management and Scheduling
Advanced Container Management and Scheduling
 
OpenStack: Toward a More Resilient Cloud
OpenStack: Toward a More Resilient CloudOpenStack: Toward a More Resilient Cloud
OpenStack: Toward a More Resilient Cloud
 
Scaling with Symfony - PHP UK
Scaling with Symfony - PHP UKScaling with Symfony - PHP UK
Scaling with Symfony - PHP UK
 
Scalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYC
Scalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYCScalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYC
Scalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYC
 
Migrating enterprise workloads to AWS
Migrating enterprise workloads to AWSMigrating enterprise workloads to AWS
Migrating enterprise workloads to AWS
 
Big data pipeline with scala by Rohit Rai, Tuplejump - presented at Pune Scal...
Big data pipeline with scala by Rohit Rai, Tuplejump - presented at Pune Scal...Big data pipeline with scala by Rohit Rai, Tuplejump - presented at Pune Scal...
Big data pipeline with scala by Rohit Rai, Tuplejump - presented at Pune Scal...
 

Kürzlich hochgeladen

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Kürzlich hochgeladen (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Building Asynchronous Applications

  • 1. Johan Edstrom SOA Executive and Apache developer. Apache Member Apache Camel PMC Apache ServiceMix committer Original CXF Blueprint Author Cassandra client library developer Author jedstrom@savoirtech.com joed@apache.org Using common frameworks Asynchronous applications
  • 2. Savoir Technologies - This is where we started
  • 3. Where are we now? lWe have worked heavily with • Governments • Insurance • Utilities • Network companies • Education companies • Medical processing companies
  • 4. What is this all about? lScaling • It is hard • How it is done - depends • Is this a blueprint? lTips n’ Tricks • Things we’ve learned over time lExperience • Do’s and Don't
  • 5. Before we start lWhat are we looking to change JVM DB Actor Business Logic
  • 6. We will look a little at these tools and libraries lApache Camel lApache Karaf, Savoirtech Aetos, ServiceMix lApache ActiveMQ lApache Cassandra / Savoirtech Hecate lApache CXF lAnd somewhat on AKKA • We really are just peeking at AKKA to validate some ideas
  • 7. Apache Camel lApache Camel is an open source Java framework with • Concrete implementations of all the widely used EIP patterns • Connectivity to a great variety of transports and API • Easy to use Domain Specific Languages (DSL)
  • 8. Apache Camel lCamel is a Domain Specific Language (DSL) focused on implementing Enterprise Integration Patterns (EIPs) • Examples: multicast, splitter, content-based router, routing slip, “dynamic routers”, aggregator lEIPs are implemented by Camel “Processors” • Users can develop their own processors • A processor is a fundamental building block • Bean language and bindings exists so that not a single piece of Apache Camel Imports will be necessary when integrating your existing code lCamel can connect to a wide variety of integration technologies • Examples: JMS, HTTP, FTP, SOAP, File - There are ~ 180 components
  • 10. Do I need all of that? lNope, many solutions will need just a few things • jaxb, camel, jms, soap, rest and perhaps jdbc • Cut the container down to fit your needs • We don’t need to load all of the 100+ Apache Camel components • Pick and choose! lShould I run that messaging solution inside the “ESB” • Entirely up to you, let us look a little deeper at that in a sec. lCan I test these solutions or am I stuck with System.out.println and a remote debugger?
  • 11. Apache Karaf lMini OSGi Container • Foundation of Apache ServiceMix, Aetos, Talend ESB, Cisco Prime, ODL platforms and quite a few other offerings • For scaling you certainly don’t need Karaf - all of the concepts are theoretically possible in pretty much any language and platform if you do it correctly. § That said, Karaf enforces modular code (OSGi), controlled deployment and offers up many nice things like a remote console for “free”. JMS JAX-WS JAX-RS Camel Spring Aries OSGi Console Logging Provision Admin Spring-DM Aries
  • 12. Decoupling with OSGi lEnforces knowledge of imports and exports lAllows us to version lProgramming model with micro-services allows 
 for re-use on an Api level vs code level lPromotes contracts
  • 13. Apache ActiveMQ lFast, powerful and flexible messaging system lEasily embeddable lCan create complex topologies lTons of connection possibilities lCan be scaled up / down / right / left • Note - Currently merging with HornetMQ
  • 14. Apache Cassandra lEntered Apache as Incubator Project in 2009 • Went through incubation to build community of committers lBecame Top Level Apache Project in February 2010 lHas proven to be a very flexible and widely used distributed big data solution. lCQL3 changes data-modeling “slightly” lCassandra was named after the Greek goddess • Cassandra could accurately predict things that would come • She spurred the Oracle of Delphi (thus a possible pun)
  • 15. What are some language tools we can use? lFutures, Promises, Continuations (Async JaxRs, RIFE), JMS, Executors, Actors, Consumers, Producers, Runnables
 • Let’s not go too deep here; frameworks in Java land
 are there to help you not have to write super duper
 low level code, like Mina / Netty for networking.
 Guava for concurrency and collection handling. 
 CXF for JaxWs / JaxRs abstraction to just name a
 few.

  • 16. Traditional “full stack” application lSynchronous in design • Browser -> Servlet container is response time sensitive and expensive • Servlet code -> Service code can be time consuming • Service code -> Connection factories can easily block 
 • Probably uses a Java / JSP framework, some JS § Developers tend to be forced to know Java, JS, a bit of RDBMS, fiddle with servlet containers, rely quite a bit on QA for testing and shows weird and spurious errors during load testing
 JVM DB Actor Business Logic
  • 17. Persistence - Are you a noSQL candidate? • Do you need to do complex queries on your data • Many JOINs and foreign keys with many relationships • Can be done in Cassandra with Hadoop or other MapReduce (Spark) • Need to weigh the development effort vs. just writing a SQL query • Do you need very strict ACID transactionality • Banking/Financial transactions could be difficult • ACID/Transactions can be built in Cassandra with complex application code using tools such as ZooKeeper (Distributed locks exist) • Need to weigh the development effort vs. using a RDBMS which supports transactionality out-of-the-box • Do you have very complex indexing requirements • Are you indexing multiple fields and having to create many Column Families to access your data many different ways?
  • 18. Let us say we are. lThe work here would be in data modeling • The benefits we’d reap are eventual/controllable consistency • Extremely fast and Asynchronous writes • Automatic Data distribution and partitioning • No single point of failure • You have to unlearn some things *Images courtesy of DataStax
  • 19. What does that look like in Java? lTo create our keyspace. lTo use it with CQL3 - DataStax driver
 lUsing it with Hecate - Hecate maps POJO’s to prepared and async statements.
  • 20. Compared to a traditional RDBMS? lIn one project we mapped in 17 registry services • ~20 million users in the system more than 40 mil transactions / day § Handled all load-test scenarios on a 5 node Cassandra ring. • We are talking about average response times < 100ms
 end to end. • We also don’t need to worry much about § Second and 1st level caches § Cache synchronization or distribution § Locking § Select for update § Autoscaling § Building out § Building out geographically JVM Actor Business Logic
  • 21. To sum up Cassandra lIf you are looking at doing this lselect a,b,c from table_X where y > 15 allow filtering; • You need to rethink your data model, you are looking at something that with sufficient amounts of data can take down pretty much any cluster if y is not part of a partition key, index (Indexes are bad for other reasons as well). • Solve these types of problems by writing your data the way you want to retrieve it.
  • 23. Apache CXF lLibrary that is passing the TCK for the Web Profile lBuilds on the base JaxWS / JaxRs in the JDK lAlso does esoteric stuff like Corba / RMI lCan be used to do JMS lYou can build pub sub systems (WSN Notification)
  • 24. Now lets look at the browser facing part lJAXRS 2.0 Provides for Async Sync Async
  • 25. And the execution of the response lUsing an executor service, with timeouts lSame thing but without lambdas
  • 26. Lets put some load on this lWe use Gatling (You could use JMeter or any other tool) l500 user load l500.000 Requests lWe measure the total time, time / request, mean avg.
  • 27. With a delay of 200-500ms - Async
  • 29. With a delay of 10-100ms - Sync
  • 31. Observations lWith a fast response that is linear • Async creates overhead, response times are worse • With just a minimal blocking introduced, sync starts choking pretty fast • It is hard to simulate on one machine lWhere this these techniques are utilized § A Large EC2 system is currently hitting around 163 r/s going against Cassandra with prepared (sync) statements and utilizing Async JaxRs § It is slated to be a replacement for a sync system that uses JSP and Cassandra (or Mongo), it does about the same load over 3 physical machines, 16GB JVM’s and yes…. 
 
 There were better developers involved on the second system
  • 32. Onto the last part! lLet’s make that business thing Async too! lWe’ll make it an almost “BPEL’ey” process. lWS Call from our main
 web service, response
 coming via a queue lNow we could solve this
 over JMS request/reply
 but we want to cluster too. JVM Actor Business Logic
  • 33. What is it we want to solve? lWe want some storage lWe treat that as completely transient lWe want to share data between nodes lWe don’t want to re-invent the wheel
  • 35. We really need a MemoryGrid!!!! lWe can use HazelCast as it has neat side effects
  • 38. A HazelCast Config lYou can setup Hazelcast • To be unicast • Multicast • EC2 aware • Implement persistence if you want • Use existing adaptors for things like Hibernate
  • 40. Could we do this differently lJMS Request reply • But then you need to watch for • Connectivity, queue speed, timeout • If you don’t use Camel it is § Significantly more complex code § More error prone lAnd it is down the road interesting with a Grid lThis grid could be used for “slip” patterns, park transactional stuff, be a lock / mutex
  • 41. And the callback lWe rely on HazelCast to inform us
  • 42. And once we correlate lWe can now resume our Webservice out of band!
  • 43. What happened there? lThe entry listener is the nice part
  • 44. All done. JVM Actor Business Logic Business Logic Business Logic MEMORY GRID QUEUEING
  • 45. Summary lWe had a monolithic app lAnd we ended up with • Replaced persistence with a more non blocking solution • Replaced all of the synchronous web side • Introduced queueing • Introduced a memory grid • We added asynchronous behavior to something BPEL’ey so that we can run the process across multiple callers or multiple systems in parallel