SlideShare a Scribd company logo
1 of 52
Download to read offline
Serialization and
performance
Сергей Моренец
23 мая 2014 г.
About author
Works in IT since 2000
10 year of Java SE/EE experience
Occupied senior Java developer/Team
Lead positions
Winner of 2013 JBoss Community
Recognition Award.
https://www.jboss.org/jbcra
Agenda
• Purpose of serialization
• Frameworks overview
• Performance testing
• Q & A
Serialization
File storages
Database
Network communication
Web usage
Serialization
Simple
Flexible
Compact
Versioning
Fast Scalable
Data formats
Binary
XML
JSON
YAML
Performance
• Native memory copying using C operations
• “Unsafe” operations
• Ignore object introspection
• Direct object-object copying
Java serialization
• The easiest programming effort
• Out-of-the-box functionality
Java serialization
• Serializable interface
• Decreases the flexibility to change a class’s
implementation once it has been released
• Doesn’t allow to exchange data with
C++/Python applications
• Due to default constructors hole for invariant
corruption and illegal access
• No customization
• You should have access to the source code
No customization
You should have access to the source code
Java externalization
• Serialization but by implementing
Externalizable interface to persist and
restore the object
• Responsibility of the class to save and
restore the contents of its instances
• Requires modifications in
marshalling/unmarshalling code if the class
contents changed
No customization
You should have access to the source code
Java externalization
Avro
• Schema evolution
• Binary and JSON encoding
• Dynamic typing
• Support of Java, C, C++, C# and Python
• Apache Hadoop integration
Avro
Avro
XML
• Interchangeable format
• Supported schemas
• Space intensive and huge performance loss
• Complex navigating
Simple
• High performance XML serialization and
configuration framework for Java.
• Requires absolutely no configuration
• Can handle cycles in the object graph
Simple
Javolution
• Fast real-time library for safety-critical
applications
• Based on OSGi context
• Parallel computing support
Javolution
Json-io
• Doesn’t require custom interfaces/attributes
usage/source code
• Handles cyclic references
• Reader/writer customization
• Does not depend on any native or 3rd party
libraries.
Google gson
• Java library to convert JSON to Java objects and
vice-versa
• Doesn’t require source code of serialized objects
• Allow custom representatives
Google gson
Jackson
• High-performance, ergonomic JSON processor
Java library
• Extensive customization tools
• Mix-in annotations
• Materialized interfaces
• Multiple data formats
Jackson
• JSON
• CSV
• Smile(binary JSON)
• XML
• YAML(similar to JSON)
BSON for Jackson
• Binary encoded JSON
• Main data exchange format for MongoDB
• Allows writing custom extensions
Protocol buffers
• Way of encoding structured data in an efficient
yet extensible format.
• Google uses Protocol Buffers for almost all of
its internal RPC protocols and file formats.
• Supported in Java, C++, Python
Protocol buffers
message User {
required string login = 1;
repeated Order orders = 2;
}
message Order {
required int32 id = 1;
optional string date = 2;
}
Protocol buffers
FST
• Java-to-java library
• No support for versioning
• Use case is high performance message oriented
software
• Drop-in replacement
• Custom optimization using annotations, custom
serializers
FST
GridGain
• Part of distributed computing system
• Don’t require any custom interfaces or API
• Direct memory copying by invoking native
"unsafe" operations
• Predefined fields introspection
GridGain
Kryo
• Fast and efficient object graph serialization
framework for Java
• Open source project on Google code
• Automatic deep and shallow copying/cloning
• Doesn’t put requirements on the source classes
(in most cases)
Kryo
• Twitter
• Apache Hive
• Akka
• Storm
• S4
Kryo
Kryo
Benchmark
• JDK 1.8.0.5
• Apache Avro 1.7.6
• Simple 2.7.1
• Json-io 2.5.2
• Google GSON 2.2.4
• Jackson 2.3.2
• BSON for Jackson 2.3.1
• Protocol buffers 2.5
• Kryo 2.23
• FST 1.54
• GridGain 6.0.2
Benchmark
• Speed(serialization and deserialization)
• Size(complex and ordinary objects)
• Flexibility
Benchmark
Benchmark
Issues
Library Description
Gson, Jackson Crashed when serializing cyclic
dependency
Simple Crashed for very big XML file
Avro Bug during deserialization
Serialization (complex)
# Library Time(ms)
1 Kryo(optimized) 134
2 Protocol buffers 165
3 GridGain 196
4 FST 207
5 Kryo 209
6 Jackson(smile) 275
7 Kryo(unsafe) 306
8 Jackson 491
9 Java serialization 605
10 Javolution 1043
Serialization (simple)
# Library Time(ms)
1 Protocol buffers <1
2 Google GSON 5
3 Java serialization 10
4 BSON for Jackson 10
5 Jackson(smile) 11
6 Kryo(optimized) 17
7 Kryo 18
8 Jackson 18
9 Kryo(unsafe) 20
10 Javolution 21
Deserialization (complex)
# Library Time(ms)
1 Kryo(optimized) 113
2 Protocol buffers 165
3 GridGain 196
4 FST 207
5 Kryo 209
6 Jackson(smile) 275
7 Kryo(unsafe) 306
8 Jackson 491
9 Java serialization 605
10 BSON for Jackson 930
Deserialization (simple)
# Library Time(ms)
1 Protocol buffers 1
2 GridGain 3
3 Google GSON 6
4 Jackson(smile) 9
5 BSON for Jackson 9
6 Kryo(optimized) 18
7 Kryo 18
8 Jackson 18
9 Kryo(unsafe) 20
10 FST 42
Size (complex)
# Library Size(bytes)
1 Kryo(optimized) 33904
2 FST 34069
3 Kryo 35674
4 Protocol buffers 39517
5 Kryo(unsafe) 40554
6 Jackson(smile) 44840
7 Java serialization 49757
8 GridGain 58288
9 Jackson 67858
10 Google GSON 68338
Size (simple)
# Library Size(bytes)
1 Kryo(optimized) 18
2 Kryo 18
3 Protocol buffers 20
4 Kryo(unsafe) 21
5 GridGain 33
6 Jackson(smile) 40
7 Jackson 41
8 Google GSON 41
9 Jackson(YAML) 41
10 BSON for Jackson 46
Usability
# Library
1 Google GSON
2 Kryo
2 Kryo(unsafe)
3 Jackson
3 Jackson(XML, Smile, YAML)
3 BSON for Jackson
4 Json-io
5 FST
6 Java serialization
7 Kryo(optimized)
Overall rating (2014)
# Library Rating
1 Kryo(optimized) 67
2 Protocol buffers 65
3 Kryo 58
4 Jackson(smile) 55
5 Kryo(unsafe) 46
6 GridGain 44
7 Google GSON 43
8 FST 43
9 Jackson 40
10 BSON for Jackson 33
11 Java serialization 32
Overall rating (2013)
# Library Rating
1 Kryo(optimized) 67
2 Kryo(unsafe) 65
3 Protocol buffers 63
4 Kryo 59
5 Jackson(smile) 51
6 Google GSON 45
7 FST 42
8 GridGain 34
9 Jackson 32
10 Java serialization 30
11 BSON for Jackson 24
Advices
Library Usage
Kryo Fast and compact serializer for complex
objects over network
Protocol buffers Fast serializer for simple objects
Jackson(smile) Jackson-based serializer for Web usage
Google JSON Dirty solution to quickly serialize/deserialize
objects
Apache Avro Serialize objects into files with possible
schema changes
Java Out-of-the-box trusted solution without
additional libraries
Сергей Моренец
morenets@mail.ru
Q&A

