Limbeh
Limbeh

Reputation: 221

economical way of scaling a php+mysql website

My partner and I are trying to start a website hosted in cloud. It has pretty heavy ajax traffic and the backend handles money transactions so we need ACID in some of the DB tables.

Currently everything is running off a single server. Some of the AJAX traffic are cached in text files.

Question:

  1. What's the best way to scale the database server? I thought about moving mysql to separate instances and do master-master duplication. However this seems tough and I heard I might lose ACID properties even with InnoDB? Is Amazon RDS a good solution?

  2. The web server is relatively stateless except for some custom log files and the ajax cache files. What's a good way to scale to multiple web servers? I guess the custom log files can be moved to a reliable shared file system or DB but not sure what to do about the AJAX cache file coherency across multiple servers. (I dont care about losing /var/log/* if web server dies)

  3. For performance it might be cheaper to go with larger instance with more cores and memory but eventually I would need redundancy so wondering what's the best way to do this cheaply.

thanks

Upvotes: 3

Views: 343

Answers (2)

Anthony James
Anthony James

Reputation: 252

Another option is using a scaleable platform such as Amazon Web Services. You can start out with a micro instance and configure load balancing to fire up more instances as needed.

Once you determine average resource requirements you can then resize your image to larger or smaller depending on your needs.

http://aws.amazon.com http://tuts.pinehead.tv/2011/06/26/creating-an-amazon-ec2-instance-with-linux-lamp-stack/ http://tuts.pinehead.tv/2011/09/11/how-to-use-amazon-rds-relation-database-service-to-host-mysql/

Amazon allows you to either load balance or change instance size based off demand.

Upvotes: 0

pQd
pQd

Reputation: 126

take a look at this post. there is plenty of presentations on the net discussing scalability. few things i suggest to keep in mind:

  • plan early for the data sharding [even if you are not going to do it immediately]
  • try using mechanisms like memcached to limit number of queries sent to the database
  • prepare to serve static content from other domain, in the longer run - from ngin-x-alike server and later CDN

redundancy - depends on your needs. is 'read-only' mode acceptable for your site? if so - go with mysql replication + rsync of static files and in case of failover have your site work in that mode till you recover the master node. if you need high availability - then take a look either at drbd replication [at least for mysql] or setup with automated promotion of slave server to become master node.

you might find following interesting:

Upvotes: 1

Related Questions