Hi,
the faster PNG encoder module in community is ready for people to try out: I’ve tested it with a number of demo layers,
seems to be working, so I though it was time to try out its performance (get the popcorn and have a seat).
The comparisons involve 3 PNG encoders:
- The JDK one, which it not tunable (it actually ignores our quality/compression indications)
and compresses everything to the fullest, delivering consistently the smallest PNG in
exchange for a very slow performance. - The native ImageIO one, which you can get only if you have properly installed ImageIO,
which honors the compression settings by altering the level of effort involved in encoding
a PNG image, delivering larger images but also providing better performance.
This is the encoder you cannot have on Windows 64 and OSX, since there is no native ImageIO for
those platforms - The new encoder, based on PNGJ, a open source, java based, low level PNG encoder,
coupled with high performance scanline extractors from yours truly, that efficiently feed
the image bytes into PNGJ
First I did a very silly test against topp:states, usual style, map size 780x330, using ab (apache bench) with 1 and 4 threads,
comparing the throughput and output size for a compression level of 25 (the default one in the WMS panel).
Results:
Threads JDK Native ImageIO PNGJ based
1 11.7 25.4 36.9
4 38.9 75.11 94.5
Size 39KB 55KB 45KB
Well, as you can see the improvement over JDK is very significant, but the one over
NativeIO is not to throw away either.
The output size is good news too, the new encoder manages to be faster than the CLib one
and yet provides a output size closer to the JDK one (which, as said, uses every possible effort
to have the smallest possible output).
Yet, this use case is a toy, the map is small, the vectors are simple.
So I’ve decided to try something bigger, the FOSS4G 2010 benchmark, the vector
map of the whole spain with roads, buildings, contour lines, labels.
I’ve collected the full results in this Google Spreadsheet:
https://docs.google.com/spreadsheet/ccc?key=0Aq3GF1EnUyHEdHVodEpjNHM0MVhEMlhPcmJHTTFCTWc&usp=sharing
Here is just the comparison chart:
Well, I’d say the speedup is again rather good compared to the plain JDK encoder, and not to throw
away compared to the ImageIO native encoder.
Again, I’ve reached for one of the output maps of the benchmark and compared sizes (this is a 904x764 image
with a dense set of countour lines, road network, some labels, some polygons):
- JDK → 338KB
- Native ImageIO → 509KB
- PNGJ based → 367KB
Again, close to the JDK size, yet faster than the native ImageIO encoder in speed.
Not too bad, if I may say! (Windows Server users, likely using 64 bits JVMs, should pop the champagne :-p )
I’ve added the module to the nightly build on the master branch, and if you are a developer,
you can load it by using the -Ppng profile with your maven commands.
I’d like to get some feedback from the early testers, and then push this module for extension
status in the 2.4.x series to have a larger user base test it.
Closing remark for users that might be reading this: before you run downloading the new module,
remember that the speedup is solely in the PNG encoding phase.
If your map takes 1 second or more to draw, you probably have troubles in data setup, don’t waste your time
trying a difference PNG encoder, optimize your data or styles instead.
If instead your current maps already get returned in less than, say, 0.3 seconds then yes, give the new PNG
encoder a try.
Cheers
Andrea
–
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it