Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-3088

Cache glyph table to optimize concurrent access

    XMLWordPrintableJSON

Details

    • Patch

    Description

      If several threads convert several pdf to png (one thread access to a single document at a time) they are a contention on a lock in GlythTable. Jstack shows that all threads are in state blocked on the synchronized block in the getGlyph method. The lock is necessary, it's ok, but degrades performance.

      This patch cache glyphs already read.
      With the patch PDFBOX-3080, the follow benchmark compare 1000 pdf conversions with 1, 8, and 50 threads.

      Simulation PDF 2.0-SNAPSHOT With this patch + PDFBOX3080
      1000 conversions / 1 thread 120 s 71 s
      1000 conversions / 8 threads 76 s 28 s
      1000 conversions / 50 threads 81 s 33 s

      Attachments

        1. 0001-PDFBOX-3088-cache-glyph-table.patch
          1 kB
          ccouturi
        2. Benchmark.java
          2 kB
          ccouturi
        3. BenchmarkPDFBox3088.java
          2 kB
          Tilman Hausherr
        4. PDFBOX-3088.xlsx
          42 kB
          Tilman Hausherr
        5. PDFBOX-3088-2.xlsx
          34 kB
          Tilman Hausherr
        6. test_medium.pdf
          54 kB
          ccouturi

        Issue Links

          Activity

            People

              tilman Tilman Hausherr
              ccouturi ccouturi
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: