SlideShare a Scribd company logo
1 of 52
Serialization and
performance
Сергей Моренец
17 мая 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
Difference
• Source code changes
• Schemas
• Optimization & customization
• Interoperability
• Intermediate format
Java serialization
• Serializable interface
• The easiest programming effort
• Out-of-the-box functionality
Java serialization
• 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.
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
• Focus on speed, size and compatibility
• 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

Similar to Сергей Моренец. Serialization and performance in Java

Serialization and performance in Java
Serialization and performance in JavaSerialization and performance in Java
Serialization and performance in JavaStrannik_2013
 
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
 
Алексей Швайка "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
 
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
 
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
 
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
 
Cassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
Cassandra Community Webinar: From Mongo to Cassandra, Architectural LessonsCassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
Cassandra Community Webinar: From Mongo to Cassandra, Architectural LessonsDataStax
 
Denodo Partner Connect: Technical Webinar - Ask Me Anything
Denodo Partner Connect: Technical Webinar - Ask Me AnythingDenodo Partner Connect: Technical Webinar - Ask Me Anything
Denodo Partner Connect: Technical Webinar - Ask Me AnythingDenodo
 
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
 
Django è pronto per l'Enterprise
Django è pronto per l'EnterpriseDjango è pronto per l'Enterprise
Django è pronto per l'EnterprisePyCon Italia
 
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
 
How to generate customized java 8 code from your database
How to generate customized java 8 code from your databaseHow to generate customized java 8 code from your database
How to generate customized java 8 code from your databaseSpeedment, Inc.
 
Silicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your databaseSilicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your databaseSpeedment, Inc.
 
JavaScript Build System Battle Royale | PrDC 2017
JavaScript Build System Battle Royale | PrDC 2017JavaScript Build System Battle Royale | PrDC 2017
JavaScript Build System Battle Royale | PrDC 2017David Wesst
 

Similar to Сергей Моренец. Serialization and performance in Java (20)

Serialization and performance in Java
Serialization and performance in JavaSerialization 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
 
OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6
 
Алексей Швайка "Bundling: you are doing it wrong"
Алексей Швайка "Bundling: you are doing it wrong"Алексей Швайка "Bundling: you are doing it wrong"
Алексей Швайка "Bundling: you are doing it wrong"
 
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
 
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
 
Java9to19Final.pptx
Java9to19Final.pptxJava9to19Final.pptx
Java9to19Final.pptx
 
De Java 8 ate Java 14
De Java 8 ate Java 14De Java 8 ate Java 14
De Java 8 ate Java 14
 
JavaOne_2010
JavaOne_2010JavaOne_2010
JavaOne_2010
 
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
 
Into The Box 2023 Keynote Day 1
Into The Box 2023 Keynote Day 1Into The Box 2023 Keynote Day 1
Into The Box 2023 Keynote Day 1
 
Cassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
Cassandra Community Webinar: From Mongo to Cassandra, Architectural LessonsCassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
Cassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
 
Denodo Partner Connect: Technical Webinar - Ask Me Anything
Denodo Partner Connect: Technical Webinar - Ask Me AnythingDenodo Partner Connect: Technical Webinar - Ask Me Anything
Denodo Partner Connect: Technical Webinar - Ask Me Anything
 
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
 
Django è pronto per l'Enterprise
Django è pronto per l'EnterpriseDjango è pronto per l'Enterprise
Django è pronto per l'Enterprise
 
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
 
How to generate customized java 8 code from your database
How to generate customized java 8 code from your databaseHow to generate customized java 8 code from your database
How to generate customized java 8 code from your database
 
Silicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your databaseSilicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your database
 
JavaScript Build System Battle Royale | PrDC 2017
JavaScript Build System Battle Royale | PrDC 2017JavaScript Build System Battle Royale | PrDC 2017
JavaScript Build System Battle Royale | PrDC 2017
 

More from Volha Banadyseva

Андрей Светлов. Aiohttp
Андрей Светлов. AiohttpАндрей Светлов. Aiohttp
Андрей Светлов. AiohttpVolha Banadyseva
 
Сергей Зефиров
Сергей ЗефировСергей Зефиров
Сергей ЗефировVolha Banadyseva
 
Валерий Прытков, декан факультета КСиС, БГУИР
Валерий Прытков, декан факультета КСиС, БГУИРВалерий Прытков, декан факультета КСиС, БГУИР
Валерий Прытков, декан факультета КСиС, БГУИРVolha Banadyseva
 
Елена Локтева, «Инфопарк»
Елена Локтева, «Инфопарк»Елена Локтева, «Инфопарк»
Елена Локтева, «Инфопарк»Volha Banadyseva
 
Татьяна Милова, директор института непрерывного образования БГУ
Татьяна Милова, директор института непрерывного образования БГУТатьяна Милова, директор института непрерывного образования БГУ
Татьяна Милова, директор института непрерывного образования БГУVolha Banadyseva
 
