top | item 3991872

Ask HN: Server Infrastructure recommendations for a PHP app

9 points| mwumva | 14 years ago | reply

What would you recommend as a good server infrastructure recommendation for a PHP web application running on CodeIgniter and MySQL?

For an application with the traffic and size of, maybe, twitter?

13 comments

order
[+] debacle|14 years ago|reply
For an application with the traffic and size of twitter, you're going to need at least three dedicated DBAs managing your MySQL installation (never have an even number of DBAs - it leads to tyranny), which is probably going to be spread out across a cluster of replicated servers.

You're going to have a very beefy load balancer, behind which sits a bunch of nginx installs and you'll have likely thrown CI out the window because, even though it's fast for a PHP framework, it's not fast enough for what you need. You'll be using PHP, likely with a few homebrew extensions written in C.

Or you could just use Node. It has non-blocking IO. :D

Realistically, write it on a crappy linode with the default MySQL install and your PHP framework of choice. If you ever get as big as twitter, you can worry about scaling up to that size then.

[+] mwumva|14 years ago|reply
I'll try the React framework for Node+PHP. We'll see how that goes... but wait, why isnt CI useful enough?
[+] dholowiski|14 years ago|reply
> never have an even number of DBAs - it leads to tyranny

Please explain.

[+] kaolinite|14 years ago|reply
Just get a cheap VPS. If you were hosting an application the size of twitter, you wouldn't be asking on HN for advice :-)

Seriously, as your application grows, you'll improve your infrastructure. Nothing kills a project as easily as building an infrastructure for millions, for an app with only a few users.

[+] dholowiski|14 years ago|reply
He would be if this was his homework assignment...
[+] j_col|14 years ago|reply
Don't forget the following:

1. Sit PHP-FPM behind nginx for a bank of persistent PHP interpreters. Access this via a Unix socket.

2. Use Memcache to cache your records.

3. Use APC to cache your PHP byte code.

[+] Akram|14 years ago|reply
I believe Twitter was initially built on ruby on rails ... They had a lot of issue (the unpopular fail whale) . Did they switch to some other platform?
[+] kaolinite|14 years ago|reply
I recently read they switched to Scala.
[+] SABmore|14 years ago|reply
You might want to reach out to PHPFog (https://phpfog.com/), as they (can) offer what you need.
[+] ericcholis|14 years ago|reply
It's worth noting that orchestra.io is a similar solution. I've used both and PHP Fog is easier on the surface, especially since it offers pre-configured installs of many popular frameworks (like CI) and apps (like WordPress).

They offer on-demand scaling, and a very generous entry level pricing. Their free app is great for small tests and quick deployment tests.

Disclaimers:

PHP Fog and Orchestra.io use Git for deployment. You point your machine/instance to a repository and it will keep it updated when you commit and push changes.

These services are built with scalability in mind (read: multi-server or variable performance single server). So, it's encouraged that you have a solution for hosting and serving static content, (javascript, css, images, etc..). Obvious examples are Amazon S3, Rackspace CloudFiles, etc...

[+] mwumva|14 years ago|reply
@debacle...thanks...very helpful