Hi,
a recent user report about bbox treatment in GeoServer
(http://jira.codehaus.org/browse/GEOS-1768)
prompted me to make some checks on how loose bbox
is affecting performances.
For those that do not know, "loose bbox" is a postgis
datastore parameter that allows the datastore to
relax the bbox semantics. The OGC filter spec say that
BBOX is just a shortcut for intersects, meaning that
the geometry tested must actually intersect the specified
bbox.
Loose bbox relaxes the semantics allowing for a bbox vs
bbox check, that is, a geometry is included in the results
if its bbox.
Know, it's well know a loose bbox semantic will provide
faster filter checks, but I did not know how much faster.
So I run the same WMS test used in Victoria's WMS shootout
presentation assessing how much fast bbox and antialiasing
are affecting speed (if you did not see the presentation...
can you tell me on what planet you're living? ok, anyways,
here's the link: http://www.foss4g2007.org/presentations/view.php?abstract_id=120)
I included antialias because I know disabling it provides
a very significant perf boost, but not many people disable
it due to the poorer image quality).
To recap, the tests makes a set of WMS requests
drawing some 1000 features out of a 3 million dataset.
Here are the results (times in milliseconds as reported
by JMeter for a single thread requesting maps):
no antialias + loose bbox: 30ms
antialias + loose bbox: 80ms
no antialias + ogc bbox : 200ms
antialias + ogc bbox : 250ms
Wow! As you can see loose bbox as an optimization is
quite a bit more significant than disabling antialiasing.
Now, this means all the poor Oracle and DB2 users (and
maybe ArcSDE ones too) are suffering from quite diminished
performance due to the lack of such parameter in those
datastores.
The user complaining at
http://jira.codehaus.org/browse/GEOS-1768
has good reasons to, he can get correct
WFS behaviour, but he'll have to pay a dear price on the
WMS side.
So, what can we do about it? I have a few proposals:
a) GeoServer wrap-o-rama road: we do add fast bbox
options to datastores that do lack it, when WFS
is used, we grab the filters and replace each
BBOX instance with the equivalent Intersects
instance to keep OGC semantics happy
b) GeoTools hint road: as suggested in
http://jira.codehaus.org/browse/GEOS-1762
we turn fast bbox into a datastore hint that
only renderer sets
c) GeoTools "we know better than OGC" road:
we create a new Filter interface, LooseBBox,
with an explicit loose semantic, teach datastores
about it, and leave the OGC bbox usage unaltered
a) and b) are easier to follow from a political point
of view, but have a hole when an SLD style or an
extra filter provided on WMS requests is using BBOX,
we'd end up treating it in the loose way too.
Solution c) is not affected by that.
Comments, opinions, rants?
Cheers
Andrea