Trillhaas Goetz. Innovations in Google and Global Digital Trends
Trillhaas Goetz. Innovations in Google and Global Digital TrendsTrillhaas Goetz. Innovations in Google and Global Digital Trends
Trillhaas Goetz. Innovations in Google and Global Digital TrendsVolha Banadyseva
 
Александр Чекан. 28 правДИвых слайдов о белорусах в интернете
Александр Чекан. 28 правДИвых слайдов о белорусах в интернетеАлександр Чекан. 28 правДИвых слайдов о белорусах в интернете
Александр Чекан. 28 правДИвых слайдов о белорусах в интернетеVolha Banadyseva
 
Мастер-класс Ильи Красинского и Елены Столбовой. Жизнь до и после выхода в store
Мастер-класс Ильи Красинского и Елены Столбовой. Жизнь до и после выхода в storeМастер-класс Ильи Красинского и Елены Столбовой. Жизнь до и после выхода в store
Мастер-класс Ильи Красинского и Елены Столбовой. Жизнь до и после выхода в storeVolha Banadyseva
 
Бахрам Исмаилов. Продвижение мобильного приложение - оптимизация в App Store
Бахрам Исмаилов. Продвижение мобильного приложение - оптимизация в App StoreБахрам Исмаилов. Продвижение мобильного приложение - оптимизация в App Store
Бахрам Исмаилов. Продвижение мобильного приложение - оптимизация в App StoreVolha Banadyseva
 
Евгений Пальчевский. Что можно узнать из отзывов пользователей в мобильных ма...
Евгений Пальчевский. Что можно узнать из отзывов пользователей в мобильных ма...Евгений Пальчевский. Что можно узнать из отзывов пользователей в мобильных ма...
Евгений Пальчевский. Что можно узнать из отзывов пользователей в мобильных ма...Volha Banadyseva
 
Евгений Невгень. Оптимизация мета-данных приложения для App Store и Google Play
Евгений Невгень. Оптимизация мета-данных приложения для App Store и Google PlayЕвгений Невгень. Оптимизация мета-данных приложения для App Store и Google Play
Евгений Невгень. Оптимизация мета-данных приложения для App Store и Google PlayVolha Banadyseva
 
Евгений Козяк. Tips & Tricks мобильного прототипирования
Евгений Козяк. Tips & Tricks мобильного прототипированияЕвгений Козяк. Tips & Tricks мобильного прототипирования
Евгений Козяк. Tips & Tricks мобильного прототипированияVolha Banadyseva
 
Егор Белый. Модели успешной монетизации мобильных приложений
Егор Белый. Модели успешной монетизации мобильных приложенийЕгор Белый. Модели успешной монетизации мобильных приложений
Егор Белый. Модели успешной монетизации мобильных приложенийVolha Banadyseva
 
Станислав Пацкевич. Инструменты аналитики для мобильных платформ
Станислав Пацкевич. Инструменты аналитики для мобильных платформСтанислав Пацкевич. Инструменты аналитики для мобильных платформ
Станислав Пацкевич. Инструменты аналитики для мобильных платформVolha Banadyseva
 
Артём Азевич. Эффективные подходы к разработке приложений. Как найти своего п...
Артём Азевич. Эффективные подходы к разработке приложений. Как найти своего п...Артём Азевич. Эффективные подходы к разработке приложений. Как найти своего п...
Артём Азевич. Эффективные подходы к разработке приложений. Как найти своего п...Volha Banadyseva
 
Дина Сударева. Развитие игровой команды и ее самоорганизация. Роль менеджера ...
Дина Сударева. Развитие игровой команды и ее самоорганизация. Роль менеджера ...Дина Сударева. Развитие игровой команды и ее самоорганизация. Роль менеджера ...
Дина Сударева. Развитие игровой команды и ее самоорганизация. Роль менеджера ...Volha Banadyseva
 
Юлия Ерина. Augmented Reality Games: становление и развитие
Юлия Ерина. Augmented Reality Games: становление и развитиеЮлия Ерина. Augmented Reality Games: становление и развитие
Юлия Ерина. Augmented Reality Games: становление и развитиеVolha Banadyseva
 
Александр Дзюба. Знать игрока: плейтест на стадии прототипа и позже
Александр Дзюба. Знать игрока: плейтест на стадии прототипа и позжеАлександр Дзюба. Знать игрока: плейтест на стадии прототипа и позже
Александр Дзюба. Знать игрока: плейтест на стадии прототипа и позжеVolha Banadyseva
 

More from Volha Banadyseva (20)

Андрей Светлов. Aiohttp
Андрей Светлов. AiohttpАндрей Светлов. Aiohttp
Андрей Светлов. Aiohttp
 
Сергей Зефиров
Сергей ЗефировСергей Зефиров
Сергей Зефиров
 
Eugene Burmako
Eugene BurmakoEugene Burmako
Eugene Burmako
 
Heather Miller
Heather MillerHeather Miller
Heather Miller
 
Валерий Прытков, декан факультета КСиС, БГУИР
Валерий Прытков, декан факультета КСиС, БГУИРВалерий Прытков, декан факультета КСиС, БГУИР
Валерий Прытков, декан факультета КСиС, БГУИР
 
