apache con na_2013_updated_2016

22
Performance Optimizations for Apache Camel Christian Müller

Upload: muellerc

Post on 27-Jan-2017

1.646 views

Category:

Engineering


0 download

TRANSCRIPT

Page 1: Apache con na_2013_updated_2016

Performance Optimizationsfor Apache Camel

Christian Müller

Page 2: Apache con na_2013_updated_2016

Environment● Mac Book Pro 2,7 GHz Intel Core i7● 16 GB Memory (1600 MHz DDR3)● 500 GB Flash Storage● OSX 10.11.3

Page 3: Apache con na_2013_updated_2016

Content based routing EIPCamel 2.16.2 + JDK 1.7.0_75

Duration in ms to route 10.000 10 KByte messages

0

500

1000

1500

2000

2500

3000

3500

4000

3440 2310 3580 1230 240 220

XPath (JDK)

XPath (Saxon)

XQueryVTDXML*

Simple

Header

* GPL

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

Page 4: Apache con na_2013_updated_2016

Content based routing EIPCamel 2.16.2 + JDK 1.8.0_71

Duration in ms to route 10.000 10 KByte messages

0

500

1000

1500

2000

2500

3000

2190 1870 2730 1170 130 110 120 110

XPath Body (JDK)

XPath Body (Saxon)

XQuery Body

VTDXML* BodySimple Body

Java Predicate Body

DSL Header

Java Predicate Header

* GPL

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

Page 5: Apache con na_2013_updated_2016

Split EIPCamel 2.16.2 + JDK 1.7.0_75

Duration in ms to split a 100 MByte messageMemory footprint in MByte to split a 100 MByte file

0

2000

4000

6000

8000

10000

12000

10640 11262980 4803550 2006770 8

XPath (JDK)

XPath (Saxon)VTDXML*

XML Tokenizer

* GPL

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

Page 6: Apache con na_2013_updated_2016

Split EIPCamel 2.16.2 + JDK 1.8.0_71

Duration in ms to split a 100 MByte messageMemory footprint in MByte to split a 100 MByte file

0

1000

2000

3000

4000

5000

6000

7000

8000

9000

10000

9930 11263030 4801720 2006100 8

XPath (JDK)

XPath (Saxon)VTDXML*

XML Tokenizer

* GPL

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

Page 7: Apache con na_2013_updated_2016

Marshaling / UnmarshalingCamel 2.16.2 + JDK 1.7.0_75

Duration in ms to marshal and unmarshal 10.000 messages

0

500

1000

1500

2000

2500

3000

1410 750 840 700 2830 470 460 530

XStream (XML)

XMLBeans (XML)

JAXB (XML)

JIBX (XML)

XStream (Json)

Gson (Json)

Jackson (Json)

Java Serialization

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

Page 8: Apache con na_2013_updated_2016

Marshaling / UnmarshalingCamel 2.16.2 + JDK 1.8.0_71

Duration in ms to marshal and unmarshal 10.000 messages

0

500

1000

1500

2000

2500

3000

1180 620 550 0 2830 320 210 490 460

XStream (XML)

XMLBeans (XML)

JAXB (XML)

JIBX* (XML)

XStream (Json)

Gson (Json)

Jackson (Json)

Java Serialization

Boon (Json)

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

* doesn't work with Java 8 at present

Page 9: Apache con na_2013_updated_2016

Working with filesCamel 2.16.2 + JDK 1.7.0_75

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

0

2000

4000

6000

8000

10000

12000

11930 5070 1480 2330 1870

Line by Line

Aggregator (Blocks and String)Aggregator (StringBuilder)

Streaming

Aggregator (Blocks and StringBuilder)

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

Page 10: Apache con na_2013_updated_2016

Working with filesCamel 2.16.2 + JDK 1.8.0_71

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

0

2000

4000

6000

8000

10000

12000

10670 4310 890 1670 1130 730

Line by Line

Aggregator (Blocks and String)

Aggregator (StringBuilder)Streaming

