Server performance for high traffic? [closed]

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)
8 GB DDR RAM
2 x 1 TB 7200RPM SATA hard disk drives
RAID MIRROR
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...


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,

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 car with that. It won't work.

Reality check: if you hit the number of signups you talk of, one server won't 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 I/O and storage capacity.

anywhere 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 won't, but many will do 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 allow. 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 I/O for databases - better talk of some significant SSD discs here (2-3). SSD because your management database won't be that big AND SSDs 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 don't have 20-50k visitors 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... let's 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 optimization won't carry you far. Plan for a replacement. One that is beefy.

Dual quad-core Xeon Server (8 cores) 8 GB DDR RAM 2 x 1 TB 7200 RPM SATA HD RAID MIRROR 20 Mbit/s Unmetered Bandwidth

OK, 8 GB RAM is a joke for the processors, and you are in trouble there. You need more RAM, and I would suggest a minimum of 24 GB. The discs are not usable for anything really. I nowadays on load servers use Velociraptors 3000 GB - good IOPS and 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. 7,200 RPM 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;)