nginx better than apache for dynamic content? [duplicate]

Possible Duplicate:
Apache or NGINX for PHP?

Hi,

i have searched for this around the web and i can't find the right answer for my question.

basically i want to know if i can get better performance with nginx than with apache (in php apps), and i'm not involving static content (where i know nginx is better).

the sites are a widely collection of scripts with a lot of variables, using old not OOP oriented code and new websites using classes and smarty. the sites are very dynamic, changes parts in each request.

i want to avoid suing nginx for static content and apache for php, so for that i;m asking, if it worth the transition in performance terms.

my main confusion comes where i have seen benchmarks using wordpress and wp-supercache plugin, that could make it better for nginx than a custom sites with the features i already described. i have seen other benchmarks that just not show a big difference between them (around 5%)

thanks in advance for any help :D

Regards, Shadow.


Solution 1:

What do you mean by 'performance'? Does it mean maximum throughput on a very busy server or does it mean fast pageloads for individual pages?

Apache is rarely the limiting factor (some settings may improve performance 'tough). Usually the real load lies with php or mysql, and then usually badly constructed queries or useless work.

Where nginx shines compared to apache 1 and 2 is in handling many concurrent connections (idle or busy). It also makes server paradigms possible that are not available on other webservers. It does not magically improve the performance of PHP/MySQL.

Stopgap measures probably more worth your time than nginx are a php opcode cacher (apc) and the mysql query cache. Other than that I'd start profiling and fixing the code.

For faster pageloads you will have most benefit from modifying the way the site works, see for example the yahoo performance blog.