Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to make sure my website is properly optimized (the server, the PHP code, and the MySQL queries) for high traffic. I am getting ready to market my website soon, and expecting a ton of traffic, anywhere from 10,000-50,000 signups in a day which means database intensive, and a lot of image uploads. I need to make sure my server can handle the load.

The PHP code is crappy done by a company off Elance, and I know I have SQL injection problems, and slow queries, so I know that's the first thing to get fixed.

The website is 100% PHP/MySQL, custom framework, a little sloppy done by a company I hired off Elance. It's vulnerable to SQL injections, and also there a lot of slow queries.

I need to get server recommendations on how to setup my servers, RAID, and if I should get a CDN, and how to set it up.

I need a professional who knows databases, servers, security, Linux, and Apache very well. I don't want my website to crash when I begin marketing.

My current server setup is:

Dual quad-core Xeon Server (8 cores)
2 x 1 TB 7200RPM SATA hard disk drives
20 Mbit/s unmetered bandwidth

I know it's broad, but my main question is: should I get a CDN to deliver images, or do you think just a beast server can handle the load? Should I use memcache or APC? Etc...

It's a basic social networking niche site, but will have high traffic and TONS of image uploads, and the site is based around images. What kind of RAID if any RAID? What kind of hard disk drives? The company dedicated server I am looking at is pretty affordable and has a lot of options. The server above is only $199/month base. I can add 2 x 600 GB 10k RPM drives for a one time fee of $300, etc...

share|improve this question

closed as not constructive by coredump, Iain, Ward, Chopper3 May 3 '11 at 7:44

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

Most people completely overestimate the load they will receive. If you are actually getting 50k users a day your HDDs are completely insufficient to handle the load. Why don't you get yourself an Amazon EC2 instance and just pay by usage, that way you don't have to over-provision for load you may never actually reach. – Reality Extractor May 3 '11 at 5:56
I use to have a dedicated server around the same specs, dual xeons. I was doing 100-200k uniques per day and 1 million page views per day, but it wasn't database intensive or thousands of image uploads. – Andrew Fashion May 3 '11 at 6:15
So I know the traffic will come, but I was under the impression a dual xeon could handle 20-50k visits per day. – Andrew Fashion May 3 '11 at 6:16
up vote 1 down vote accepted

The server above is only $199/mo base. I can add 2 x 600GB 10k rpm drives for a one time fee of $300,

Ah, that does not add up. This is not "tons of images", it is "small low end server". Not "monster machine", but "ebay size". Comparing it to a car you got like a ford focus and ask how to drive a formula one with that. Wont work.

Reality check: if you hit the number of signups you talk of, one server wont do it. POINT. Not one with 2-3 discs. You will be lucky to get it working with a SuperMicro storage based server - that can hold 72 (!) hard discs. THEN you can have IO and storage capacity.

any where from 10,000-50,000 signups in a day which means DATABASE intensive

Reality check: Low end means 300.000 signups a month. In 6 months that is 1.8 million users.

Every user uploads 1 megabyte images (many wnt , many will o a LOT more) we talk of a nice whplling 1800 gigabyte. JUST for images. And taken very conservatively. That alone is more than your discs alow. And it is on very conservative numbers.

Reality check: 1.8 million users, even if active only for small parts, will use a LOT of cpu and disc IO for databases - better talk of some significant ssd discs here (2-3). SSD because your management db wont bethat big AND ssd kill anything else IOPS wise, and that is what servers run on. Not storage size, IOPS.

but I was under the impression a dual xeon could handle 20-50k visits per day

Ah, yes, it easily can.

The problem is that you dont have 20-50k visity per day. You have 10.000 new signups per day conservatively. You expect visitors to never ever come back? If not, then within 6 months you will reach easily... hm... lets say 5% of the people visit per day... that is 90.000 visits per day. On the conservative numbers I got earlier.

God start server, but optiomization wont cary you far. Plan for a replacement. One that is beefy.

Dual Quad Core Xeon Server (8 cores) 8 GB DDR RAM 2 x 1TB 7200RPM SATA HD RAID MIRROR 20Mbps Unmetered Bandwidth

Ok, 8gb ram is a joke for the processors, you are in trouble there. You need more ram, I would suggest a minimum of 24 gb. The discs are not usable for anything really. I nowadays on load servers use velociraptors 3000gb - good iops, good price. SATA but on a SAS backplane they shine. Whatever you do, the discs WILL be your bottleneck here. Unless you move pretty much everything into RAM for regular requests. 70200rpm SATA discs are NOT good at running a server that is constantly loaded. One reason I advice for more ram - you may want to run a reverse proxy.

CDN: CAN work, but you have to consider the price;)

share|improve this answer
Thank you for the feedback, I guess I forgot to mention it'll be probably a spike of 10-50k signups in just the first day, and then probably a good 2-10k signups everyday after that, and probably die around 300-500k users and plateau right there. So I don't mean 50k signups everyday. – Andrew Fashion May 3 '11 at 8:34

Second thing to consider here, is that you're also only allocating a single server for ALL of your server roles with no redundancy. For that amount of traffic you need to really put some thought into your infrastructure and mitigate single points of failures with load balancers, and multiple web servers and database servers, and you really need to look a high end SAS drives. You probably would be best looking at a blade server setup if this traffic were ever to actually get where you are expecting it to.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.