More Related Content

What's hot

Infographic: Importance of Performance Testing
Infographic: Importance of Performance TestingInfographic: Importance of Performance Testing
Infographic: Importance of Performance TestingKiwiQA
 
Security testing fundamentals
Security testing fundamentalsSecurity testing fundamentals
Security testing fundamentalsCygnet Infotech
 
Agile & SCRUM
Agile & SCRUMAgile & SCRUM
Agile & SCRUMejlp12
 
Accuracy and time_costs_of_web_app_scanners
Accuracy and time_costs_of_web_app_scannersAccuracy and time_costs_of_web_app_scanners
Accuracy and time_costs_of_web_app_scannersLarry Suto
 
Agile Resort Brochure Game July 2011
Agile Resort Brochure Game July 2011Agile Resort Brochure Game July 2011
Agile Resort Brochure Game July 2011Glenn Smith
 
Chapter 6 - Tool Support for Testing
Chapter 6 - Tool Support for TestingChapter 6 - Tool Support for Testing
Chapter 6 - Tool Support for TestingNeeraj Kumar Singh
 
Insprint automation, build the culture
Insprint automation, build the cultureInsprint automation, build the culture
Insprint automation, build the cultureShekharRamphal
 
Ginsbourg.com - Performance and load test report template ltr 2.0
Ginsbourg.com - Performance and load test report template ltr 2.0Ginsbourg.com - Performance and load test report template ltr 2.0
Ginsbourg.com - Performance and load test report template ltr 2.0Shay Ginsbourg
 
Performance Requirement Gathering
Performance Requirement GatheringPerformance Requirement Gathering
Performance Requirement GatheringAtul Pant
 
Non functional requirements
Non functional requirementsNon functional requirements
Non functional requirementsPavel Růžička
 
Тестування станів та переходів
Тестування станів та переходівТестування станів та переходів
Тестування станів та переходівRoman Iakymchuk
 
Test automation methodologies
Test automation methodologiesTest automation methodologies
Test automation methodologiesMesut Günes
 
ISTQB / ISEB Foundation Exam Practice - 6
ISTQB / ISEB Foundation Exam Practice - 6ISTQB / ISEB Foundation Exam Practice - 6
ISTQB / ISEB Foundation Exam Practice - 6Yogindernath Gupta
 
Performance testing with Jmeter
Performance testing with JmeterPerformance testing with Jmeter
Performance testing with JmeterPrashanth Kumar
 
Test case template
Test case templateTest case template
Test case templatesephalika
 
