SlideShare une entreprise Scribd logo
1  sur  46
Télécharger pour lire hors ligne
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!

Contenu connexe

Tendances

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
 

Tendances (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
 

Similaire à 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
 

Similaire à 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...
 

Dernier

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
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
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Dernier (20)

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
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
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave 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