GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
First query is slow  XML
Forum Index -> General
Author Message
JasonPD



Joined: 31/08/2010 16:08:29
Messages: 2
Offline

Hello all,

I am accessing the GeoNames service via a web service call using the GeoNames Java client. I've noticed that if I call the nearbyPostalCodes service with a query such as

postalcode=60611&country=US&radius=100&maxRows=100&style=SHORT

the initial response time is between ten and twelve seconds. Performing that call again results in a response time of less than one second. If I try a similar experiment in my web browser I don't encounter this issue--that is, if I enter

http://ws.geonames.org/findNearbyPostalCodes?postalcode=60611&country=US&radius=100&maxRows=100&style=SHORT

directly into the address bar the response time is generally very fast (it fluctuates, but is certainly much less then ten seconds).

I've tried using Java's URLConnection class as well as Apache's HttpClient package to access the service and the results are always the same.

My web service code is included below:

WebService webService = new WebService();

PostalCodeSearchCriteria pcsc = new PostalCodeSearchCriteria();
pcsc.setPostalCode(zip);
pcsc.setCountryCode("US");
pcsc.setRadius(radius);
pcsc.setMaxRows(100);
pcsc.setStyle(Style.SHORT);

org.geonames.WebService.findNearbyPostalCodes(pcsc);

Any ideas as to what may be causing these results?

Jason
marc



Joined: 08/12/2005 07:39:47
Messages: 4501
Offline

the free service is very slow at the moment:
http://forum.geonames.org/gforum/posts/list/0/2062.page

I can imagine that issuing the same query twice firsts loads it into the db cache and the next call is faster.

Marc

[WWW]
JasonPD



Joined: 31/08/2010 16:08:29
Messages: 2
Offline

Marc,

Thanks for the fast response.

I've also tried running queries with my company's account name on the commercial server and the results are the same. This has been the case for a little while now, and was originally the main impetus for us trying the commercial server. I should reiterate that the problem seems occur only when I call the web service programmatically (from a Java-based client)--querying the free web service from the web browser is faster, even when the service is running more slowly than normal.

I'll keep tinkering with my code and see what I can find.

Thanks,
Jason
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team