The Daily Scrum (The Scrum Events)
The Daily Scrum (The Scrum Events)The Daily Scrum (The Scrum Events)
The Daily Scrum (The Scrum Events)George Psistakis
 
Performance and load testing
Performance and load testingPerformance and load testing
Performance and load testingsonukalpana
 
The Quality Assurance Checklist for Progressive Testing
The Quality Assurance Checklist for Progressive TestingThe Quality Assurance Checklist for Progressive Testing
The Quality Assurance Checklist for Progressive TestingCygnet Infotech
 

What's hot (20)

Infographic: Importance of Performance Testing
Infographic: Importance of Performance TestingInfographic: Importance of Performance Testing
Infographic: Importance of Performance Testing
 
Security testing fundamentals
Security testing fundamentalsSecurity testing fundamentals
Security testing fundamentals
 
Agile & SCRUM
Agile & SCRUMAgile & SCRUM
Agile & SCRUM
 
Accuracy and time_costs_of_web_app_scanners
Accuracy and time_costs_of_web_app_scannersAccuracy and time_costs_of_web_app_scanners
Accuracy and time_costs_of_web_app_scanners
 
Agile Resort Brochure Game July 2011
Agile Resort Brochure Game July 2011Agile Resort Brochure Game July 2011
Agile Resort Brochure Game July 2011
 
Chapter 6 - Tool Support for Testing
Chapter 6 - Tool Support for TestingChapter 6 - Tool Support for Testing
Chapter 6 - Tool Support for Testing
 
Insprint automation, build the culture
Insprint automation, build the cultureInsprint automation, build the culture
Insprint automation, build the culture
 
Ginsbourg.com - Performance and load test report template ltr 2.0
Ginsbourg.com - Performance and load test report template ltr 2.0Ginsbourg.com - Performance and load test report template ltr 2.0
Ginsbourg.com - Performance and load test report template ltr 2.0
 
Daily standup
Daily standupDaily standup
Daily standup
 
Performance Requirement Gathering
Performance Requirement GatheringPerformance Requirement Gathering
Performance Requirement Gathering
 
Non functional requirements
Non functional requirementsNon functional requirements
Non functional requirements
 
Тестування станів та переходів
Тестування станів та переходівТестування станів та переходів
Тестування станів та переходів
 
Test automation methodologies
Test automation methodologiesTest automation methodologies
Test automation methodologies
 
ISTQB / ISEB Foundation Exam Practice - 6
ISTQB / ISEB Foundation Exam Practice - 6ISTQB / ISEB Foundation Exam Practice - 6
ISTQB / ISEB Foundation Exam Practice - 6
 
Performance testing with Jmeter
Performance testing with JmeterPerformance testing with Jmeter
Performance testing with Jmeter
 
Test case template
Test case templateTest case template
Test case template
 
The Daily Scrum (The Scrum Events)
The Daily Scrum (The Scrum Events)The Daily Scrum (The Scrum Events)
The Daily Scrum (The Scrum Events)
 
Performance and load testing
Performance and load testingPerformance and load testing
Performance and load testing
 
Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
 
The Quality Assurance Checklist for Progressive Testing
The Quality Assurance Checklist for Progressive TestingThe Quality Assurance Checklist for Progressive Testing
The Quality Assurance Checklist for Progressive Testing
 

Viewers also liked

Practical Machine Learning
Practical Machine LearningPractical Machine Learning
Practical Machine LearningDavid Jones
 
[D2]java 성능에 대한 오해와 편견
[D2]java 성능에 대한 오해와 편견[D2]java 성능에 대한 오해와 편견
[D2]java 성능에 대한 오해와 편견NAVER D2
 
20150526 오픈업 mcn의 미래_명승은
20150526 오픈업 mcn의 미래_명승은20150526 오픈업 mcn의 미래_명승은
20150526 오픈업 mcn의 미래_명승은VentureSquare
 
Advanced nGrinder 2nd Edition
Advanced nGrinder 2nd EditionAdvanced nGrinder 2nd Edition
Advanced nGrinder 2nd EditionJunHo Yoon
 
[오픈소스컨설팅]Java Performance Tuning
[오픈소스컨설팅]Java Performance Tuning[오픈소스컨설팅]Java Performance Tuning
[오픈소스컨설팅]Java Performance TuningJi-Woong Choi
 
Micro Service Architecture 탐방기
Micro Service Architecture 탐방기Micro Service Architecture 탐방기
Micro Service Architecture 탐방기jbugkorea
 
Import golang; struct microservice - Codemotion Rome 2015
Import golang; struct microservice - Codemotion Rome 2015Import golang; struct microservice - Codemotion Rome 2015
Import golang; struct microservice - Codemotion Rome 2015Giorgio Cefaro
 
공짜 경제에서 어떻게 돈을 버는가?(How to Make Money in Free Economy)
공짜 경제에서 어떻게 돈을 버는가?(How to Make Money in Free Economy)공짜 경제에서 어떻게 돈을 버는가?(How to Make Money in Free Economy)
공짜 경제에서 어떻게 돈을 버는가?(How to Make Money in Free Economy)Sangkyu Rho
 
