Live data from Hacker News

NGINX + PHP-FPM + APC = Awesome

interfacelab.com

1–10 of 19 posts

Re: NGINX + PHP-FPM + APC = Awesome

#2
Some commenters recommended Nginx to me a while back. It freaking rocks. It was such a breeze to setup and the memory usage is incredibly low and stable. Thanks for the tips then, and thanks for continuing to post articles to spread the word!

Re: NGINX + PHP-FPM + APC = Awesome

#3

Some commenters recommended Nginx to me a while back. It freaking rocks. It was such a breeze to setup and the memory usage is incredibly low and stable. Thanks for the tips then, and thanks for continuing to post articles to spread the word!

Thanks.

I'm hoping people learn more about PHP-FPM too. It's a deadly combo with nginx.

Re: NGINX + PHP-FPM + APC = Awesome

#4
post #3

Some commenters recommended Nginx to me a while back. It freaking rocks. It was such a breeze to setup and the memory usage is incredibly low and stable. Thanks for the tips then, and thanks for continuing to post articles to spread the word!

Thanks. I'm hoping people learn more about PHP-FPM too. It's a deadly combo with nginx.

Maybe, but we run Python :-)

Re: NGINX + PHP-FPM + APC = Awesome

#5
nginx is what I choose to use these days.

Couple of comments:

* Make sure that your init script is actually working. The init script you posted a link to places the pid file in a different location than the default for a source compiled nginx.

* There's an Ubuntu package for php+fpm somewhere on Launchpad. https://launchpad.net/~tarkus/+archive/ppa

* gzip support on older IE versions is iffy. See http://bit.ly/A0CRd for a config that ignores those browsers.

Re: NGINX + PHP-FPM + APC = Awesome

#6
After having Apache die to a memory-related config problem again this week, after having to reinstall it from source to fix an issue with PHP's mail() library, I am reminded once again how much I love Nginx's rock-solid performance.

Seriously, that process might well outlive me.

Re: NGINX + PHP-FPM + APC = Awesome

#7
I was on board until I read this:

"For starters, with mod_php, each request that Apache handles loads PHP - and all of it’s libraries."

No, it doesn't. In fact, that's a distinct advantage of mod_php. Everything is loaded and in memory when the request comes in. Throw APC on top of that and your code is also already compiled.

The only way that would not be true is if you've got MaxRequestsPerChild tuned really low and are restarted Apache children constantly. Some restarting is OK and helps keep memory leaks under control, but it shouldn't be so low that nothing stays cached. It's going to be slow with or without PHP running as a FastCGI.

Of course, I don't know how NGINX handles things, but for Apache he's got it all wrong.

Re: NGINX + PHP-FPM + APC = Awesome

#8
post #7

I was on board until I read this: "For starters, with mod_php, each request that Apache handles loads PHP - and all of it’s libraries." No, it doesn't. In fact, that's a distinct advantage of mod_php. Everything is loaded and in memory when the request comes in. Throw APC on top of that and your code is also already compiled. The only way that would not be true is if you've got MaxRequestsPerChild tuned really low an…

"No, it doesn't. In fact, that's a distinct advantage of mod_php. Everything is loaded and in memory when the request comes in."

Actually, thats not right, even with APC. A large set of operations run at the start of every request. For example, the class- and function-tables are filled and copied. Each extension (library) also has a per-request callback.

I don't know anything about NGINX either. But he's not wrong about the "epic shit ton of overhead".

Re: NGINX + PHP-FPM + APC = Awesome

#9
post #7

I was on board until I read this: "For starters, with mod_php, each request that Apache handles loads PHP - and all of it’s libraries." No, it doesn't. In fact, that's a distinct advantage of mod_php. Everything is loaded and in memory when the request comes in. Throw APC on top of that and your code is also already compiled. The only way that would not be true is if you've got MaxRequestsPerChild tuned really low an…

"In fact, that's a distinct advantage of mod_php. Everything is loaded and in memory when the request comes in. Throw APC on top of that and your code is also already compiled."

I would love it if someone cleared a very basic doubt of mine : If php is compiled, then what is the advantage of other programming languages? Wouldn't it be the same as anything else (except maybe considering the size of the language)? Is it just the optimization of the compiler then? And if so, would PHP compare the same to other loosely typed languages?

Post reply on HN