SlideShare una empresa de Scribd logo
1 de 34
Descargar para leer sin conexión
Performance Optimizations
    for Apache Camel
        Christian Müller
WARNING: Jetlagged!




        http://sav-cdn.com/sites/default/files/imagecache/superphoto/10718770.jpg
Agenda
    ●   Brief Introduction
    ●   Content based routing EIP (and XML)
    ●   Split EIP (and XML)
    ●   Marshaling / Unmarshaling
    ●   Working with files
    ●   Accessing databases
    ●   Working with threads()
    ●   Working with templates
    ●   Using Web Services
    ●   Messaging
    ●   Q&A
Brief introduction
●   11 years of experience in software
    development and architecture
    –   Focused on Java integration technologies
●   Senior Software Developer at Atos
    Worldline in Frankfurt, Germany
    –   Tech. responsible for our integration platform
        based on ServiceMix & Camel
●   Apache Camel committer and current PMC
    chair
    –   Partly involved in Apache Karaf, ServiceMix
Apache Camel 3.0
●   Be involved!
    –   irc://irc.codehaus.org/camel
    –   dev@camel.apache.org
    –   http://camel.465427.n5.nabble.com/Camel-
        Development-f479097.html
●   Share your ideas & wishes with us!
    –   http://camel.apache.org/camel-30-ideas.html
●   Be part of it!
    –   http://camel.apache.org/camel-30-roadmap.html
    –   http://camel.apache.org/contributing.html
Content based routing EIP
●   Demo
Content based routing EIP

                               Duration in ms to route 10.000 10 KByte messages


9000


8000


7000

                                                                                        XPath (JDK)
6000                                                                                    XPath (Saxon)
                                                                                        XQuery
5000                                                                                    VTDXML*
                                                                                        Simple
                                                                                        Header
4000


3000


2000


1000


   0
               8900     4500        3900          2600           600              500


       https://github.com/muellerc/apachecon-na-2013/tree/master/cbr-eip




                                                                                               * GPL
Conclusion
●   Prefer to use conditions based on your
    message header
●   Use String contains check, if it works for
    you (e.g. with Simple language)
●   Use VDTXML if possible (GPL license)
●   Use XQuery
●   If you (have to) use XPath, make sure you
    have Saxon in your class path.
Split EIP
●   Demo
Split EIP

              Duration in ms to split a 100 MByte message
                                                            Memory footprint in MByte to split a 100 MByte file


9000


8000


7000


6000                                                                                                              XPath (JDK)
                                                                                                                  XPath (Saxon)
5000                                                                                                              VTDXML*
                                                                                                                  XML Tokenizer

4000


3000


2000


1000


   0
             0       8800      5100      7400               1126       480        200         8


       https://github.com/muellerc/apachecon-na-2013/tree/master/split-eip




                                                                                                                         * GPL
Conclusion
●   Use VDTXML if possible (GPL license)
●   Prefer to use the XML Tokenizer (NS
    limitation)
●   If you (have to) use XPath, make sure you
    have Saxon in your class path.
     – Otherwise there is a good chance it will
       fail
Marshaling / Unmarshaling
●   Demo
Marshaling / Unmarshaling

                          Duration in ms to marshal and unmarshal 10.000 messages


5000

4500

4000

                                                                                              XStream (XML)
3500                                                                                          XMLBeans (XML)
                                                                                              JAXB (XML)
3000                                                                                          JIBX* (XML)
                                                                                              XStream (Json)
2500                                                                                          Gson (Json)
                                                                                              Jackson (Json)
2000                                                                                          Java Serialization


1500

1000

500

   0
            3100   2300    2200       1800       5000       1200       800          1100


       https://github.com/muellerc/apachecon-na-2013/tree/master/marshaling-unmarshaling




                                                                    * doesn't work with Java 7 in every case
Conclusion
●   Use JIBX for XML if possible (not Java 7
    ready at present)
●   Use JAXB for XML
●   Use Jackson for Json
●   Don't use Java serialization (not
    interoperable, not easy to read)
Working with files
●   Demo
Working with files

                          Duration in ms to write 50.000 lines a 140 Bytes into a file


18000


16000


14000


12000                                                                                    Line by Line
                                                                                         Aggregator (String)
                                                                                         Aggregator (StringBuilder)
10000                                                                                    Streaming
                                                                                         Aggregator (Build in)
8000


6000


4000


2000


   0
                 14400    17700           4300             4300            3200


        https://github.com/muellerc/apachecon-na-2013/tree/master/file-component