왜 레진코믹스는 구글앱엔진을 선택했나
왜 레진코믹스는 구글앱엔진을 선택했나왜 레진코믹스는 구글앱엔진을 선택했나
왜 레진코믹스는 구글앱엔진을 선택했나소리 강
 
Programming skills 1부
Programming skills 1부Programming skills 1부
Programming skills 1부JiHyung Lee
 
XECon+PHPFest2014 발표자료 - 효율적인 css 개발방법 - 최대영
XECon+PHPFest2014 발표자료 - 효율적인 css 개발방법 - 최대영XECon+PHPFest2014 발표자료 - 효율적인 css 개발방법 - 최대영
XECon+PHPFest2014 발표자료 - 효율적인 css 개발방법 - 최대영XpressEngine
 
Front end 웹사이트 성능 측정 및 개선
Front end 웹사이트 성능 측정 및 개선Front end 웹사이트 성능 측정 및 개선
Front end 웹사이트 성능 측정 및 개선기동 이
 
객체지향 개념 (쫌 아는체 하기)
객체지향 개념 (쫌 아는체 하기)객체지향 개념 (쫌 아는체 하기)
객체지향 개념 (쫌 아는체 하기)Seung-June Lee
 
오늘 밤부터 쓰는 google analytics (구글 애널리틱스, GA)
오늘 밤부터 쓰는 google analytics (구글 애널리틱스, GA) 오늘 밤부터 쓰는 google analytics (구글 애널리틱스, GA)
오늘 밤부터 쓰는 google analytics (구글 애널리틱스, GA) Yongho Ha
 

Viewers also liked (14)

Practical Machine Learning
Practical Machine LearningPractical Machine Learning
Practical Machine Learning
 
[D2]java 성능에 대한 오해와 편견
[D2]java 성능에 대한 오해와 편견[D2]java 성능에 대한 오해와 편견
[D2]java 성능에 대한 오해와 편견
 
20150526 오픈업 mcn의 미래_명승은
20150526 오픈업 mcn의 미래_명승은20150526 오픈업 mcn의 미래_명승은
20150526 오픈업 mcn의 미래_명승은
 
Advanced nGrinder 2nd Edition
Advanced nGrinder 2nd EditionAdvanced nGrinder 2nd Edition
Advanced nGrinder 2nd Edition
 
[오픈소스컨설팅]Java Performance Tuning
[오픈소스컨설팅]Java Performance Tuning[오픈소스컨설팅]Java Performance Tuning
[오픈소스컨설팅]Java Performance Tuning
 
Micro Service Architecture 탐방기
Micro Service Architecture 탐방기Micro Service Architecture 탐방기
Micro Service Architecture 탐방기
 
Import golang; struct microservice - Codemotion Rome 2015
Import golang; struct microservice - Codemotion Rome 2015Import golang; struct microservice - Codemotion Rome 2015
Import golang; struct microservice - Codemotion Rome 2015
 
공짜 경제에서 어떻게 돈을 버는가?(How to Make Money in Free Economy)
공짜 경제에서 어떻게 돈을 버는가?(How to Make Money in Free Economy)공짜 경제에서 어떻게 돈을 버는가?(How to Make Money in Free Economy)
공짜 경제에서 어떻게 돈을 버는가?(How to Make Money in Free Economy)
 
왜 레진코믹스는 구글앱엔진을 선택했나
왜 레진코믹스는 구글앱엔진을 선택했나왜 레진코믹스는 구글앱엔진을 선택했나
왜 레진코믹스는 구글앱엔진을 선택했나
 
Programming skills 1부
Programming skills 1부Programming skills 1부
Programming skills 1부
 
XECon+PHPFest2014 발표자료 - 효율적인 css 개발방법 - 최대영
XECon+PHPFest2014 발표자료 - 효율적인 css 개발방법 - 최대영XECon+PHPFest2014 발표자료 - 효율적인 css 개발방법 - 최대영
XECon+PHPFest2014 발표자료 - 효율적인 css 개발방법 - 최대영
 
Front end 웹사이트 성능 측정 및 개선
Front end 웹사이트 성능 측정 및 개선Front end 웹사이트 성능 측정 및 개선
Front end 웹사이트 성능 측정 및 개선
 
객체지향 개념 (쫌 아는체 하기)
객체지향 개념 (쫌 아는체 하기)객체지향 개념 (쫌 아는체 하기)
객체지향 개념 (쫌 아는체 하기)
 
오늘 밤부터 쓰는 google analytics (구글 애널리틱스, GA)
오늘 밤부터 쓰는 google analytics (구글 애널리틱스, GA) 오늘 밤부터 쓰는 google analytics (구글 애널리틱스, GA)
오늘 밤부터 쓰는 google analytics (구글 애널리틱스, GA)
 

Similar to Serialization and performance in Java

Сергей Моренец. Serialization and performance in Java
Сергей Моренец. Serialization and performance in JavaСергей Моренец. Serialization and performance in Java
Сергей Моренец. Serialization and performance in JavaVolha Banadyseva
 
Serialization and performance by Sergey Morenets
Serialization and performance by Sergey MorenetsSerialization and performance by Sergey Morenets
Serialization and performance by Sergey MorenetsAlex Tumanoff
 
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para TiGustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para TiSoftware Guru
 
OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6glassfish
 
CQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java DevelopersCQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java DevelopersMarkus Eisele
 
node.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoonnode.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang YoonJesang Yoon
 
Java EE 7 Soup to Nuts at JavaOne 2014
Java EE 7 Soup to Nuts at JavaOne 2014Java EE 7 Soup to Nuts at JavaOne 2014
Java EE 7 Soup to Nuts at JavaOne 2014Arun Gupta
 
Grails 3.0 Preview
Grails 3.0 PreviewGrails 3.0 Preview
Grails 3.0 Previewgraemerocher
 
Алексей Швайка "Bundling: you are doing it wrong"
Алексей Швайка "Bundling: you are doing it wrong"Алексей Швайка "Bundling: you are doing it wrong"
Алексей Швайка "Bundling: you are doing it wrong"Fwdays
 
GemStone/64 product update and road map
GemStone/64 product update and road mapGemStone/64 product update and road map
GemStone/64 product update and road mapESUG
 
MySQL 5.6 - Operations and Diagnostics Improvements
MySQL 5.6 - Operations and Diagnostics ImprovementsMySQL 5.6 - Operations and Diagnostics Improvements
MySQL 5.6 - Operations and Diagnostics ImprovementsMorgan Tocker
 
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
 
Expertezed 2012 Webcast - XML DB Use Cases
Expertezed 2012 Webcast - XML DB Use CasesExpertezed 2012 Webcast - XML DB Use Cases
Expertezed 2012 Webcast - XML DB Use CasesMarco Gralike
 
Whats new in Java 9,10,11,12
Whats new in Java 9,10,11,12Whats new in Java 9,10,11,12
Whats new in Java 9,10,11,12Rory Preddy
 
Zero to 1 Billion+ Records: A True Story of Learning & Scaling GameChanger
Zero to 1 Billion+ Records: A True Story of Learning & Scaling GameChangerZero to 1 Billion+ Records: A True Story of Learning & Scaling GameChanger
Zero to 1 Billion+ Records: A True Story of Learning & Scaling GameChangerMongoDB
 

Similar to Serialization and performance in Java (20)

Сергей Моренец. Serialization and performance in Java
Сергей Моренец. Serialization and performance in JavaСергей Моренец. Serialization and performance in Java
Сергей Моренец. Serialization and performance in Java
 
Serialization and performance by Sergey Morenets
Serialization and performance by Sergey MorenetsSerialization and performance by Sergey Morenets
Serialization and performance by Sergey Morenets
 
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para TiGustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
 
JavaOne_2010
JavaOne_2010JavaOne_2010
JavaOne_2010
 
OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6
 
De Java 8 ate Java 14
De Java 8 ate Java 14De Java 8 ate Java 14
De Java 8 ate Java 14
 
CQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java DevelopersCQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java Developers
 
De Java 8 a Java 11 y 14
De Java 8 a Java 11 y 14De Java 8 a Java 11 y 14
De Java 8 a Java 11 y 14
 
node.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoonnode.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoon
 
Java EE 7 Soup to Nuts at JavaOne 2014
Java EE 7 Soup to Nuts at JavaOne 2014Java EE 7 Soup to Nuts at JavaOne 2014
Java EE 7 Soup to Nuts at JavaOne 2014
 
Grails 3.0 Preview
Grails 3.0 PreviewGrails 3.0 Preview
Grails 3.0 Preview
 
Алексей Швайка "Bundling: you are doing it wrong"
Алексей Швайка "Bundling: you are doing it wrong"Алексей Швайка "Bundling: you are doing it wrong"
Алексей Швайка "Bundling: you are doing it wrong"
 
GemStone/64 product update and road map
GemStone/64 product update and road mapGemStone/64 product update and road map
GemStone/64 product update and road map
 
DOTNET8.pptx
DOTNET8.pptxDOTNET8.pptx
DOTNET8.pptx
 
Jakarta EE 8 on JDK17
Jakarta EE 8 on JDK17Jakarta EE 8 on JDK17
Jakarta EE 8 on JDK17
 
MySQL 5.6 - Operations and Diagnostics Improvements
MySQL 5.6 - Operations and Diagnostics ImprovementsMySQL 5.6 - Operations and Diagnostics Improvements
MySQL 5.6 - Operations and Diagnostics Improvements
 
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
 
Expertezed 2012 Webcast - XML DB Use Cases
Expertezed 2012 Webcast - XML DB Use CasesExpertezed 2012 Webcast - XML DB Use Cases
Expertezed 2012 Webcast - XML DB Use Cases
 
Whats new in Java 9,10,11,12
Whats new in Java 9,10,11,12Whats new in Java 9,10,11,12
Whats new in Java 9,10,11,12
 
