Search Results Speed

Events happening in the community are now at Drupal community events on www.drupal.org.
jason ruyle's picture

Hello,

I was in charge of a pretty big search and photo project that is currently running. I'm running into some issues with the search results pages and was hoping for some suggestions. We're running Drupal 6 with apachesolr.

We have multiple servers; lb1 (squid), www1 (apache pre-fork/memcache/solr), app01 (memcache/ftp) and db1 (mysql).

The main issue is that when a user goes from page to page, things run smoothly. But when a user does a search, it generally sits for several seconds (upto 5 seconds), then renders the page. Often times it renders the entire page at once. Our search results are 60 thumbnail images, between the size of 30k and 150k. (I know 150k is really big).

The weird part about this whole thing is more about the time it takes to start loading the next page, does any one have a suggestion?
I've made the suggestion of an ajax search results.

I've also been considering dropping drupal for the search results all together and just loading the search results through another system.

A little side note, i install "SolrExplorer" which is a java front-end provided at the Solr site.
If I do a search through that system for the word "friend", my results are Found 1331 items (took 0.02 sec.)
It doesn't show the images, but the query is lighting fast.

If I do a search on the site it takes 3.5 seconds to get to the next page, then to download the images, it a total of 19seconds for the whole page.

Does anyone have suggestions? We do have cacherouter and boost modules. cacherouter runs memcache across 2 servers.

Comments

Did you check your MySQL

emcee0's picture

Did you check your MySQL server and see the process list during a search? It might just be your database is slowing the entire process down. If so, just get another db server and perform a slave replication and have the search run off that.

Try Acquia Search for free for 30 days

Amazon's picture

Hi, it's possible you've got resource contention between your Web Server and your Solr/Java servers.

You could try Acquia Search, just add the connector modules. Docs are here: http://acquia.com/documentation/acquia-search/activation . It's free for 30 days.

If the search results improve then, you've got to provide more resources to run both servers on the same box. Service isolation is a common technique for both debugging and increasing scalability. It's what we do on Drupal.org.

Cheers,
Kieran

If it takes several seconds,

dalin's picture

If it takes several seconds, but then the page renders all at once it sounds like you may also have front-end performance issues. Take a look at YSlow for tips here:
http://developer.yahoo.com/yslow/

--


Dave Hansen-Lange
Director of Technical Strategy, Advomatic.com
Pronouns: he/him/his

Profile

BartVB's picture

The most important thing you need to do is profile your search pages. If you don't know what causes the delay there is no (efficient) way of fixing it. Indeed try YSlow, PageSpeed or something similar. The profile functionality of XDebug combined with WebGrind (or KCacheGrind) is also a great way to figure out what exactly is going on.

A very crude/poor mans way to test this would be inserting "exit('forced exit');" in your Drupal code at a strategic place. I would suggest putting it right before the search gets executed, then right after executing the search, just before generating the results and right after. When "exit();" is placed right before the search your page should load almost instantly, move the exit around until you find the part that adds seconds of delay. Depending on your PHP skills you can of course also add some timers instead around the suspected code.

I appreciate all your

jason ruyle's picture

I appreciate all your suggestions. There we're a lot of changes done on the site to increase the speed. We went from 8-9 second search results speed (sometimes as high as 18-20seconds) to less then 3 seconds.

I'm not sure what was key to the speed change, but here are some of the things I did:

  • Went through custom module(s) and optimized code. We had 1 module that had a really badly written search override. This was fixed.
  • Went from 1 load balancer, 1 HUGE web server(apache, solr, processing, ftp), and 1 database server to:
    1lb, 1 apache + memcache, 1 memcache + app (ftp/photo processing), 1 db server, 1 solr server
  • We are using rackspace cloud, so the cost wasn't a big change, setup time and monitoring of course increased costs.
  • We also changed from the cache router module to memcache module (i think this made a big difference. we are using memcache.inc and not memcache.db.inc). Our two memcache servers use approx. 500MB memory each.
  • Removed additional facet blocks that weren't being used.
  • Reduced the number of facet fields in general.

But its incredible how much faster things have become. Thanks for your help.

Memcache stats:

Hits: 6932799 (96.3%)
Misses: 268341 (3.7%)
Free: 416.8 MBytes (81.4%)
Used: 95.2 MBytes (18.6%)

*yeah giving to much memory

APC stats:

Hits: 23917201 (100.0%)
Misses: 1389 (0.0%)
Free: 12.0 MBytes (9.4%)
Used: 116.0 MBytes (90.6%)

Request Rate (hits, misses) 101.89 cache requests/second
Hit Rate 101.88 cache requests/second
Miss Rate 0.01 cache requests/second
Insert Rate 0.01 cache requests/second
Cache full count 0

*going to increase