<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "First query is slow"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/4.page</link>
		<description><![CDATA[Latest messages posted in the topic "First query is slow"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>First query is slow</title>
				<description><![CDATA[ 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]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/2061.page#8356</guid>
				<link>http://forum.geonames.org/gforum/posts/list/2061.page#8356</link>
				<pubDate><![CDATA[Tue, 31 Aug 2010 16:29:39]]> GMT</pubDate>
				<author><![CDATA[ JasonPD]]></author>
			</item>
			<item>
				<title>Re:First query is slow</title>
				<description><![CDATA[ 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]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/2061.page#8360</guid>
				<link>http://forum.geonames.org/gforum/posts/list/2061.page#8360</link>
				<pubDate><![CDATA[Tue, 31 Aug 2010 18:15:08]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>Re:First query is slow</title>
				<description><![CDATA[ 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]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/2061.page#8362</guid>
				<link>http://forum.geonames.org/gforum/posts/list/2061.page#8362</link>
				<pubDate><![CDATA[Tue, 31 Aug 2010 19:43:23]]> GMT</pubDate>
				<author><![CDATA[ JasonPD]]></author>
			</item>
	</channel>
</rss>