Zero to 1 Billion+ Records: A True Story of Learning & Scaling GameChanger
Zero to 1 Billion+ Records: A True Story of Learning & Scaling GameChangerZero to 1 Billion+ Records: A True Story of Learning & Scaling GameChanger
Zero to 1 Billion+ Records: A True Story of Learning & Scaling GameChanger
 

More from Strannik_2013

Junior,middle,senior?
Junior,middle,senior?Junior,middle,senior?
Junior,middle,senior?Strannik_2013
 
JEEConf 2016. Effectiveness and code optimization in Java applications
JEEConf 2016. Effectiveness and code optimization in  Java applicationsJEEConf 2016. Effectiveness and code optimization in  Java applications
JEEConf 2016. Effectiveness and code optimization in Java applicationsStrannik_2013
 
Effectiveness and code optimization in Java
Effectiveness and code optimization in JavaEffectiveness and code optimization in Java
Effectiveness and code optimization in JavaStrannik_2013
 
Effective Java applications
Effective Java applicationsEffective Java applications
Effective Java applicationsStrannik_2013
 
Top 10 reasons to migrate to Gradle
Top 10 reasons to migrate to GradleTop 10 reasons to migrate to Gradle
Top 10 reasons to migrate to GradleStrannik_2013
 
Gradle 2.Breaking stereotypes
Gradle 2.Breaking stereotypesGradle 2.Breaking stereotypes
Gradle 2.Breaking stereotypesStrannik_2013
 
Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015Strannik_2013
 
Gradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhereGradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhereStrannik_2013
 
Java 8 in action.Jinq
Java 8 in action.JinqJava 8 in action.Jinq
Java 8 in action.JinqStrannik_2013
 
Spring Boot. Boot up your development
Spring Boot. Boot up your developmentSpring Boot. Boot up your development
Spring Boot. Boot up your developmentStrannik_2013
 
Spring.Boot up your development
Spring.Boot up your developmentSpring.Boot up your development
Spring.Boot up your developmentStrannik_2013
 
Gradle.Enemy at the gates
Gradle.Enemy at the gatesGradle.Enemy at the gates
Gradle.Enemy at the gatesStrannik_2013
 
Getting ready to java 8
Getting ready to java 8Getting ready to java 8
Getting ready to java 8Strannik_2013
 
JSF 2: Myth of panacea? Magic world of user interfaces
JSF 2: Myth of panacea? Magic world of user interfacesJSF 2: Myth of panacea? Magic world of user interfaces
JSF 2: Myth of panacea? Magic world of user interfacesStrannik_2013
 
Git.From thorns to the stars
Git.From thorns to the starsGit.From thorns to the stars
Git.From thorns to the starsStrannik_2013
 
Spring Web flow. A little flow of happiness
Spring Web flow. A little flow of happinessSpring Web flow. A little flow of happiness
Spring Web flow. A little flow of happinessStrannik_2013
 

More from Strannik_2013 (16)

Junior,middle,senior?
Junior,middle,senior?Junior,middle,senior?
Junior,middle,senior?
 
JEEConf 2016. Effectiveness and code optimization in Java applications
JEEConf 2016. Effectiveness and code optimization in  Java applicationsJEEConf 2016. Effectiveness and code optimization in  Java applications
JEEConf 2016. Effectiveness and code optimization in Java applications
 
Effectiveness and code optimization in Java
Effectiveness and code optimization in JavaEffectiveness and code optimization in Java
Effectiveness and code optimization in Java
 
Effective Java applications
Effective Java applicationsEffective Java applications
Effective Java applications
 
Top 10 reasons to migrate to Gradle
Top 10 reasons to migrate to GradleTop 10 reasons to migrate to Gradle
Top 10 reasons to migrate to Gradle
 
Gradle 2.Breaking stereotypes
Gradle 2.Breaking stereotypesGradle 2.Breaking stereotypes
Gradle 2.Breaking stereotypes
 
Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015
 
Gradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhereGradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhere
 
Java 8 in action.Jinq
Java 8 in action.JinqJava 8 in action.Jinq
Java 8 in action.Jinq
 
Spring Boot. Boot up your development
Spring Boot. Boot up your developmentSpring Boot. Boot up your development
Spring Boot. Boot up your development
 
Spring.Boot up your development
Spring.Boot up your developmentSpring.Boot up your development
Spring.Boot up your development
 
Gradle.Enemy at the gates
Gradle.Enemy at the gatesGradle.Enemy at the gates
Gradle.Enemy at the gates
 
Getting ready to java 8
Getting ready to java 8Getting ready to java 8
Getting ready to java 8
 
JSF 2: Myth of panacea? Magic world of user interfaces
JSF 2: Myth of panacea? Magic world of user interfacesJSF 2: Myth of panacea? Magic world of user interfaces
JSF 2: Myth of panacea? Magic world of user interfaces
 
Git.From thorns to the stars
Git.From thorns to the starsGit.From thorns to the stars
Git.From thorns to the stars
 
Spring Web flow. A little flow of happiness
Spring Web flow. A little flow of happinessSpring Web flow. A little flow of happiness
Spring Web flow. A little flow of happiness
 

Recently uploaded

Top 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTop 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTopCSSGallery
 