Елена Локтева, «Инфопарк»
Елена Локтева, «Инфопарк»Елена Локтева, «Инфопарк»
Елена Локтева, «Инфопарк»
 
Татьяна Милова, директор института непрерывного образования БГУ
Татьяна Милова, директор института непрерывного образования БГУТатьяна Милова, директор института непрерывного образования БГУ
Татьяна Милова, директор института непрерывного образования БГУ
 
Trillhaas Goetz. Innovations in Google and Global Digital Trends
Trillhaas Goetz. Innovations in Google and Global Digital TrendsTrillhaas Goetz. Innovations in Google and Global Digital Trends
Trillhaas Goetz. Innovations in Google and Global Digital Trends
 
Александр Чекан. 28 правДИвых слайдов о белорусах в интернете
Александр Чекан. 28 правДИвых слайдов о белорусах в интернетеАлександр Чекан. 28 правДИвых слайдов о белорусах в интернете
Александр Чекан. 28 правДИвых слайдов о белорусах в интернете
 
Мастер-класс Ильи Красинского и Елены Столбовой. Жизнь до и после выхода в store
Мастер-класс Ильи Красинского и Елены Столбовой. Жизнь до и после выхода в storeМастер-класс Ильи Красинского и Елены Столбовой. Жизнь до и после выхода в store
Мастер-класс Ильи Красинского и Елены Столбовой. Жизнь до и после выхода в store
 
Бахрам Исмаилов. Продвижение мобильного приложение - оптимизация в App Store
Бахрам Исмаилов. Продвижение мобильного приложение - оптимизация в App StoreБахрам Исмаилов. Продвижение мобильного приложение - оптимизация в App Store
Бахрам Исмаилов. Продвижение мобильного приложение - оптимизация в App Store
 
Евгений Пальчевский. Что можно узнать из отзывов пользователей в мобильных ма...
Евгений Пальчевский. Что можно узнать из отзывов пользователей в мобильных ма...Евгений Пальчевский. Что можно узнать из отзывов пользователей в мобильных ма...
Евгений Пальчевский. Что можно узнать из отзывов пользователей в мобильных ма...
 
Евгений Невгень. Оптимизация мета-данных приложения для App Store и Google Play
Евгений Невгень. Оптимизация мета-данных приложения для App Store и Google PlayЕвгений Невгень. Оптимизация мета-данных приложения для App Store и Google Play
Евгений Невгень. Оптимизация мета-данных приложения для App Store и Google Play
 
Евгений Козяк. Tips & Tricks мобильного прототипирования
Евгений Козяк. Tips & Tricks мобильного прототипированияЕвгений Козяк. Tips & Tricks мобильного прототипирования
Евгений Козяк. Tips & Tricks мобильного прототипирования
 
Егор Белый. Модели успешной монетизации мобильных приложений
Егор Белый. Модели успешной монетизации мобильных приложенийЕгор Белый. Модели успешной монетизации мобильных приложений
Егор Белый. Модели успешной монетизации мобильных приложений
 
Станислав Пацкевич. Инструменты аналитики для мобильных платформ
Станислав Пацкевич. Инструменты аналитики для мобильных платформСтанислав Пацкевич. Инструменты аналитики для мобильных платформ
Станислав Пацкевич. Инструменты аналитики для мобильных платформ
 
Артём Азевич. Эффективные подходы к разработке приложений. Как найти своего п...
Артём Азевич. Эффективные подходы к разработке приложений. Как найти своего п...Артём Азевич. Эффективные подходы к разработке приложений. Как найти своего п...
Артём Азевич. Эффективные подходы к разработке приложений. Как найти своего п...
 
Дина Сударева. Развитие игровой команды и ее самоорганизация. Роль менеджера ...
Дина Сударева. Развитие игровой команды и ее самоорганизация. Роль менеджера ...Дина Сударева. Развитие игровой команды и ее самоорганизация. Роль менеджера ...
Дина Сударева. Развитие игровой команды и ее самоорганизация. Роль менеджера ...
 
Юлия Ерина. Augmented Reality Games: становление и развитие
Юлия Ерина. Augmented Reality Games: становление и развитиеЮлия Ерина. Augmented Reality Games: становление и развитие
Юлия Ерина. Augmented Reality Games: становление и развитие
 
Александр Дзюба. Знать игрока: плейтест на стадии прототипа и позже
Александр Дзюба. Знать игрока: плейтест на стадии прототипа и позжеАлександр Дзюба. Знать игрока: плейтест на стадии прототипа и позже
Александр Дзюба. Знать игрока: плейтест на стадии прототипа и позже
 

Recently uploaded

KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 

Recently uploaded (20)

KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 

Сергей Моренец. 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. Difference • Source code changes • Schemas • Optimization & customization • Interoperability • Intermediate format
  • 8. Java serialization • Serializable interface • The easiest programming effort • Out-of-the-box functionality
  • 9. Java serialization • 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.
  • 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 • Focus on speed, size and compatibility • 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