JFleet is a Java library which persist in database large collections of Java POJOs as fast as possible, using the best available technique in each database provider, achieving it with alternate persistence methods from each JDBC driver implementation.
Its goal is to store a large amount of information in a single table using available batch persistence techniques.
JFleet Benchmark is a project which tries to measure the efficiency of JFleet comparing with different persistence techniques:
- Using JPA with Hibernate implementation
- Using JDBC driver directly
- After a database dump, using the associated import command
JFleet performance is comparable to using the native database import tool, and is between 2.1X and 3.8X faster than using the JDBC driver directly.
The selected dataset is a public dataset provided by Citi Bike NYC about each trip with their bikes.
The dataset can be downloaded from: https://s3.amazonaws.com/tripdata/index.html, and the selected range of files are the whole 2016 year, with 457 MB of compressed CSVs files (2478 MB uncompressed). There are 13,845,655 rows in the dataset with an average size of 180 bytes per record.
Depending on the database engine, the total space used in database is around 2500 MB, using an average of 110 bytes per record.
Each record contains a mix of data types:
- 4 Integer
- 4 Doubles
- 3 Strings
- 2 Dates
- 1 Long
- 1 Char
All test has been executed under Google Cloud Platform using Cloud SQL fully-managed database service.
Both databases has the same hardware configuration, and no change has been done in their default setup provided by Google Cloud.
The client was located in the same zone as the servers with the following configuration:
The Java runtime used was JDK 8u161.
The benchmark only tries to measure the efficiency of JFleet comparing with different persistence techniques, and is not a comparasion between database engines.
The benchmark is not executed in a production like environment and only executes inserts, without any other type of concurrent access or queries which can affect to the database performance. Results can not be used as a reference for your production system, and you must execute yours to evaluate the convenience of JFleet.
- The benchmark measures the total time in seconds spent from the first byte read from dataset, to the last commit
- A commit is executed after each batch operation
- 13,845,655 rows are inserted in each benchmark execution
- Each test is executed 10 times
- The best and the worst results are discarded
- Charts represent rows per second (more is better)
Iteration | 500 Rows | 1000 Rows | 5000 Rows | 10000 Rows |
---|---|---|---|---|
1 | 922 | 889 | 885 | |
2 | 949 | 845 | 871 | |
3 | 959 | 899 | 838 | 876 |
4 | 959 | 887 | 828 | 864 |
5 | 935 | 881 | 830 | |
6 | 943 | 879 | 856 | |
7 | 925 | 874 | 813 | |
8 | 880 | 829 | 869 | |
9 | 937 | 840 | 870 | |
10 | 902 | 841 | 882 | |
Avg. Sec. | 941 | 886 | 833 | 872 |
Avg. row/sec | 14,712 | 15,621 | 16,621 | 15,885 |
Iteration | 500 Rows | 1000 Rows | 5000 Rows | 10000 Rows |
---|---|---|---|---|
1 | 583 | |||
2 | 652 | 579 | 555 | 565 |
3 | 660 | 571 | 555 | 566 |
4 | 650 | 581 | 557 | 566 |
5 | 577 | 554 | 570 | |
6 | 638 | 551 | 564 | |
7 | 656 | 567 | 582 | |
8 | 660 | 589 | 586 | |
9 | 662 | 590 | 567 | 583 |
10 | 654 | 585 | 565 | |
Avg. Sec. | 654 | 582 | 559 | 573 |
Avg. row/sec | 21,171 | 23,795 | 24,774 | 24,174 |
The selected mysqldump
format is tab-separated text which is more performant than the standard with INSERT sentences.
Iteration | 1 Import |
---|---|
1 | |
2 | 174 |
3 | 146 |
4 | 141 |
5 | 136 |
6 | 137 |
7 | 136 |
8 | |
9 | 138 |
10 | 135 |
Avg. Sec. | 143 |
Avg. row/sec | 96,907 |
Iteration | 1 MB | 2 MB | 4 MB | 8 MB | 16 MB | 32 MB | 64 MB |
---|---|---|---|---|---|---|---|
1 | |||||||
2 | 154 | 158 | 159 | 159 | 163 | 177 | |
3 | 166 | 157 | 152 | 178 | |||
4 | 164 | 155 | 155 | 153 | 163 | 174 | |
5 | 165 | 151 | 143 | 147 | 149 | 154 | 174 |
6 | 163 | 160 | 148 | 149 | 155 | 171 | |
7 | 163 | 153 | 152 | 154 | 157 | 155 | 182 |
8 | 165 | 152 | 145 | 148 | 152 | 159 | 180 |
9 | 168 | 154 | 143 | 149 | 151 | 162 | |
10 | 166 | 150 | 151 | 152 | 155 | 149 | 180 |
Avg. Sec. | 165 | 154 | 149 | 152 | 153 | 158 | 177 |
Avg. row/sec | 83,913 | 90,126 | 92,691 | 90,866 | 90,494 | 87,909 | 78,224 |
Best Time | Best row/sec | |
---|---|---|
JPA Batch Insert | 833 | 16,621 |
JDBC Batch Insert | 559 | 24,774 |
DB Import | 143 | 96,907 |
JFleet Bulk Insert | 149 | 92,691 |
Iteration | 500 Rows | 1000 Rows | 5000 Rows | 10000 Rows |
---|---|---|---|---|
1 | 548 | 535 | 570 | 533 |
2 | 548 | |||
3 | 565 | 538 | 579 | 536 |
4 | 522 | 576 | 522 | |
5 | 551 | 534 | 562 | 536 |
6 | 533 | 497 | 554 | 537 |
7 | 523 | 507 | 563 | 532 |
8 | 529 | 503 | 551 | |
9 | 517 | 497 | 545 | |
10 | 556 | 518 | ||
Avg. Sec. | 539 | 517 | 564 | 532 |
Avg. row/sec | 25,676 | 26,800 | 24,554 | 26,007 |
Iteration | 500 Rows | 1000 Rows | 5000 Rows | 10000 Rows |
---|---|---|---|---|
1 | 363 | 317 | 337 | |
2 | ||||
3 | 353 | 316 | 320 | 337 |
4 | 355 | 318 | 322 | 340 |
5 | 359 | 325 | 325 | 344 |
6 | 355 | 324 | 324 | 335 |
7 | 316 | 319 | 331 | |
8 | 350 | 322 | 336 | |
9 | 350 | 316 | 316 | |
10 | 355 | 319 | 323 | 345 |
Avg. Sec. | 355 | 319 | 321 | 338 |
Avg. row/sec | 39,002 | 43,420 | 43,083 | 40,948 |
Iteration | 1 Import |
---|---|
1 | |
2 | 155 |
3 | 155 |
4 | 155 |
5 | 155 |
6 | |
7 | 155 |
8 | 155 |
9 | 156 |
10 | 156 |
Avg. Sec. | 155 |
Avg. row/sec | 89,183 |
Iteration | 1 MB | 2 MB | 4 MB | 8 MB | 16 MB | 32 MB | 64 MB |
---|---|---|---|---|---|---|---|
1 | 148 | 153 | |||||
2 | 163 | 156 | 152 | 153 | 149 | 155 | 168 |
3 | 167 | ||||||
4 | 166 | 163 | 156 | 153 | 152 | 158 | 168 |
5 | 166 | 165 | 159 | 154 | 152 | 166 | |
6 | 167 | 164 | 157 | 154 | 149 | 155 | 169 |
7 | 165 | 159 | 152 | 150 | 149 | 158 | 165 |
8 | 163 | 159 | 153 | 152 | 152 | 166 | |
9 | 158 | 161 | 156 | 147 | 147 | 164 | |
10 | 156 | 161 | 154 | 150 | 150 | 155 | 165 |
Avg. Sec. | 163 | 161 | 156 | 152 | 150 | 155 | 166 |
Avg. row/sec | 84,878 | 85,931 | 88,968 | 90,940 | 92,458 | 89,471 | 83,220 |
Best Time | Best row/sec | |
---|---|---|
JPA Batch Insert | 517 | 26,800 |
JDBC Batch Insert | 319 | 43,420 |
DB Import | 155 | 89,183 |
JFleet Bulk Insert | 150 | 92,458 |