Novo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNovo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNeo4j
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3DianaGray10
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.IPLOOK Networks
 
Automation Ops Series: Session 2 - Governance for UiPath projects
Automation Ops Series: Session 2 - Governance for UiPath projectsAutomation Ops Series: Session 2 - Governance for UiPath projects
Automation Ops Series: Session 2 - Governance for UiPath projectsDianaGray10
 
Flow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First FrameFlow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First FrameKapil Thakar
 
Technical SEO for Improved Accessibility WTS FEST
Technical SEO for Improved Accessibility  WTS FESTTechnical SEO for Improved Accessibility  WTS FEST
Technical SEO for Improved Accessibility WTS FESTBillieHyde
 
AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024Brian Pichman
 
20140402 - Smart house demo kit
20140402 - Smart house demo kit20140402 - Smart house demo kit
20140402 - Smart house demo kitJamie (Taka) Wang
 
2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdfThe Good Food Institute
 
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox
 
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechWebinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechProduct School
 
Patch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updatePatch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updateadam112203
 
.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptxHansamali Gamage
 
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Alkin Tezuysal
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)codyslingerland1
 
TrustArc Webinar - How to Live in a Post Third-Party Cookie World
TrustArc Webinar - How to Live in a Post Third-Party Cookie WorldTrustArc Webinar - How to Live in a Post Third-Party Cookie World
TrustArc Webinar - How to Live in a Post Third-Party Cookie WorldTrustArc
 
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfQ4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfTejal81
 
Extra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfExtra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfInfopole1
 

Recently uploaded (20)

Top 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTop 10 Squarespace Development Companies
Top 10 Squarespace Development Companies
 
Novo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNovo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4j
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.
 
Automation Ops Series: Session 2 - Governance for UiPath projects
Automation Ops Series: Session 2 - Governance for UiPath projectsAutomation Ops Series: Session 2 - Governance for UiPath projects
Automation Ops Series: Session 2 - Governance for UiPath projects
 
Flow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First FrameFlow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First Frame
 
Technical SEO for Improved Accessibility WTS FEST
Technical SEO for Improved Accessibility  WTS FESTTechnical SEO for Improved Accessibility  WTS FEST
Technical SEO for Improved Accessibility WTS FEST
 
AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024
 
20140402 - Smart house demo kit
20140402 - Smart house demo kit20140402 - Smart house demo kit
20140402 - Smart house demo kit
 
2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf
 
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
 
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechWebinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
 
Patch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updatePatch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 update
 
.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx
 
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)
 
TrustArc Webinar - How to Live in a Post Third-Party Cookie World
TrustArc Webinar - How to Live in a Post Third-Party Cookie WorldTrustArc Webinar - How to Live in a Post Third-Party Cookie World
TrustArc Webinar - How to Live in a Post Third-Party Cookie World
 
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfQ4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
 
Extra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfExtra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdf
 

