0

I have my own virtual server in the cloud, running nginx and APC. On this server I have one wordpress blog using the W3TC-plugin. I've enabled page cache and object cache using APC.

When accessing front page, pages and posts the response from the server comes almost instantly. But when doing a search, the response takes 1 second.

I'm wondering if it is possible to make the response faster.

Using the Debug Queries WP-plugin I've profiled the search sql query and it only takes 0.002 to complete. And according to W3TC most objects are cached. In fact, the Debug Queries plugin give the following report on a search result:

    Total query time: 0,01482s for 120 queries.
    Page generated in 0,00000s, 0,00% PHP, 0,00% MySQL

So it seems as if the page is generated very quick. But the response from the server still takes 1 second to complete.

How can I find out what it is that makes the response is taking long, even though the page is generated quick?

Note: I'm only talking about the response time from the server, not the time that it takes to generate the page in the browser.

Here is a example search result from my site.

This is my current php-fpm configuration: http://snipt.org/AiHg7

    # tail /var/log/php5-fpm.log

    [05-Oct-2013 20:20:04] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 8 total children
    [07-Oct-2013 10:44:55] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 7 total children
    [08-Oct-2013 10:20:05] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 7 total children

    # ps aux | grep php
    root      1251  0.0  0.1 398732  1328 ?        Ss   May28   6:38 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)      
    www-data 15678  0.0  1.9 458804 20296 ?        S    Jul17   0:13 php-fpm: pool www                                         
    www-data 18337  3.5  9.5 411072 98300 ?        S    14:15   0:57 php-fpm: pool www                                         
    www-data 18732  2.6 10.9 426648 112268 ?       S    14:20   0:34 php-fpm: pool www                                         
    www-data 19504  3.4  9.4 415556 97088 ?        S    14:30   0:24 php-fpm: pool www                                         
    root     20433  0.0  0.0   7548   828 pts/0    S+   14:41   0:00 grep php
HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
PappApp
  • 1
  • 2
  • `When accessing front page, pages and posts the response from the server comes almost instantly. But when doing a search, the response takes 1 second.` It's perfectly normal, IMO. – Pothi Kalimuthu Oct 09 '13 at 09:29
  • Are you sure? What's taking so long? Debug Queries plugin say that the page is generated very quick and total query time is 0,01482 seconds. My guess is that the problem is not Wordpress related at all. Could it be a PHP-problem? I'm using nginx php-fpm. Maby it isn't configured correctly? How can I find out if that's the problem? – PappApp Oct 09 '13 at 12:20
  • I've added more info about my php-fpm configuration. – PappApp Oct 09 '13 at 12:44

2 Answers2

1

Install and configure Varnish and use it in front of your WordPress blog.

pkhamre
  • 6,120
  • 3
  • 17
  • 27
  • 1
    For searching that is unlikely to help; since people won't search for the same thing multiple times. Certainly it will help for overall responsiveness though. –  Oct 09 '13 at 08:55
  • +1 for Varnish to improve the response time, while none can help with search results! – Pothi Kalimuthu Oct 09 '13 at 09:31
  • Varnish isn't really going to help speed up a search problem. – Drew Khoury Oct 09 '13 at 11:03
  • I'm already using W3TC = all pages and posts are already cached. So general response time is very good. Will Varnish make response time better? – PappApp Oct 09 '13 at 12:16
  • @PappApp Maybe, but as mentioned above, Varnish won't help to speed up searches if searches are unique and different all the time. – pkhamre Oct 10 '13 at 05:49
0

Consider using a search plugin. Sphinx search should get you <1 searches.

http://wordpress.org/plugins/wordpress-sphinx-plugin/

WordPress Sphinx Search Plugin allows to use Sphinx Search Server power to enable ultra-fast and feature-rich search on WordPress-based websites.

http://sphinxsearch.com/

Sphinx is an open source full text search server, designed from the ground up with performance, relevance (aka search quality), and integration simplicity in mind. It's written in C++ and works on Linux (RedHat, Ubuntu, etc), Windows, MacOS, Solaris, FreeBSD, and a few other systems.

Drew Khoury
  • 4,637
  • 8
  • 27
  • 28
  • I've profiled the SQL-query for the search and it takes about 0.002 seconds to complete. So even if I used sphinx I don't think it would solve my problem. Or? – PappApp Oct 09 '13 at 12:17
  • Ah maybe not then. I guess more debugging is in order. – Drew Khoury Oct 10 '13 at 09:38