[Geoserver-users] WebMapServer(url)

Hello.

I am trying to access Geoserver through a servlet using the Geotools
library that comes with Geoserver package, and I have noticed that
initializing the WebMapServer class:

                       URL url = new URL("http://localhost:8080/geoserver/wms"\);
    
      begin = System.currentTimeMillis();
      WebMapServer wms = new WebMapServer(url);
      end = System.currentTimeMillis();
      
takes quite a bit of time at 928 ms, since I believe it has to do a
GetCapabilities request first. Considering that getting a quite
detailed map takes only 145 ms from a GetMapRequest, the 928 ms seems
quite expensive.

Is this normal or am I doing something wrong.

Thanks.

Mario.

Mario Basa ha scritto:

Hello.

I am trying to access Geoserver through a servlet using the Geotools
library that comes with Geoserver package, and I have noticed that
initializing the WebMapServer class:

                       URL url = new URL("http://localhost:8080/geoserver/wms"\);
    
      begin = System.currentTimeMillis();
      WebMapServer wms = new WebMapServer(url);
      end = System.currentTimeMillis();
      
takes quite a bit of time at 928 ms, since I believe it has to do a
GetCapabilities request first. Considering that getting a quite
detailed map takes only 145 ms from a GetMapRequest, the 928 ms seems
quite expensive.

Is this normal or am I doing something wrong.

It seems normal to me, you're parsing XML, which is quite a bit more
expensive than just rendering a map, plus the caps document contains
a huge list of SRS which probably affect the response times.
Suggestions:
- go into the WMS configuration and set a shorter list of EPSG codes
   to return
- cache the WebMapServer object and reuse it for multiple requests

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Thanks for the quick reply Andrea.

Just curious though, is there another class that can be used that
doesn't do a GetCapabilities during initialization?

Thanks again.

Mario.

On Tue, Mar 24, 2009 at 12:52 AM, Andrea Aime <aaime@anonymised.com> wrote:

Mario Basa ha scritto:

Hello.

I am trying to access Geoserver through a servlet using the Geotools
library that comes with Geoserver package, and I have noticed that
initializing the WebMapServer class:

                  URL url = new

URL("http://localhost:8080/geoserver/wms&quot;\);

                   begin = System\.currentTimeMillis\(\);
                   WebMapServer wms = new WebMapServer\(url\);
                   end = System\.currentTimeMillis\(\);

takes quite a bit of time at 928 ms, since I believe it has to do a
GetCapabilities request first. Considering that getting a quite
detailed map takes only 145 ms from a GetMapRequest, the 928 ms seems
quite expensive.

Is this normal or am I doing something wrong.

It seems normal to me, you're parsing XML, which is quite a bit more
expensive than just rendering a map, plus the caps document contains
a huge list of SRS which probably affect the response times.
Suggestions:
- go into the WMS configuration and set a shorter list of EPSG codes
to return
- cache the WebMapServer object and reuse it for multiple requests

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Mario Basa wrote:

Thanks for the quick reply Andrea.

Just curious though, is there another class that can be used that
doesn't do a GetCapabilities during initialization?
  

I don't think so, but if you explain why a one second initialization is so killer to your use case we can may be find out a solution? Isn't paying that initialization time once and reuse the WebMapServer instance for multiple requests acceptable?

regards,

Gabriel

Thanks again.

Mario.

On Tue, Mar 24, 2009 at 12:52 AM, Andrea Aime <aaime@anonymised.com> wrote:
  

Mario Basa ha scritto:
    

Hello.

I am trying to access Geoserver through a servlet using the Geotools
library that comes with Geoserver package, and I have noticed that
initializing the WebMapServer class:

                      URL url = new
URL("http://localhost:8080/geoserver/wms&quot;\);

                       begin = System.currentTimeMillis();
                       WebMapServer wms = new WebMapServer(url);
                       end = System.currentTimeMillis();

takes quite a bit of time at 928 ms, since I believe it has to do a
GetCapabilities request first. Considering that getting a quite
detailed map takes only 145 ms from a GetMapRequest, the 928 ms seems
quite expensive.

Is this normal or am I doing something wrong.
      

It seems normal to me, you're parsing XML, which is quite a bit more
expensive than just rendering a map, plus the caps document contains
a huge list of SRS which probably affect the response times.
Suggestions:
- go into the WMS configuration and set a shorter list of EPSG codes
to return
- cache the WebMapServer object and reuse it for multiple requests

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
  

Hello Gabriel,

Again, I am planning to use this in a servlet setting and 1 full
second is expensive especially if you consider that getting a map
request (which is the purpose of the servlet) just takes ~143 ms.

Yes, I can probably reuse the object through the session, but I had
bad experience reusing objects before and would like to avoid doing so
as much as possible. Is the object thread-safe?

Regards,

Mario.

On Tue, Mar 24, 2009 at 1:31 AM, Gabriel Roldan <groldan@anonymised.com> wrote:

Mario Basa wrote:

Thanks for the quick reply Andrea.

Just curious though, is there another class that can be used that
doesn't do a GetCapabilities during initialization?

I don't think so, but if you explain why a one second initialization is so
killer to your use case we can may be find out a solution? Isn't paying that
initialization time once and reuse the WebMapServer instance for multiple
requests acceptable?

regards,

Gabriel

Thanks again.

Mario.

On Tue, Mar 24, 2009 at 12:52 AM, Andrea Aime <aaime@anonymised.com> wrote:

Mario Basa ha scritto:

Hello.

I am trying to access Geoserver through a servlet using the Geotools
library that comes with Geoserver package, and I have noticed that
initializing the WebMapServer class:

                 URL url = new

URL("http://localhost:8080/geoserver/wms&quot;\);

                  begin = System\.currentTimeMillis\(\);
                  WebMapServer wms = new WebMapServer\(url\);
                  end = System\.currentTimeMillis\(\);

takes quite a bit of time at 928 ms, since I believe it has to do a
GetCapabilities request first. Considering that getting a quite
detailed map takes only 145 ms from a GetMapRequest, the 928 ms seems
quite expensive.

Is this normal or am I doing something wrong.

It seems normal to me, you're parsing XML, which is quite a bit more
expensive than just rendering a map, plus the caps document contains
a huge list of SRS which probably affect the response times.
Suggestions:
- go into the WMS configuration and set a shorter list of EPSG codes
to return
- cache the WebMapServer object and reuse it for multiple requests

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users