0

I've got a moderately powerful VPS (quad core Xeon, 3GB ram, ssd) running Ubuntu 12.10, PHP 5.5.8 and Opcode cache is enabled.

I'm using memcached, opcode cache and mod_pageSpeed.

I'm monitoring the app using New Relic.

The issue is that no matter what I've tried, increasing memory limits, cache sizes, etc, I cannot get the request response time below about 80 ms.

The database is running Percona and that is spending about 40ms per request, and PHP is spending about 40ms per request.

All requests are being served up from OpCode compiled cache, so I don't understand where all the latency is coming from.

What am I missing?

Thanks. Apologies in advance if I've missed some crucial info, all can be supplied on request.

5
  • Execute less code? Feb 20, 2014 at 17:04
  • So just rm /var/www/* then yeh? :P
    – i-CONICA
    Feb 20, 2014 at 17:08
  • Yes, that will minimize your response time. :) Feb 20, 2014 at 17:10
  • My concern is that considering opcache compiles, executes, then caches the result, it shouldn't do anything more than serve up a response from memory. It is being held in memory, and I've got a 99.9N % hit rate on the cache... So I don't know why there's that much delay... It's as if it's executing the compiled code every time, and not caching the output. :(
    – i-CONICA
    Feb 20, 2014 at 17:13
  • That's because that's exactly what it's doing. Feb 20, 2014 at 17:19

1 Answer 1

2

The opcode cache doesn't "compile, execute and cache the result". On the first request, your PHP code is compiled to bytecode, that bytecode is saved, and then it is executed. On subsequent requests, the saved bytecode is executed. Without an opcode cache, the PHP code would be compiled to bytecode during each request.

If you want to cache the output generated by your program and serve it rather than executing your program on each request, you need to look into additional caching techniques.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .