"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.
"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?
If PHP is compiled, then it still has almost the same benefits and drawbacks compared to all the other languages, except for one: once it's compiled, PHP runs faster than it does when interpreted. Simple.
IIRC the compiler for PHP uses a scheme compiler as a backend.
Let's say you write a Python program that outputs Javascript. It could be considered a "compiler". Or let's say that you write your own language, which outputs to other 3 or 4... there's also compiling involved. A compiler doesn't need to output assembler. Even if every compiler did that, features of the language would result in different execution code.
For example, PHP's variables can be a string of any size, or a number, or an object, and you can change its type while the program is running. The compiler doesn't optimize the code execution as easy as, say, in Java. You can not allocated the minimum amount of memory that will store the variable values, for example.
"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".
"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.