3

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

4

2 回答 2

1

看看这篇文章。网上有很多关于可扩展性的演讲。我建议记住几件事:

  • 尽早计划数据分片[即使您不打算立即执行此操作]
  • 尝试使用 memcached 之类的机制来限制发送到数据库的查询数量
  • 从长远来看,准备从其他域提供静态内容 - 从 ngin-x-alike 服务器和后来的 CDN

冗余 - 取决于您的需求。您的网站可以接受“只读”模式吗?如果是这样 - 使用 mysql 复制 + 静态文件的 rsync 并在故障转移的情况下让您的站点在该模式下工作,直到您恢复主节点。如果您需要高可用性 - 然后查看 drbd 复制 [至少对于 mysql] 或设置自动提升从属服务器成为主节点。

您可能会发现以下有趣的内容:

于 2011-12-12T16:09:34.120 回答
0

另一种选择是使用可扩展的平台,例如 Amazon Web Services。您可以从一个微型实例开始并配置负载平衡以根据需要启动更多实例。

一旦确定了平均资源需求,您就可以根据需要将图像大小调整为更大或更小。

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 允许您根据需求进行负载平衡或更改实例大小。

于 2012-02-11T07:59:11.813 回答