I have a quad core xeon, 8GB ram, and only 2 x 1TB SATA drives right now. I am trying to figure out how to scale my application to handle as much load and traffic per day as possible. I have an industry network site and it's currently bogging around 30,000 signup's in a day, 60k UV, and 600-1,000,000 pageviews per day. It was going so slow I had to shut the server off, and now I am losing money and traffic.
I'm pretty certain part of it is the PHP code and MySQL queries (hired them from India). What can I do to optimize and make sure the server is handling as much traffic as possible without bottlenecking. As I am expecting even more signups every day. It's a very database intensive site as it's a "networking" site for a certain niche, and you must be logged in, so everything revolves around MySQL.
PS. CentOS 5 64bit, PHP5, MySQL5. I know the database is MyISAM, and I am pretty sure they didn't index the tables too well either.
Thanks for the advice!
I am sorry, but my honest answer is this: If you don't even know how to check if your database is indexed you are so far out of your league that your only option is to hire a professional, given the scope of your project. Not a group of cheapo code slaves, but someone with a lot of experience with sites like yours.
We can give you a plethora of tips, but properly tuning such a site is a job that needs experience and can't be done with a few questions on ServerFault.
There are a few things you can do and check to give you more information on the issue and, in turn, handle it better:
sar
or more a complete package like Nagios/Zabbix. This will help you now in narrowing down the cause as well as later to see how effective (or not) your solutions are. Ideally you want to scale proactively before you actually need to.MaxClients
in Apache to limit the number of users and, hopefully, reduce the server load. This may make your site at least partially available and usable.top
. If your application is indeed write heavy I would expect/want to see it using at least 1GB if not a few more depending on your database size. If it is only using a few 100MB, or using 6-7GB, there is likely a configuration issue.Hope this helps some and good luck!
You need to use "MySQL workbench" to login to the MySQL server. Once you are logged in as "root" (from localhost unless you edited the permissions to allow remote login) then you should be able to see the indexes. Then, if you don't have them, it is just a matter of creating them, and it should make a pretty good speed difference with your app I think. To help with creating the indexes, you need to review the instructions on the EXPLAIN command.
Depending on your cashflow, a very quick (and dirty) fix might be asking your hosting company to upgrade you to a SAS/SCSI server which will also get you into the enterprise server category. Big SATA drives are slow and your server may be great for CPU but lousy at IO.
Congrats on the signup numbers btw. Your problem is a good problem to have.