Konik performance measurements

23 April 2014

Starting with the latest release we are going to publish benchmark results of the Konik library. Our objective is to create and maintain a library that is scalable enough to process many hundreds of PDFs per second. Initially we start small by benchmarking ITextPdfInvoiceAppender.

For an brief overview the ITextAppenderBenchmark is performing the following steps.

  • Reading a sample PDF from disk

  • Marshalling the invoice model to XML

  • Appending the generated XML to PDF

  • Reading existing XMP content from the PDF

  • Changing the XMP content to add ZUGFeRD information

  • Overwriting the XMP content of the PDF with the modified XMP version

  • Writing the final PDF to output stream or byte array

Benchmark interpretation

The benchmarks mode is set to measure operation throughput per second (ops/s)

Benchmark setup

20 samples were taken after a JVM warm up phase of 20 iterations.

Hardware information

The benchmarks were performed on a MacBookAir4,2 having a 1.8 GHz Intel Core i7 CPU.

Benchmark                                                              Mode   Threads   Samples       Mean     Units
i.k.b.ITextPdfInvoiceAppenderBenchmark.append_witStreams              thrpt         1        20      27,16     ops/s
i.k.b.ITextPdfInvoiceAppenderBenchmark.append_witStreamsAndThreads    thrpt         4        20      38,25     ops/s
i.k.b.ITextPdfInvoiceAppenderBenchmark.append_withByteArray           thrpt         1        20      26,88     ops/s

The following benchmark is equal to the one above, except that the code under test does not read, modify or appends XMP content to the PDF. Results of this benchmark represent the state of the iText-Carriage prior version 0.2.0.

Benchmark                                                              Mode   Threads   Samples       Mean     Units
i.k.b.ITextPdfInvoiceAppenderBenchmark.append_witStreams              thrpt         1        20      27,97     ops/s
i.k.b.ITextPdfInvoiceAppenderBenchmark.append_witStreamsAndThreads    thrpt         4	     20      39,32     ops/s
i.k.b.ITextPdfInvoiceAppenderBenchmark.append_withByteArray           thrpt         1	     20      29,30     ops/s

Finally we also benchmarked, the throughput of the XMP Appender which parses, modifies builds XMP content.

Benchmark                                                              Mode   Threads   Samples       Mean     Units
i.k.b.XmpAppenderBenchmark.append_reuseAppender                       thrpt         1        20     656,90     ops/s
i.k.b.XmpAppenderBenchmark.append_reuseAppenderWithThreads            thrpt         4        20    1203,26     ops/s
i.k.b.XmpAppenderBenchmark.append_withNewAppender                     thrpt         1        20     439,76     ops/s

Conclusion

Good news is that there was no performance drop when going from release 0.1.0 to 0.2.0. On the other hand Konik and iText are able to process almost 40 PDFs per second on a 2011 MacBook Air. This is not a bad number but it now needs attention to not become slower when more features are added. Possible performance improvements can be achieved by parallelizing the invoice marshalling and XMP creation. This improvements should hopefully get us close to the 50 PDFs per second.

More benchmark results can be obtained from the {http://ci.konik.io/view/All/job/benchmarks/}[Konik CI Server] performing nightly benchmark tests of the library.

Weiterer Beiträge zum Thema Konik performance measurements