[英]Tuning php-fpm, nginx, mysql for high traffic on EC2
I'm looking to optimize my setup on EC2. 我想优化我在EC2上的设置。 CentOS 6, nginx 1.0.15, php 5.4.4 with php-fpm, xcache 2.0.0, mysql 5.5.24-55-log, redis 2.4.10, EC2 High Cpu XLarge (c1.xlarge 8 cores, 7G ram) for high traffic site, writes on every request. CentOS 6,nginx 1.0.15,带有PHP-FPM的PHP 5.4.4,xcache 2.0.0,mysql 5.5.24-55-log,redis 2.4.10,EC2 High Cpu XLarge(c1.xlarge 8核,7G ram)对于高流量的网站,会在每个请求上进行写。 Resulting web request is very small (javascript snippet). 产生的网络请求非常小(javascript代码段)。
Basically, it is a 100% dynamic environment (insert or update). 基本上,这是一个100%动态的环境(插入或更新)。 On every web request, I need to look in memcached for a quick lookup, then log a few attributes with every page request. 在每个Web请求上,我都需要在memcached中进行快速查找,然后在每个页面请求中记录一些属性。 I have several EC2s around the world helping to serve 600M+ requests per day. 我在世界各地有数个EC2,每天可帮助处理600M +个请求。 The idea is that I log the data and dump it hourly to be processed by some other machines. 我的想法是,我记录数据并每小时转储一次,以供其他计算机处理。 Each machine has been handling about 20M a day. 每台机器每天的处理量约为2000万。 I've tried a few data stores and some notes are as follows: 我尝试了一些数据存储,一些注意事项如下:
MySQL 的MySQL
Redis 雷迪斯
How many requests per second can I realistically expect out of this EC2 machine and 100% write scenario? 实际上,我每秒可以从这台EC2机器和100%的写入情况中期望多少个请求? Am I bound by EC2's disk performance or php or mysql? 我是否受EC2的磁盘性能或php或mysql的束缚? Can I configure it to use more CPU or better use the resources it's using? 我可以配置它使用更多的CPU还是更好地使用它正在使用的资源?
PHP-FPM http://pastebin.com/raw.php?i=9n2cpqrq PHP-FPM http://pastebin.com/raw.php?i=9n2cpqrq
NGINX (nginx.conf) http://pastebin.com/raw.php?i=XuVBKr8m NGINX(nginx.conf) http://pastebin.com/raw.php?i=XuVBKr8m
I really think you need to look into splitting out your architecture components onto different systems. 我真的认为您需要研究将架构组件拆分到不同的系统中。 For example, you noted that you are running MySQL on ephemeral storage. 例如,您注意到您在临时存储上运行MySQL。 This seems odd for MySQL in that your data could easily be lost. 对于MySQL来说,这很奇怪,因为您的数据很容易丢失。 Have you considered using Amazon RDS? 您是否考虑过使用Amazon RDS?
Also, instead of REDIS have you considering ElasticCache or SimpleDB for your Key-Value store. 同样,您可以考虑将ElasticCache或SimpleDB用作键值存储来代替REDIS。
I guess my main point is that, if you are dealing with the volume of requests that you are, you really should be breaking up your service stack into multiple tiers that can scale independently of each other. 我想我的主要观点是,如果您要处理的是大量请求,则实际上应该将服务堆栈分解为多个可以相互独立扩展的层。
One thing to mention with respect to performance, do not use EBS drives, unless as a RAID and with dedicated throughput. 关于性能的一件事,请不要使用EBS驱动器,除非作为RAID并具有专用吞吐量。 They really suck compared to ephemeral. 与短暂的相比,它们确实很烂。 I use hi1.4xlarge for database with its ephemeral drives on SSD. 我将hi1.4xlarge用于其SSD上的临时驱动器的数据库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.