[Geoserver-devel] Slow feature problem

blazrepnik@anonymised.com ha scritto:

Hi Andrea,

Sorry for late answer. I'm sending you the problematic shape. But something
interesting happened. I was preparing the shape (filling the attributes with
rubbish data, because i musn't send you the original (company policy)) and then
i tested it again. It worked faster then the original shapefile. The number of
attributes remains the same, only the data of attributes is different. I'm
sending you shapefile. If you could please look at it. Because i think it's
still slow (even if it's faster then original).

Hum, I've tried out a first simple call getting everything out.
I could not run it in Firefox since the GML is too big, but using wget from the command line I got:

C:\Temp\test>wget "http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:vozli3"
--14:26:30-- http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:vozli3
            => `wfs@anonymised.com=GetFeature&typename=topp%3Avozli3.3'
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/xml]
     [ <=> ] 25.488.534 4.29M/s
14:26:36 (4.26 MB/s) - `wfs@anonymised.com=GetFeature&typename=topp%3Avozli3.3' saved [25488534]

That is, a 25MB GML file has been generated in around 6 seconds.

I then tried a smaller area:

C:\Temp\test>wget "http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:vozli3&bbox=546000,157000,547000,158000&quot;
--14:41:13-- http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:vozli3&bbox=546000,157000,547000,158000
            => `wfs@anonymised.com=GetFeature&typename=topp%3Avozli3&bbox=546000,157000,547000,158000.1'
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/xml]
     [ <=> ] 112.834 107.69K/s
14:41:16 (107.58 KB/s) - `wfs@anonymised.com=GetFeature&typename=topp%3Avozli3&bbox=546000,157000,547000,158000.1' saved [112834]

Took 3 seconds for this one... hmmm... slow in fact, since this is extracting just a small subset of the data points (a 112kb file compared to 25MB...).

I profiled a little the calls and found a really big inefficiency in bounds computing code, and a minor one in the shapefile code.
With the changes the outcome is:

C:\Temp\test>wget "http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:vozli3&bbox=546000,157000,547000,158000&quot;
--16:09:34-- http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:vozli3&bbox=546000,157000,547000,158000
            => `wfs@anonymised.com=GetFeature&typename=topp%3Avozli3&bbox=546000,157000,547000,158000.44'
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/xml]
     [ <=> ] 112.834 111.60K/s
16:09:35 (111.49 KB/s) - `wfs@anonymised.com=GetFeature&typename=topp%3Avozli3&bbox=546000,157000,547000,158000.44' saved [112834]

Between one and two seconds now, not so bad. There is still a couple of points that could be improved, but they require rewriting integer/long parsing code, which is a little problematic and more complex.

I'm sending you replacement jars for Geoserver 1.5.0rc3/rc4 (well, whatever 1.5.0rc, it does not really matter), can you test and report back eventual improvements?

I won't be able to ship 1.5.0 with these changes, since the classes involved are pretty core to Geotools and we have already issued the last RC, but we'll be able to include the changes in 1.5.1 for sure.

Cheers
Andrea