

Ask HN: Server Infrastructure recommendations for a PHP app - mwumva

What would you recommend as a good server infrastructure recommendation for a PHP web application running on CodeIgniter and MySQL?<p>For an application with the traffic and size of, maybe, twitter?
======
debacle
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.

~~~
dholowiski
> never have an even number of DBAs - it leads to tyranny

Please explain.

~~~
debacle
It's the same reason you never want an even number of supreme court justices.
In the courts, it would lead to deadlock. In the server room, it will lead to
bloodshed.

------
kaolinite
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
He would be if this was his homework assignment...

------
hifi
Use Percona Server instead of MySQL: <http://www.percona.com/software/percona-
server/> Works the same as MySQL..just faster! (and nginx + php-fpm as j_col
already suggested)

------
j_col
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
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
I recently read they switched to Scala.

------
SABmore
You might want to reach out to PHPFog (<https://phpfog.com/>), as they (can)
offer what you need.

~~~
ericcholis
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
@debacle...thanks...very helpful