Conclusion
●   Use an Aggregator to reduce the number of
    file accesses (prefer the build in one)
●   Use a StringBuilder to concatenate Strings
Working with databases
●   Demo
Working with databases

                               Duration in ms to insert 10.000 records



3500


3000


2500
                                                                         Record by Record
                                                                         Batched (by 10 records)
2000                                                                     Batched (by 100 records)
                                                                         Batched (by 1000 records)

1500


1000


500


   0
                 3200       1400             1200              1100


       https://github.com/muellerc/apachecon-na-2013/tree/master/sql-component
Conclusion
●   Use an Aggregator to reduce the number of
    database accesses
Working with threads()
●   Demo
Working with threads()

                Duration in ms to process 1000 messages     Duration in ms to process 10 files


12000



10000



8000
                                                                                                 Single threaded processing
                                                                                                 Multi threaded processing (10)
6000



4000



2000



    0
                11400          1200                       10100         1100


        https://github.com/muellerc/apachecon-na-2013/tree/master/threads
Conclusion
●   Use threads to parallelize your work
Working with templates
●   Demo
Working with templates

                                  Duration in ms to process 10000 messages




3500


3000


2500
                                                                             String Template
                                                                             Velocity
2000                                                                         FreeMarker


1500


1000


500


  0                  3100            1200                  1000


       https://github.com/muellerc/apachecon-na-2013/tree/master/template
Conclusion
●   Prefer to use FreeMarker or Velocity
Using web services
●   Demo
Using web services

                               Duration in ms to send 10000 messages



30000



25000



20000                                                                     POJO (without Woodstox)
                                                                          POJO
                                                                          PAYLOAD
                                                                          MESSAGE
15000



10000



5000



   0
                   28300     26300          25400           23000


        https://github.com/muellerc/apachecon-na-2013/tree/master/cxf-component
Conclusion
●   Prefer to use the PAYLOAD or MESSAGE
    data format if you don't need a Java object
    (skip the Unmarshaler)
●   Fine tune you container (Jetty, Tomcat, …)
    to use the right settings for your needs
    (connector, acceptor, ...)
Messaging
●   Demo
Messaging

                                 Duration in ms to process 100 messages




6000



5000



4000                                                                         InOut perm. queue
                                                                             InOut temp. queue
                                                                             InOnly
3000



2000



1000



   0                 5600          5600                  1100


       https://github.com/muellerc/apachecon-na-2013/tree/master/jms-component
Messaging

                          Duration in ms to read and write 10000 messages



3500


3000


2500
                                                                            SJMS (Trans.)
                                                                            SJMS (Trans. Batch Consumer)
2000                                                                        SJMS (Trans. Batch)*


1500


1000


500


   0               3300           2500                2200


       https://github.com/muellerc/apachecon-na-2013/tree/master/sjms-component




                                                                             * could be improved
Conclusion
●   Prefer to use InOnly routes instead of InOut
    routes if possible
●   Use temp. reply queues or exclusive perm.
    reply queues if you have to use InOut
    routes
●   Acknowledge messages in batch mode
    (SJMS)
●   Use the batch message to reduce the
    number of broker accesses (SJMS)
Q&A

Más contenido relacionado

La actualidad más candente

Linux Kernel Extension for Databases / Александр Крижановский (Tempesta Techn...
Linux Kernel Extension for Databases / Александр Крижановский (Tempesta Techn...Linux Kernel Extension for Databases / Александр Крижановский (Tempesta Techn...
Linux Kernel Extension for Databases / Александр Крижановский (Tempesta Techn...
Ontico
 
Tarantool как платформа для микросервисов / Антон Резников, Владимир Перепели...
Tarantool как платформа для микросервисов / Антон Резников, Владимир Перепели...Tarantool как платформа для микросервисов / Антон Резников, Владимир Перепели...
Tarantool как платформа для микросервисов / Антон Резников, Владимир Перепели...
Ontico
 

La actualidad más candente (20)

My sql fabric ha and sharding solutions
My sql fabric ha and sharding solutionsMy sql fabric ha and sharding solutions
My sql fabric ha and sharding solutions
 
PostgreSQL performance archaeology
PostgreSQL performance archaeologyPostgreSQL performance archaeology
PostgreSQL performance archaeology
 
Мониторинг. Опять, rootconf 2016
Мониторинг. Опять, rootconf 2016Мониторинг. Опять, rootconf 2016
Мониторинг. Опять, rootconf 2016
 
MongoDB as Message Queue
MongoDB as Message QueueMongoDB as Message Queue
MongoDB as Message Queue
 
Metrics: where and how
Metrics: where and howMetrics: where and how
Metrics: where and how
 
MongoDB Shard Cluster
MongoDB Shard ClusterMongoDB Shard Cluster
MongoDB Shard Cluster
 
Add a bit of ACID to Cassandra. Cassandra Summit EU 2014
Add a bit of ACID to Cassandra. Cassandra Summit EU 2014Add a bit of ACID to Cassandra. Cassandra Summit EU 2014
Add a bit of ACID to Cassandra. Cassandra Summit EU 2014
 
JVM performance options. How it works
JVM performance options. How it worksJVM performance options. How it works
JVM performance options. How it works
 
Как построить видеоплатформу на 200 Гбитс / Ольховченков Вячеслав (Integros)
Как построить видеоплатформу на 200 Гбитс / Ольховченков Вячеслав (Integros)Как построить видеоплатформу на 200 Гбитс / Ольховченков Вячеслав (Integros)
Как построить видеоплатформу на 200 Гбитс / Ольховченков Вячеслав (Integros)
 
MongoDB Replication Cluster
MongoDB Replication ClusterMongoDB Replication Cluster
MongoDB Replication Cluster
 
Elastic 101 tutorial - Percona Europe 2018
Elastic 101 tutorial - Percona Europe 2018 Elastic 101 tutorial - Percona Europe 2018
Elastic 101 tutorial - Percona Europe 2018
 
Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...
Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...
Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...
 
Linux Kernel Extension for Databases / Александр Крижановский (Tempesta Techn...
Linux Kernel Extension for Databases / Александр Крижановский (Tempesta Techn...Linux Kernel Extension for Databases / Александр Крижановский (Tempesta Techn...
Linux Kernel Extension for Databases / Александр Крижановский (Tempesta Techn...
 
NUSE (Network Stack in Userspace) at #osio
NUSE (Network Stack in Userspace) at #osioNUSE (Network Stack in Userspace) at #osio
NUSE (Network Stack in Userspace) at #osio
 
Thanos - Prometheus on Scale
Thanos - Prometheus on ScaleThanos - Prometheus on Scale
Thanos - Prometheus on Scale
 
Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...
Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...
Как понять, что происходит на сервере? / Александр Крижановский (NatSys Lab.,...
 
Tarantool как платформа для микросервисов / Антон Резников, Владимир Перепели...
Tarantool как платформа для микросервисов / Антон Резников, Владимир Перепели...Tarantool как платформа для микросервисов / Антон Резников, Владимир Перепели...
Tarantool как платформа для микросервисов / Антон Резников, Владимир Перепели...
 
System Capa Planning_DBA oracle edu
System Capa Planning_DBA oracle eduSystem Capa Planning_DBA oracle edu
System Capa Planning_DBA oracle edu
 
tdc2012
tdc2012tdc2012
tdc2012
 
Recent my sql_performance Test detail
Recent my sql_performance Test detailRecent my sql_performance Test detail
Recent my sql_performance Test detail
 

Similar a Apache Con NA 2013

J Ruby Kungfu Rails
J Ruby   Kungfu RailsJ Ruby   Kungfu Rails
J Ruby Kungfu Rails
Daniel Lv
 
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
Marco Gralike
 
Running Presto and Spark on the Netflix Big Data Platform
Running Presto and Spark on the Netflix Big Data PlatformRunning Presto and Spark on the Netflix Big Data Platform
Running Presto and Spark on the Netflix Big Data Platform
Eva Tse
 
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Claus Ibsen
 
HandlerSocket plugin Client for Javaとそれを用いたベンチマーク
HandlerSocket plugin Client for Javaとそれを用いたベンチマークHandlerSocket plugin Client for Javaとそれを用いたベンチマーク
HandlerSocket plugin Client for Javaとそれを用いたベンチマーク
moai kids
 

Similar a Apache Con NA 2013 (20)

Squeak DBX
Squeak DBXSqueak DBX
Squeak DBX
 
J Ruby Kungfu Rails
J Ruby   Kungfu RailsJ Ruby   Kungfu Rails
J Ruby Kungfu Rails
 
Apache Camel K - Fredericia
Apache Camel K - FredericiaApache Camel K - Fredericia
Apache Camel K - Fredericia
 
Betting On Data Grids
Betting On Data GridsBetting On Data Grids
Betting On Data Grids
 
Tuning Solr for Logs: Presented by Radu Gheorghe, Sematext
Tuning Solr for Logs: Presented by Radu Gheorghe, SematextTuning Solr for Logs: Presented by Radu Gheorghe, Sematext
Tuning Solr for Logs: Presented by Radu Gheorghe, Sematext
 
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
 
Deployment de Rails
Deployment de RailsDeployment de Rails
Deployment de Rails
 
Deep Dive on Amazon Aurora
Deep Dive on Amazon AuroraDeep Dive on Amazon Aurora
Deep Dive on Amazon Aurora
 
Perf EMC VNX5100 vs IBM DS5300 Eng
Perf EMC VNX5100 vs IBM DS5300 EngPerf EMC VNX5100 vs IBM DS5300 Eng
Perf EMC VNX5100 vs IBM DS5300 Eng
 
Fisl - Deployment
Fisl - DeploymentFisl - Deployment
Fisl - Deployment
 
Running Presto and Spark on the Netflix Big Data Platform
Running Presto and Spark on the Netflix Big Data PlatformRunning Presto and Spark on the Netflix Big Data Platform
Running Presto and Spark on the Netflix Big Data Platform
 
(BDT303) Running Spark and Presto on the Netflix Big Data Platform
(BDT303) Running Spark and Presto on the Netflix Big Data Platform(BDT303) Running Spark and Presto on the Netflix Big Data Platform
(BDT303) Running Spark and Presto on the Netflix Big Data Platform
 
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
 
Project Tungsten Phase II: Joining a Billion Rows per Second on a Laptop
Project Tungsten Phase II: Joining a Billion Rows per Second on a LaptopProject Tungsten Phase II: Joining a Billion Rows per Second on a Laptop
Project Tungsten Phase II: Joining a Billion Rows per Second on a Laptop
 
Apache Camel K - Copenhagen v2
Apache Camel K - Copenhagen v2Apache Camel K - Copenhagen v2
Apache Camel K - Copenhagen v2
 
Apache Camel K - Copenhagen
Apache Camel K - CopenhagenApache Camel K - Copenhagen
Apache Camel K - Copenhagen
 
MongoDB: How it Works
MongoDB: How it WorksMongoDB: How it Works
MongoDB: How it Works
 
Spark Summit EU talk by Sameer Agarwal
Spark Summit EU talk by Sameer AgarwalSpark Summit EU talk by Sameer Agarwal
Spark Summit EU talk by Sameer Agarwal
 
Apache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel QuarkusApache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel Quarkus
 
HandlerSocket plugin Client for Javaとそれを用いたベンチマーク
HandlerSocket plugin Client for Javaとそれを用いたベンチマークHandlerSocket plugin Client for Javaとそれを用いたベンチマーク
HandlerSocket plugin Client for Javaとそれを用いたベンチマーク
 

Último

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Último (20)

Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 

Apache Con NA 2013

  • 1. Performance Optimizations for Apache Camel Christian Müller
  • 2. WARNING: Jetlagged! http://sav-cdn.com/sites/default/files/imagecache/superphoto/10718770.jpg
  • 3. Agenda ● Brief Introduction ● Content based routing EIP (and XML) ● Split EIP (and XML) ● Marshaling / Unmarshaling ● Working with files ● Accessing databases ● Working with threads() ● Working with templates ● Using Web Services ● Messaging ● Q&A
  • 4. Brief introduction ● 11 years of experience in software development and architecture – Focused on Java integration technologies ● Senior Software Developer at Atos Worldline in Frankfurt, Germany – Tech. responsible for our integration platform based on ServiceMix & Camel ● Apache Camel committer and current PMC chair – Partly involved in Apache Karaf, ServiceMix
  • 5. Apache Camel 3.0 ● Be involved! – irc://irc.codehaus.org/camel – dev@camel.apache.org – http://camel.465427.n5.nabble.com/Camel- Development-f479097.html ● Share your ideas & wishes with us! – http://camel.apache.org/camel-30-ideas.html ● Be part of it! – http://camel.apache.org/camel-30-roadmap.html – http://camel.apache.org/contributing.html
  • 6. Content based routing EIP ● Demo
  • 7. Content based routing EIP Duration in ms to route 10.000 10 KByte messages 9000 8000 7000 XPath (JDK) 6000 XPath (Saxon) XQuery 5000 VTDXML* Simple Header 4000 3000 2000 1000 0 8900 4500 3900 2600 600 500 https://github.com/muellerc/apachecon-na-2013/tree/master/cbr-eip * GPL
  • 8. Conclusion ● Prefer to use conditions based on your message header ● Use String contains check, if it works for you (e.g. with Simple language) ● Use VDTXML if possible (GPL license) ● Use XQuery ● If you (have to) use XPath, make sure you have Saxon in your class path.
  • 10. Split EIP Duration in ms to split a 100 MByte message Memory footprint in MByte to split a 100 MByte file 9000 8000 7000 6000 XPath (JDK) XPath (Saxon) 5000 VTDXML* XML Tokenizer 4000 3000 2000 1000 0 0 8800 5100 7400 1126 480 200 8 https://github.com/muellerc/apachecon-na-2013/tree/master/split-eip * GPL
  • 11. Conclusion ● Use VDTXML if possible (GPL license) ● Prefer to use the XML Tokenizer (NS limitation) ● If you (have to) use XPath, make sure you have Saxon in your class path. – Otherwise there is a good chance it will fail
  • 13. Marshaling / Unmarshaling Duration in ms to marshal and unmarshal 10.000 messages 5000 4500 4000 XStream (XML) 3500 XMLBeans (XML) JAXB (XML) 3000 JIBX* (XML) XStream (Json) 2500 Gson (Json) Jackson (Json) 2000 Java Serialization 1500 1000 500 0 3100 2300 2200 1800 5000 1200 800 1100 https://github.com/muellerc/apachecon-na-2013/tree/master/marshaling-unmarshaling * doesn't work with Java 7 in every case
  • 14. Conclusion ● Use JIBX for XML if possible (not Java 7 ready at present) ● Use JAXB for XML ● Use Jackson for Json ● Don't use Java serialization (not interoperable, not easy to read)
  • 16. Working with files Duration in ms to write 50.000 lines a 140 Bytes into a file 18000 16000 14000 12000 Line by Line Aggregator (String) Aggregator (StringBuilder) 10000 Streaming Aggregator (Build in) 8000 6000 4000 2000 0 14400 17700 4300 4300 3200 https://github.com/muellerc/apachecon-na-2013/tree/master/file-component
  • 17. Conclusion ● Use an Aggregator to reduce the number of file accesses (prefer the build in one) ● Use a StringBuilder to concatenate Strings
  • 19. Working with databases Duration in ms to insert 10.000 records 3500 3000 2500 Record by Record Batched (by 10 records) 2000 Batched (by 100 records) Batched (by 1000 records) 1500 1000 500 0 3200 1400 1200 1100 https://github.com/muellerc/apachecon-na-2013/tree/master/sql-component
  • 20. Conclusion ● Use an Aggregator to reduce the number of database accesses
  • 22. Working with threads() Duration in ms to process 1000 messages Duration in ms to process 10 files 12000 10000 8000 Single threaded processing Multi threaded processing (10) 6000 4000 2000 0 11400 1200 10100 1100 https://github.com/muellerc/apachecon-na-2013/tree/master/threads
  • 23. Conclusion ● Use threads to parallelize your work
  • 25. Working with templates Duration in ms to process 10000 messages 3500 3000 2500 String Template Velocity 2000 FreeMarker 1500 1000 500 0 3100 1200 1000 https://github.com/muellerc/apachecon-na-2013/tree/master/template
  • 26. Conclusion ● Prefer to use FreeMarker or Velocity
  • 28. Using web services Duration in ms to send 10000 messages 30000 25000 20000 POJO (without Woodstox) POJO PAYLOAD MESSAGE 15000 10000 5000 0 28300 26300 25400 23000 https://github.com/muellerc/apachecon-na-2013/tree/master/cxf-component
  • 29. Conclusion ● Prefer to use the PAYLOAD or MESSAGE data format if you don't need a Java object (skip the Unmarshaler) ● Fine tune you container (Jetty, Tomcat, …) to use the right settings for your needs (connector, acceptor, ...)
  • 31. Messaging Duration in ms to process 100 messages 6000 5000 4000 InOut perm. queue InOut temp. queue InOnly 3000 2000 1000 0 5600 5600 1100 https://github.com/muellerc/apachecon-na-2013/tree/master/jms-component
  • 32. Messaging Duration in ms to read and write 10000 messages 3500 3000 2500 SJMS (Trans.) SJMS (Trans. Batch Consumer) 2000 SJMS (Trans. Batch)* 1500 1000 500 0 3300 2500 2200 https://github.com/muellerc/apachecon-na-2013/tree/master/sjms-component * could be improved
  • 33. Conclusion ● Prefer to use InOnly routes instead of InOut routes if possible ● Use temp. reply queues or exclusive perm. reply queues if you have to use InOut routes ● Acknowledge messages in batch mode (SJMS) ● Use the batch message to reduce the number of broker accesses (SJMS)
  • 34. Q&A