Hi Scott,

Any chance this could be an IPv6 thing? What if you start both server and 
client with this flag:

-Djava.net.preferIPv4Stack=true



Michael Della Bitta
Senior Software Engineer
o: +1 646 532 3062

appinions inc.
“The Science of Influence Marketing”

18 East 41st Street
New York, NY 10017
t: @appinions | g+: plus.google.com/appinions
w: appinions.com

On Oct 3, 2014, at 15:08, Scott Johnson <sjohn...@dag.com> wrote:

> We are attempting to improve our Solr response time as our application uses
> Solr for large and time consuming queries. We have found a very inconsistent
> result in the time elapsed when pinging Solr. If we ping Solr from a desktop
> Windows 7 machine, there is usually a 5 ms elapsed time. But if we ping the
> same Solr instance from a Windows Server 2008 machine, it takes about 15 ms.
> This could be the difference between a 1 hour process and a 3 hour process,
> so it is something we would like to debug and fix if possible.
> 
> 
> 
> Does anybody have any ideas about why this might be? We get these same
> results pretty consistently (testing on multiple desktops and servers). One
> thing that seemed to have an impact is removing various additional JDKs that
> had been installed, and JDK 1.7u67 specifically seemed to make a difference.
> 
> 
> 
> Finally, the code we are suing to test this is below. If there is a better
> test I would be curious to hear that as well.
> 
> 
> 
> Thanks,
> 
> 
> Scott
> 
> 
> 
> 
> 
> package solr;
> 
> 
> 
> import org.apache.commons.lang.StringUtils;
> 
> import org.apache.solr.client.solrj.SolrQuery;
> 
> import org.apache.solr.client.solrj.SolrRequest.METHOD;
> 
> import org.apache.solr.client.solrj.impl.BinaryRequestWriter;
> 
> import org.apache.solr.client.solrj.impl.BinaryResponseParser;
> 
> import org.apache.solr.client.solrj.impl.HttpSolrServer;
> 
> import org.apache.solr.client.solrj.response.QueryResponse;
> 
> import org.apache.solr.client.solrj.response.SolrPingResponse;
> 
> import org.apache.solr.common.SolrDocumentList;
> 
> 
> 
> public class SolrTest {
> 
> 
> 
>                private HttpSolrServer server;
> 
> 
> 
>                /**
> 
>                * @param args
> 
>                * @throws Exception 
> 
>                 */
> 
>                public static void main(String[] args) throws Exception {
> 
>                                SolrTest solr = new SolrTest(args);
> 
>                                // Run it a few times, the second time runs
> a lot faster.
> 
>                                for (int i=0; i<3; i++) {
> 
>                                                solr.execute();
> 
>                                }
> 
>                }
> 
> 
> 
>                public SolrTest(String[] args) throws Exception {
> 
>                                String targetUrl = args[0];
> 
> 
> 
>                                System.out.println("=============System
> properties=============");
> 
>                                System.out.println("Start solr test.... " +
> targetUrl);
> 
> 
> 
>                                server = new HttpSolrServer("http://"; +
> targetUrl + ":8111/solr/search/");                           
> 
>                                server.setRequestWriter(new
> BinaryRequestWriter());
> 
>                                server.setParser(new
> BinaryResponseParser());
> 
>                                server.setAllowCompression(true);
> 
>                                server.setDefaultMaxConnectionsPerHost(128);
> 
>                                server.setMaxTotalConnections(128);
> 
> 
> 
>                                SolrPingResponse response = server.ping();
> 
>                                System.out.println("Ping time: " +
> response.getElapsedTime() + " ms");
> 
>                                System.out.println("Ping time: " +
> response.getElapsedTime() + " ms");
> 
>                }
> 
> 
> 
>                private void execute() throws Exception {
> 
>                                SolrQuery query = new SolrQuery();
> 
>                                query.setParam("start", "0");
> 
>                                query.setParam("rows", "1");
> 
> 
> 
>                                long startTime = System.currentTimeMillis();
> 
> 
> 
>                                QueryResponse queryResponse =
> server.query(query, METHOD.POST);
> 
> 
> 
>                                long elapsedTime =
> (System.currentTimeMillis() - startTime);
> 
> 
> 
>                                SolrDocumentList results =
> queryResponse.getResults();
> 
>                                long totalHits = results.getNumFound();
> 
> 
> 
>                                System.out.println("Search hits:" +
> totalHits
> 
>                                                                + ". Total
> elapsed time:" + elapsedTime + " ms"
> 
>                                                                + ". Solr
> elapsed time:" + queryResponse.getElapsedTime() + " ms"
> 
>                                                                + ". Solr
> query time:" + queryResponse.getQTime() + " ms"
> 
>                                                                + ". Params:
> " + getSearchParams(query));
> 
>                }
> 
> 
> 
> 
> 
>    /**
> 
>     * Formats solr query parameters so that we know what's passed to solr.
> 
>     * @param query
> 
>     * @return
> 
>     */
> 
>                private String getSearchParams(SolrQuery query) {
> 
>                                StringBuilder sb = new StringBuilder();
> 
>                                boolean first = true;
> 
> 
> 
>                                for (String name :
> query.getParameterNames()) {
> 
>                                                if (first) {
> 
>                                                                first =
> false;
> 
>                                                } else {
> 
>                                                                sb.append(";
> ");
> 
>                                                }
> 
> 
> sb.append(name).append(":[").append(StringUtils.join(query.getParams(name),
> ", ")).append("]");
> 
>                                }
> 
>                                return sb.toString();
> 
>                }
> 
> }
> 

Reply via email to