solrpy performance

32 views
Skip to first unread message

zepolen

unread,
Jun 20, 2009, 1:45:01 PM6/20/09
to solrpy
Profiling solrpy showed it was much slower than pysolr (45ms for a
single request rather than 2ms)

It seems to be because solrpy uses POST rather than GET when selecting
- can this be changed?

Ed Summers

unread,
Jun 21, 2009, 9:13:06 AM6/21/09
to sol...@googlegroups.com
Interesting, can we see your profiling results? It shouldn't be too
hard to add a _get method similar to _post for requests that go
against /select and then do the same profiling again, and compare.

//Ed

zepolen

unread,
Jun 21, 2009, 3:01:17 PM6/21/09
to solrpy
A simple test to show the difference in speed:

In [4]: conn = solr.SolrConnection('http://localhost:8983/solr')

In [5]: %timeit conn.query('*:*')
10 loops, best of 3: 49.6 ms per loop

and after changing the line 728 in core.py from
#self.conn.request('POST', url, body.encode('UTF-8'), headers)
self.conn.request('GET', url+'?'+body.encode('UTF-8'),
headers=headers)

In [4]: %timeit conn.query('*:*')
100 loops, best of 3: 2.83 ms per loop


Actually profiling with cProfile showed that the slowdown seemed to be
due to httplib readline method with POST.

Ed Summers

unread,
Jun 22, 2009, 4:23:15 PM6/22/09
to sol...@googlegroups.com
Do the results look the same in reverse order, e.g. doing the GET test
before the POST one?

//Ed
Reply all
Reply to author
Forward
0 new messages