GeoServer : JTileCache
This page last changed on Feb 28, 2007 by jdeolive.
TileCache is a tile caching library developed by MetaCarta Labs written in python.
This page is being used to capture the design of a JTileCache, that is the integration of TileCache into a java application such as GeoServer.
We are presented with a number of different options for the creation of JTileCache. The two most important criteria during evaluation will be:
At this point, a number of implementation strategies present themselves as viable:
Jython is a java based implementation of python, which allows for ease of integration between the two languages. With Jython, one is able to call python code from a java application, and vice versa.
A key feature of Jython is the ability to embed jython scripts into a java application. This is achieved by creating a PythonInterpreter instance inside the application, and executing the python scripts accordingly.
Where the python script could be something like:
Ok... enough with the naive example, how could this method be applied to GeoServer and TileCache? Consider a servlet handling a get map request:
And there it is. Although this code isn't not exactly what we would see in a true implementation, it illustrates the general concept. Sooo... onto evaluation.
First the good. This integration strategy will be pretty easy to maintain as none of the TileCache sources need to be modified. All that is needed is some java code to initialize the python runtime and to execute the appropriate scripts. And that is about it for the good... onto the bad.
I actually lied above when I said the TileCache sources can be used as is. Some modifications will have to be made to modify TileCache sources that make calls to Python libraries that are not implemented by Jython. While Jython does implement most the functionality needed, it does not implement all. In particular some of the os library calls made my DiskCache. It also appears that Jython is constantly lagging behind Python and Cython by a few versions, which means that we may be stuck waiting for new versions of Jython to be released to support some functionality that is required.
In terms of performance, this strategy is pretty dismal as well. The jumping back and forth between java and python represents a potentially serious bottleneck that could easily make this strategy unusable. Especially since it must be done for every request. We also really have no way of optimizing in the java environment since we are not playing with the Python sources. Operations that may be efficient in Python may not be so in Java.
|Document generated by Confluence on May 14, 2014 23:00|