Aggregator (Blocks and StringBuilder)

Optimized Splitter

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

Page 11: Apache con na_2013_updated_2016

Working with databasesCamel 2.16.2 + JDK 1.7.0_75

Duration in ms to insert 10.000 records

0

200

400

600

800

1000

1200

1400

1600

1800

1650 800 550 570

Record by Record

Batched (by 10 records)Batched (by 100 records)

Batched (by 1000 records)

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

Page 12: Apache con na_2013_updated_2016

Working with databasesCamel 2.16.2 + JDK 1.8.0_71

Duration in ms to insert 10.000 records

0

200

400

600

800

1000

1200

1400

1600

1470 510 370 310

Record by Record

Batched (by 10 records)Batched (by 100 records)

Batched (by 1000 records)

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

Page 13: Apache con na_2013_updated_2016

Working with threads()Camel 2.16.2 + JDK 1.7.0_75

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

0

2000

4000

6000

8000

10000

12000

14000

12370 100701230 1040

Single threaded processingMulti threaded processing (10)

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

Page 14: Apache con na_2013_updated_2016

Working with threads()Camel 2.16.2 + JDK 1.8.0_71

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

0

2000

4000

6000

8000

10000

12000

14000

12250 100601190 1040

Single threaded processingMulti threaded processing (10)

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

Page 15: Apache con na_2013_updated_2016

Working with templatesCamel 2.16.2 + JDK 1.7.0_75

Duration in ms to process 10000 messages

0

200

400

600

800

1000

1200

1400

1230 480 270

String TemplateVelocity

FreeMarker

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

Page 16: Apache con na_2013_updated_2016

Working with templatesCamel 2.16.2 + JDK 1.8.0_71

Duration in ms to process 10000 messages

0

200

400

600

800

1000

1200

1400

1210 390 160 170 150

String Template

VelocityFreeMarker

Mustache

Chunk

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

Page 17: Apache con na_2013_updated_2016

Using web servicesCamel 2.16.2 + JDK 1.7.0_75

Duration in ms to send 10000 messages

0

5000

10000

15000

20000

25000

30000

35000

33110 32580 28310

POJO* (without Woodstox)

POJOPAYLOAD

MESSAGE

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

* doesn't work without Woodstox anymore

Page 18: Apache con na_2013_updated_2016

Using web servicesCamel 2.16.2 + JDK 1.8.0_71

Duration in ms to send 10000 messages

0

5000

10000

15000

20000

25000

30000

35000

32320 31860 27700

POJO* (without Woodstox)

POJOPAYLOAD

MESSAGE

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

* doesn't work without Woodstox anymore

Page 19: Apache con na_2013_updated_2016

MessagingCamel 2.16.2 + JDK 1.7.0_75

Duration in ms to process 100 messages

0

1000

2000

3000

4000

5000

6000

5770 5720 1100

InOut perm. queueInOut temp. queue

InOnly

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

Page 20: Apache con na_2013_updated_2016

MessagingCamel 2.16.2 + JDK 1.8.0_71

Duration in ms to process 100 messages

0

1000

2000

3000

4000

5000

6000

5620 5600 1090

InOut perm. queueInOut temp. queue

InOnly

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

Page 21: Apache con na_2013_updated_2016

MessagingCamel 2.16.2 + JDK 1.7.0_75

Duration in ms to read and write 10000 messages

0

200

400

600

800

1000

1200

1400

1600

1800

1690 1280 1180

SJMS (Trans.)SJMS (Trans. Batch Consumer)

SJMS (Trans. Batch)*

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

* could be improved

Page 22: Apache con na_2013_updated_2016

MessagingCamel 2.16.2 + JDK 1.8.0_71

Duration in ms to read and write 10000 messages

0

200

400

600

800

1000

1200

1400

1600

1800

2000

1860 1650 1340

SJMS (Trans.)SJMS (Trans. Batch Consumer)

SJMS (Trans. Batch)*

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

* could be improved