Serialization and performance in Java

  • 2. About author Works in IT since 2000 10 year of Java SE/EE experience Occupied senior Java developer/Team Lead positions Winner of 2013 JBoss Community Recognition Award. https://www.jboss.org/jbcra
  • 3. Agenda • Purpose of serialization • Frameworks overview • Performance testing • Q & A
  • 7. Performance • Native memory copying using C operations • “Unsafe” operations • Ignore object introspection • Direct object-object copying
  • 8. Java serialization • The easiest programming effort • Out-of-the-box functionality
  • 9. Java serialization • Serializable interface • Decreases the flexibility to change a class’s implementation once it has been released • Doesn’t allow to exchange data with C++/Python applications • Due to default constructors hole for invariant corruption and illegal access • No customization • You should have access to the source code No customization You should have access to the source code
  • 10. Java externalization • Serialization but by implementing Externalizable interface to persist and restore the object • Responsibility of the class to save and restore the contents of its instances • Requires modifications in marshalling/unmarshalling code if the class contents changed No customization You should have access to the source code
  • 12. Avro • Schema evolution • Binary and JSON encoding • Dynamic typing • Support of Java, C, C++, C# and Python • Apache Hadoop integration
  • 13. Avro
  • 14. Avro
  • 15. XML • Interchangeable format • Supported schemas • Space intensive and huge performance loss • Complex navigating
  • 16. Simple • High performance XML serialization and configuration framework for Java. • Requires absolutely no configuration • Can handle cycles in the object graph
  • 18. Javolution • Fast real-time library for safety-critical applications • Based on OSGi context • Parallel computing support
  • 20. Json-io • Doesn’t require custom interfaces/attributes usage/source code • Handles cyclic references • Reader/writer customization • Does not depend on any native or 3rd party libraries.
  • 21. Google gson • Java library to convert JSON to Java objects and vice-versa • Doesn’t require source code of serialized objects • Allow custom representatives
  • 23. Jackson • High-performance, ergonomic JSON processor Java library • Extensive customization tools • Mix-in annotations • Materialized interfaces • Multiple data formats
  • 24. Jackson • JSON • CSV • Smile(binary JSON) • XML • YAML(similar to JSON)
  • 25. BSON for Jackson • Binary encoded JSON • Main data exchange format for MongoDB • Allows writing custom extensions
  • 26. Protocol buffers • Way of encoding structured data in an efficient yet extensible format. • Google uses Protocol Buffers for almost all of its internal RPC protocols and file formats. • Supported in Java, C++, Python
  • 27. Protocol buffers message User { required string login = 1; repeated Order orders = 2; } message Order { required int32 id = 1; optional string date = 2; }
  • 29. FST • Java-to-java library • No support for versioning • Use case is high performance message oriented software • Drop-in replacement • Custom optimization using annotations, custom serializers
  • 30. FST
  • 31. GridGain • Part of distributed computing system • Don’t require any custom interfaces or API • Direct memory copying by invoking native "unsafe" operations • Predefined fields introspection
  • 33. Kryo • Fast and efficient object graph serialization framework for Java • Open source project on Google code • Automatic deep and shallow copying/cloning • Doesn’t put requirements on the source classes (in most cases)
  • 34. Kryo • Twitter • Apache Hive • Akka • Storm • S4
  • 35. Kryo
  • 36. Kryo
  • 37. Benchmark • JDK 1.8.0.5 • Apache Avro 1.7.6 • Simple 2.7.1 • Json-io 2.5.2 • Google GSON 2.2.4 • Jackson 2.3.2 • BSON for Jackson 2.3.1 • Protocol buffers 2.5 • Kryo 2.23 • FST 1.54 • GridGain 6.0.2
  • 38. Benchmark • Speed(serialization and deserialization) • Size(complex and ordinary objects) • Flexibility
  • 41. Issues Library Description Gson, Jackson Crashed when serializing cyclic dependency Simple Crashed for very big XML file Avro Bug during deserialization
  • 42. Serialization (complex) # Library Time(ms) 1 Kryo(optimized) 134 2 Protocol buffers 165 3 GridGain 196 4 FST 207 5 Kryo 209 6 Jackson(smile) 275 7 Kryo(unsafe) 306 8 Jackson 491 9 Java serialization 605 10 Javolution 1043
  • 43. Serialization (simple) # Library Time(ms) 1 Protocol buffers <1 2 Google GSON 5 3 Java serialization 10 4 BSON for Jackson 10 5 Jackson(smile) 11 6 Kryo(optimized) 17 7 Kryo 18 8 Jackson 18 9 Kryo(unsafe) 20 10 Javolution 21
  • 44. Deserialization (complex) # Library Time(ms) 1 Kryo(optimized) 113 2 Protocol buffers 165 3 GridGain 196 4 FST 207 5 Kryo 209 6 Jackson(smile) 275 7 Kryo(unsafe) 306 8 Jackson 491 9 Java serialization 605 10 BSON for Jackson 930
  • 45. Deserialization (simple) # Library Time(ms) 1 Protocol buffers 1 2 GridGain 3 3 Google GSON 6 4 Jackson(smile) 9 5 BSON for Jackson 9 6 Kryo(optimized) 18 7 Kryo 18 8 Jackson 18 9 Kryo(unsafe) 20 10 FST 42
  • 46. Size (complex) # Library Size(bytes) 1 Kryo(optimized) 33904 2 FST 34069 3 Kryo 35674 4 Protocol buffers 39517 5 Kryo(unsafe) 40554 6 Jackson(smile) 44840 7 Java serialization 49757 8 GridGain 58288 9 Jackson 67858 10 Google GSON 68338
  • 47. Size (simple) # Library Size(bytes) 1 Kryo(optimized) 18 2 Kryo 18 3 Protocol buffers 20 4 Kryo(unsafe) 21 5 GridGain 33 6 Jackson(smile) 40 7 Jackson 41 8 Google GSON 41 9 Jackson(YAML) 41 10 BSON for Jackson 46
  • 48. Usability # Library 1 Google GSON 2 Kryo 2 Kryo(unsafe) 3 Jackson 3 Jackson(XML, Smile, YAML) 3 BSON for Jackson 4 Json-io 5 FST 6 Java serialization 7 Kryo(optimized)
  • 49. Overall rating (2014) # Library Rating 1 Kryo(optimized) 67 2 Protocol buffers 65 3 Kryo 58 4 Jackson(smile) 55 5 Kryo(unsafe) 46 6 GridGain 44 7 Google GSON 43 8 FST 43 9 Jackson 40 10 BSON for Jackson 33 11 Java serialization 32
  • 50. Overall rating (2013) # Library Rating 1 Kryo(optimized) 67 2 Kryo(unsafe) 65 3 Protocol buffers 63 4 Kryo 59 5 Jackson(smile) 51 6 Google GSON 45 7 FST 42 8 GridGain 34 9 Jackson 32 10 Java serialization 30 11 BSON for Jackson 24
  • 51. Advices Library Usage Kryo Fast and compact serializer for complex objects over network Protocol buffers Fast serializer for simple objects Jackson(smile) Jackson-based serializer for Web usage Google JSON Dirty solution to quickly serialize/deserialize objects Apache Avro Serialize objects into files with possible schema changes Java Out-of-the-box trusted solution without additional libraries