Since you see a connection timeout on the first request after a long idle period, it hints to me it might be memory related. Your system might be paging out memory needed for tomcat and the solr webapp during the idle phase, and then when during the first request there's a longer handling period as it brings everything back in. but that's just a weak guess for you to test out.
If having the solr results as part of the page request is more important than the overall page loading time - meaning you feel it better to take 5 - 10 seconds than to have no results at all in a failure mode - then I'd suggest setting your connection timeout to a larger value.
you can change the default timeout for all requests with (value is in seconds)
$solr = new Apache_Solr_Service();
$solr->setDefaultTimeout(5.0);
Another thing to try might be something to make requests to your server periodically, to keep it less idle over time. In my own use of Solr I'm load balancing over several read slaves using IPVS, as part of the ldirector configuration it actually checks the health of each slave with a ping request every 5 minutes. A similar periodic health check might be prudent for your systems anyway.
Hope this helps in some way, let us know if you hunt down a specific reason for the slow first request.
- Donovan
> --
> You received this message because you are subscribed to the Google Groups "PHP Solr Client" group.
> To view this discussion on the web visit
https://groups.google.com/d/msg/php-solr-client/-/zd5BGfPX6IYJ.
> To post to this group, send email to
php-sol...@googlegroups.com.
> To unsubscribe from this group, send email to
php-solr-clie...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/php-solr-client?hl=en.
>