Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Response time depends on various factors, starting from application (WordPress), the web server, the caching layer/s (APC, W3TC, etc). If a page is already generated and is in cache, then the response time depends entirely on the web server, the OS, the virtual layer (if any), the network speed, the latency between the request and the server, etc. This question may fit more in ServerFault than here, as there is nothing wrong with WordPress, as you already indicated! –  Pothi Oct 9 '13 at 7:43
    
When putting a static .php on the server the response is lightning fast. So it seems as if it is not a php/webserver problem. Or? –  PappApp Oct 10 '13 at 8:53
add comment

1 Answer 1

Let me share what I think about your environment.

On this server I have one wordpress blog using the W3TC-plugin. I've enabled page cache and object cache using APC.

When you use APC for 'full page caching', this is what happens...

  1. Someone requests a page (ex: home page).
  2. It is generated by WordPress with the help of PHP / MySQL
  3. The generated page is store in APC.
  4. The generated page is served to the visitor.

So far, so good. Let's get into the next step...

  1. Someone else visits the same page (the home page) after a few seconds.
  2. APC now has the cached content.
  3. The cached content is served from APC.

Now, when APC serves the cached content, the request still hits PHP. Ideally, we would want to make sure PHP is not processed to serve a cached content.

How can we achieve this, with the current setup?

You can store the cached content in disk (In W3TC, it's disk:enhanced). Now, the whole process would look different...

  1. Someone requests a page (ex: home page).
  2. It is generated by WordPress with the help of PHP / MySQL
  3. The generated page is store in disk.
  4. The generated page is served to the visitor.

Only one change comparing to the previous method. Let's get into the next step...

  1. Someone else visits the same page (the home page) after a few seconds.
  2. The disk now has the cached content.
  3. The cached content is served from the disk by the web server.

No PHP involved in serving the cached content. Result: Better response time!

share|improve this answer
    
Please note that search queries are not cached (yet) with disk:enhanced mode in W3TC. Ref: wordpress.org/support/topic/… –  Pothi Oct 9 '13 at 9:22
    
To whoever voted down my answer: Care to explain why you did so? –  Pothi Oct 9 '13 at 12:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.