----
Hi,
Barry Abrahamson here. A bit of context to my comment about the stability of Apache. We started WordPress.com using the Litespeed web server, but decided that we wanted to maintain as much of an open source stack as possible. We looked at lighttpd but had lots of issues with memory usage (leaks?) so we naturally turned to Apache. It worked mostly as expected performance and functionality wise. Keep in mind this was back in the Apache 2.0 days. Our problem was that deploying configuration changes which required a graceful restart under production traffic levels didn't work very well. About 10% of the time it either failed to reload the configuration, Apache stopped responding completely, or connections were dropped. Keep in mind that we were reloading ~1000 machines at once, but 10% is a pretty high failure rate. Yes, I know we could have removed machines from production, reloaded the configuration, and then put them back, but it's slow and error-prone, even if automated.
This is when we started looking at nginx. The nginx configuration reload works as expected all of the time, so that was enough to make us invest more time in the software. The transition was non-trivial since we had thousands of lines of .htaccess files which had to be translated to nginx configs, but it was worth it. Today, nginx is the "Swiss Army Knife" of our software stack. We use it for everything we can. I joke that we would use it as a database server if we could :)
------
As a side note, this may be the first useful comment on a Wired article I've ever seen.
Coincidentally, you probably could use Nginx as a rudimentary database at least since it can be extended with Lua. You can probably make it function as a database proper by using OpenResty. In fact, there are quite a few modules just for that purpose http://openresty.org/#Components
http://www.iis-aid.com/articles/my_word/difference_between_p...
"Another option is to configure IIS to use PHP in FastCGI mode which allows PHP processes to be recycled rather than killed off after each PHP request and also allows you to run several PHP processes at once, making PHP much much faster with the added bonus that as it is using the CGI interface there is little or no incompatibility issues with PHP extensions. This is still the fastest way to serve PHP, and is the way the IIS Aid PHP Installer is configured to install PHP on your IIS Environment."
The problem with WP and PHP is not stability, but large, complex and suboptimal code. One of the reasons is because WP supports everything and a kitchen sink, and all the features were just patched over it as time went by.
I run custom PHP applications for thousands of users on Apache without problems. I am using nginx in front of it for KeepAlive and static files, which reduces RAM and CPU usage drastically. And it also makes everything faster for website visitors.
There's nothing wrong using both Apache and nginx, each has its purpose.
You misunderstand. You don't need to write threaded code to write code that can't be used in a threaded environment. Think about using and accessing global or static variables in a threaded host environment vs a prefork process based environment.
PHP devs have adopted the practice of using Apache pre-fork rather than simply fixing their bad code because it hides their mistakes. On top of that, Wordpress being a huge plugin based community, you get tons of poorly written plugins that assume they're running in a single process environment because the authors simply don't know any better.
As far as I can tell, most PHP devs seem to think Apache only has a pre-fork mode; they write lengthy articles about how bad Apache is on memory not realizing the only reason it's that bad is because they're using the oldest and most resource hungry worker mpm. They don't seem to be aware Apache has other worker modules like threaded and evented that don't suck down ram like the prefork model does.
tl;dr the claim that Apache was the problem is Marketing Bullshit.
No, the threaded worker is the default, not the prefork.
From what I've seen essentially Wordpress is just super heavy and tie that in with a more memory hungry MPM+PHP it quickly leads to Apache lockups. I don't think this is a problem with Apache at all, nor even a PHP problem but simply needing to have lighter-weight PHP applications, otherwise you are going to have to start resorting to tricks to get some good RPS counts out of your configuration.
My end of story: Wordpress is awful to scale in Apache and it's not an Apache problem.
If you consider a slow client that consumes 1mb of html in, say, half a minute, an Apache thread(2.0)/process serving him would be effectively locked during this time. And thread/process has a relatively big overhead, both memory and cpu wise. Nginx, on the other hand, would just switch to serving the next client/clients, whos socket is ready (using epoll/select).
Given Apache's track record and massive deployment, how could this be possible? Isn't it more likely that the Wordpress people were doing something wrong? Not that Nginx isn't great, but I'm bemused by the occasional suggestions I see that it's saving us from the suddenly broken Apache.