News for hackers. Stuff that matters.
Re:Moving from PHP to C saved my web startup. by rograndom on Friday October 22, 2010 @03:26PM (#1821104)
Instead of loading apache for each php call, why not have a few PHP FastCGI instances running? They're lighter weight than apache+mod_php and you don't have to wait for them to load for each call?
Re:Moving from PHP to C saved my web startup. by BuckToBid on Friday October 22, 2010 @03:33PM (#1821128)
Mostly just because I've never used FastCGI before, and I have played around with making C/C++ servers for fun before. Seemed like the fastest solution and so far its worked out better than expected.
Re:Moving from PHP to C saved my web startup. by silentbicycle on Friday October 22, 2010 @05:13PM (#1821547)
This is a bit of an oversimplification, but where CGI spawns a new process for each connection, FastCGI* starts the process once, then runs a loop to handle each connection, so the process startup, database connection, etc. costs amortize to essentially nothing -- many of the constant factors for working in a higher level language are eliminated.

FastCGI is worth looking into - a lot of popular webservers support it, and it's less of a complete model change than switching to an event-based system (e.g. node.js) or an MVC framework.

* Or SCGI, which is a newer, simpler design with similar goals.