[ 
https://issues.apache.org/jira/browse/FLINK-37435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17933714#comment-17933714
 ] 

Kurt Ostfeld commented on FLINK-37435:
--------------------------------------

https://github.com/kurtostfeld/kryo2vs5

I tried to recreate this in a smaller JMH benchmark project that would 
benchmark:
- Kryo 2 POJO serialization.
- Kryo 5 POJO serialization.
- Kryo 5 record serialization.

I copied the exact same POJO class/values used in the flink-benchmarks project 
PojoSerializationBenchmark.

I was surprised to see Kryo 5 outperform Kryo 2 serialization which is the 
opposite result of this ticket. I was surprisingly disappointed to see Kryo 5 
run faster with POJOs than with Java records.

Benchmark Mode Cnt Score Error Units
Benchmarks.readKryo2POJOBenchmark thrpt 25 2324.044 ± 70.502 ops/ms
Benchmarks.readKryo5POJOBenchmark thrpt 25 5092.535 ± 1005.264 ops/ms
Benchmarks.readKryo5RecordBenchmark thrpt 25 3751.761 ± 297.263 ops/ms
Benchmarks.writeAndReadKryo2POJOBenchmark thrpt 25 1238.067 ± 39.658 ops/ms
Benchmarks.writeAndReadKryo5POJOBenchmark thrpt 25 1657.562 ± 68.855 ops/ms
Benchmarks.writeAndReadKryo5RecordBenchmark thrpt 25 1336.220 ± 51.159 ops/ms
Benchmarks.writeKryo2POJOBenchmark thrpt 25 1880.612 ± 67.342 ops/ms
Benchmarks.writeKryo5POJOBenchmark thrpt 25 2555.140 ± 53.788 ops/ms
Benchmarks.writeKryo5RecordBenchmark thrpt 25 2108.293 ± 45.544 ops/ms

For reference, from the same laptop:

Benchmark Mode Cnt Score Error Units
PojoSerializationBenchmark.readAvro thrpt 30 1300.356 ± 35.052 ops/ms
PojoSerializationBenchmark.readKryo thrpt 30 455.560 ± 5.142 ops/ms
PojoSerializationBenchmark.readPojo thrpt 30 1533.772 ± 19.120 ops/ms
PojoSerializationBenchmark.writeAvro thrpt 30 1545.213 ± 48.611 ops/ms
PojoSerializationBenchmark.writeKryo thrpt 30 1642.791 ± 35.117 ops/ms
PojoSerializationBenchmark.writePojo thrpt 30 1558.851 ± 14.866 ops/ms

The PojoSerializationBenchmark is using Flink's serialization layer on top of 
Kryo, where the simpler benchmark is just using Kryo directly.

> Kryo related perf regression since March 5th
> --------------------------------------------
>
>                 Key: FLINK-37435
>                 URL: https://issues.apache.org/jira/browse/FLINK-37435
>             Project: Flink
>          Issue Type: Bug
>          Components: API / Type Serialization System, Benchmarks
>    Affects Versions: 2.0.0
>            Reporter: Zakelly Lan
>            Priority: Major
>         Attachments: image-2025-03-07-12-29-54-443.png, 
> profile-results-after.zip, profile-results-before.zip
>
>
> Seems a obvious regression across all java version.
> http://flink-speed.xyz/timeline/?exe=6%2C12%2C13&base=&ben=readKryo&env=3&revs=200&equid=off&quarts=on&extr=on
> http://flink-speed.xyz/timeline/?exe=6%2C12%2C13&base=&ben=serializerKryo&env=3&revs=200&equid=off&quarts=on&extr=on



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to