0

To give you a little background, I currently have a website that allows users to upload photos. The website was initially on a GoDaddy shared server, but recent surges in traffic have forced me to explore other options. During peak hours, the site contains 400+ active visitors, which when combined with user uploads, forces the shared server to shut down.

I have a small amount of experience with setting up servers through AWS and attempted to place the website on a c1.medium instance, Amazon Linux. The website along with the MYSQL Database is on the same instance. While I have read that this is in general frowned upon, I have similarly read that moving the database to another instance would not significantly increase speeds. Unfortunately, the c1.medium instance also was unable to support the traffic and I soon received an error Establishing a Database connection. The site does load on occasion, so the problem stems from the traffic load and not an actual problem with the database.

My question is whether the problem revolves solely around MySQL? The database itself when backed up is around 250MB. Is the issue caused by input / output requests to the database? I read posts with people with similar problems in which they stated that installing MySQL 5.6 solved the problem, but also have read that MySQL 5.6 is slower than MySQL 5.5, which is my current version.

After conducting some preliminary research I started to believe that I could resolve the problem by increasing the IPOS of the EBS. Originally I had it set the IPOS as standard, but changed it to Provisioned IOPS and 30x the size of the EBS (i.e., 60GB – 1800 IOPS). This once again appeared to have little impact. Do I need to upgrade my instance? What measures should I be focused on when deciding on the instance? It appears that the cheapest instance with high network performance and EBS optimized would be c3.xlarge. Suggestions?

1
  • It's difficult to speculate on your specific problem with this limited info... but you absolutely should run the web and database on separate servers. There is pretty much zero room for debate on that point, because when one peaks in resource usage, the other will be starved, but since they are serving the same load, they will tend to peak together and you have a cascading failure on your hands. Jan 18, 2014 at 0:12

3 Answers 3

0

Establishing a Database connection.

You need to establish where the problem is:

  • Is the db swamped/too busy? -- Why? (cpu, disk, memory)
  • is the web server swamped?

It is not clear how to solve. You need to get closer to the core problem. That will guide the next step.

Best is to reproduce the problem on demand, so you can exampine the potential problem areas.

2
  • Once I reproduce the problem, what logs / performance measures should I examine to determine the problem?
    – panoramic
    Jan 18, 2014 at 0:00
  • @panoramic Once you repro the problem, you look at what is going on (is cpu pegged, if so, what is sucking cpu, can you connect to db from other tools when web server cannot, etc) Jan 19, 2014 at 3:02
0

The best approach to this would be to have two servers. I'd find a provider that supports internal networking between virtual hosts, so the traffic doesn't route out into the internet from box A and route back in to box B.

Amazon is the big-box provider, but ultimately your current approach won't meet your needs.

The other posters are absolutely right about how mysql and the webserver will be in a tug-of-war for resources. Right off hand i can only think of maybe the possibility that your application isn't properly closing connections.

0

I would take a look at the MySQL settings. In my experience the standard my.conf (/etc/mysql) on all distros i used to date is by far not optimized for what you do. Having webservers with a lot of peakload on Amazon myself, i can only advise you to revise the my.conf. My settings on a m1.large: key_buffer = 8G (default 384 MB). Also rise the query_cache_limit and the query_cache_size.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .