我生产环境下的两台Nginx + PHP5(FastCGI)服务器,跑多个一般复杂的纯PHP动态程序,从Nginx的日志可以统计出,单台Nginx + PHP5(FastCGI)服务器跑PHP动态程序的处理能力已经超过“700次请求/秒”,相当于每天可以承受6000万(700*60*60*24=60480000)的访问量:

  服务器①:DELL PowerEdge 1950(两颗 Intel(R) Xeon(R) 双核CPU 5120 @ 1.86GHz,4GB内存)

  服务器②:DELL PowerEdge 1950(一颗 Intel(R) Xeon(R) 双核CPU 5140 @ 2.33GHz,4GB内存)

  Web服务器:CentOS Linux 4.4 + Nginx 0.5.35 + PHP 5.2.6RC2(300 FastCGI Procees, unix-domain socket, with XCache)

  PHP程序内容:大量Memcached读写、少量MySQL读操作、大量文件队列写操作,然后计算,生成供<script type="text/javascript" src="http://www.domain.com/abc.php?u=1"></script>方式调用的JS代码或XML数据。

  网卡流量:1.5M~3M/秒

  请求数统计方式:从Nginx访问日志中,统计每分钟的第15秒共有多少条日志记录。
引用
grep "25/Mar/2008:15:01:15" /data1/logs/nginx.log | wc -l


  点击在新窗口中浏览此图片

  服务器的系统负载也不算高:

  点击在新窗口中浏览此图片

  总结:
  1、Nginx的处理能力超强,这块不是瓶颈。影响动态程序处理能力的因素主要在于PHP(FastCGI)。PHP(FastCGI)模式适用于执行时间较短的PHP程序,一般复杂的PHP程序执行时间应该在100ms以内,例如我的博客首页执行时间为38ms左右。假设一个PHP程序的执行时间为100ms,那么一个PHP(FastCGI)进程每秒可以处理完毕10个请求,300个FastCGI进程理论上每秒可以处理3000个请求。但是,在生产环境下,还将受到内存、系统负载等多方面的影响,例如300个PHP(FastCGI)进程需要占用2.4GB左右的内存,每秒处理超过1000个请求时,系统负载会飚升到100以上。因此,FastCGI的进程不是越多越好,而是够用就好。

  2、使用PHP的XCache、APC等加速模块会提供速度10倍左右,降低系统负载50倍以上。

  3、修改了spawn-fcgi,使它能够支持250个以上的FastCGI进程。

  4、如果PHP直接对MySQL进行大量读写操作,速度是达不到“700 request/sec”的,PHP与MySQL之间需要一个中间层,这是关键的技术。

  5、CPU的数量(多核算多个CPU,cat /proc/cpuinfo |grep -c processor)越多,系统负载越低,每秒能处理的请求数也越多。

  6、使用PHP 5.2.6RC2,因为它修正了PHP 5.2.5的“zend_mm_heap corrupted”错误BUG。PHP 5.2.5(FastCGI)在高并发请求情况下,经常会出现该错误。

  7、有空我将写一篇针对CentOS Linux环境Nginx + PHP5(FastCGI)安装、配置的最新博文。

Tags: , , , , , ,



技术大类 » Web服务器 | 评论(102) | 引用(0) | 阅读(142693)
Fufay
2008-11-18 10:41
您的 centos + Nginx + phpcgi配置怎么还没出来呢,我都等疯了。。。
johnathan Homepage
2008-11-24 15:08
你网站东西很多啊,
zzzzz
2008-12-25 22:50
700request 不算多
mk2 Email
2009-4-24 15:29
700 r/s还可以啦,目前我使用django,在只是动态输出字符串的情况下,最高可以到2k r/s...看来全靠动态是不行的smoke
dd
2009-11-20 09:28
你这个日志全部是php日志?没有图片日志?
henter Homepage
2010-4-29 09:17
好强~~ 膜拜中~~
游客 Homepage
2011-10-28 19:02
学习到东西了
游客 Homepage
2011-10-28 19:04
我的网站银点网使用的就是nginx+php-fpm结构,有意限定php-fpm的数量以保证后台的mysql不超负荷。效果很好。跟你的博文可以说是最好的论证。
gff299nbvc Email Homepage
2011-10-28 21:57
实习生李雅洁 蒋琳     本报记者刘志杰 长沙报道

    1995年,湖南籍男子刘爱民在广东抢夺金项链,被判5年有期徒刑,服刑于广东省乐昌监狱。服刑仅3个月,趁看守人员不注意,他逃出监狱,潜逃全国各地,并结婚生子。

    今年7月27日晚9时许,四位天心区裕南街派出民警在辖区内抓获了化名为“肖爱明”的刘爱民,监狱逃犯最终落入法网,至此他已逃亡16年。目前,刘爱民已被移送广东警方。

    16年前趁劳作时间越狱

    1995年,23岁的刘爱民(湖南石门人)在广东因伙同他人抢夺金项链被判有期徒刑5年。入狱三个月,刘爱民趁劳作时间监管松懈,逃出监狱,随后流浪广州、湖南等地,四处逃窜,以打临时工谋生。1998年,moncler kids jackets,刘爱民趁办理第二代身份证之际,将自己姓氏改动,随母亲姓“肖”,取名肖爱明继续潜逃生活。

    日子走到越狱后的第16个年头。自今年公安部开展“清网行动”以来,广东警方对在逃犯进行又一轮的清理排查,根据其儿子的就读情况,发现了湖南籍逃犯刘爱民的近况。

    今年7月25日,裕南街派出所副所长谭永岩接到来自广东的信息:“一名广东监狱逃犯刘爱民更名为肖爱明,于2002年潜伏到裕南街辖区内。”据此,裕南街派出所民警查到了“肖爱明”的出租房地址及妻子姓名。但经核实,其住址为虚假信息,louis vuitton damier bags

    隐姓埋名结婚生子还是被查获

    谭永岩组织社区警力,结合“6・28”专案清查行动,通过社区流动人口登记,全面摸排“肖爱明”行踪。

    警方根据“肖爱明”这个名字,查到一名外来务工男子,曾于去年6月在南站社区长沙防火装备厂做临时工。但前往该厂调查时,警方发现肖爱明已经离职,去向不明。但警方初步判断,肖爱明应该居住在附近,moncler online shop

    日前,南站社区民警在社区清理排查外来人员时,发现有一名女子与肖爱明妻子姓名一致。但面对民警的询问,该女子表示“我一个人带个崽”。当晚民警蹲点守候到晚上9时许,发现一名男子回到此处,外貌特征和“肖爱明”十分相似,初步确定了“肖爱明”的躲藏地址,其职业为电器维修。

    7月27日晚9点,裕南街谢家冲,四位民警看到“肖爱明”走进家门,立即上前表示电器维修需要许可证。“我现在不做了,这些工具只是放在家。”面对突然出现的民警,“肖爱明”解释。“你以前不是用这个名字吧?”“我一直叫这个名字啊。”“肖爱明”嘴上不承认,脸色却忽然变了。

    通过照片和指纹对比,警方确定此“肖爱明”就是16年前从广东乐昌监狱越狱的刘爱民。面对确凿的证据,刘爱民供认不讳。目前,已移交广东警方,Louis Vuitton Anniversary

欢迎发表评论我要评论
微博推荐 | 今日微博热点
co510314 Email Homepage
2011-10-29 10:00
1、有为有不为,知足知不足;锐气藏于胸,和气浮于面;才气见于事,义气施于人。  

   2、心小了,所有的小事就大了;心大了,所有的大事都小了;看淡世事沧桑,内心安然无恙。
    
       3、大其心,容天下之物,虚其心,爱天下之善,平其心,论天下之事,潜其心,观天下之理,定其心,应天下之变。
    
       4、大事难事,看担当;逆境顺境,看胸襟;是喜是怒,看涵养;有舍有得,看智慧;是成是败,看坚持。    

  5、走正确的路,放无心的手,结有道之朋,断无义之友,饮清净之茶,戒色花之酒,开方便之门,闭是非之口。
    
       6、凡事顺其自然;遇事处之泰然;得意之时淡然;失意之时坦然;艰辛曲折必然;历尽沧桑悟然。
    
       7、投资人的失败不是市场的结果,消灭我们的往往就是我们自己。尤其是在市场风声鹤唳的时候,也许我们更应该保持一份冷静:也许事情没有像想象的那么坏!同样在市场人声鼎沸的时候,也应该保留一份平和:也许事情没有想象的那么好!
    
       8、天黑的时候直面艰难,本身就是您未来获得收获的源泉,因为天下没有不付出的收获。天黑,其实只不过是天亮前的一个过程,又何必大惊小怪。天一定会亮的,关键是天亮的时候您还在吗?成功和失败也许就是在天亮以前,最黑暗的一刻坚守与放弃的区别,坚守者成了成功者,甚至成了我们景仰的投资大师,而放弃的人就成了“先驱”――先行而死了的人。
    
     9、世界上聪明的人特点千差万别,愚蠢的人有一个共同的特点:总以为自己是聪明人。

    
     10、财富是流动的,您的心胸和视野也许正是财富获取的源泉。有多大的心胸做多大的事业,有多远的视野聚拢多大的财富。
    
     11、我们与成功之间并不遥远,许多非凡的成就只不过是简单坚持的结果,关键是要守住你的心!
    
     12、社会财富演进的速度不会因您发生改变,关键是您今天真的准备好了吗?寻求财富的路上,过程的美丽与结果的绚烂通常不会同时出现。苦苦寻觅财富,却未必得到财富。尽心竭力做好过程、正确的过程,却可以实现财富自由。
    
     13、世界上越是复杂的问题越有一个简单的解;越是大的道理越是简单而朴素的!所谓“大道至简”。
    
     14、我们通常只是简单地和下意识地去做一件事情,却没有事先问一问自己:“这样做真的对吗?”
    
     15、如果你心里阳光明媚,天就总是蓝的;如果你心里阴云密布,天就总是灰的。阳光明媚的投资者可能赢得幸福,因为在他们的投资过程中没有牛市和熊市,只有收获的时刻和等待收获的过程。并会怀着感激之心与大家一起分享成功的道理。阴云密布的投资者将会饱受痛苦煎熬因为在他们的投资过程中,有的只是恐慌和担心下一个恐慌什么时间到来的过程。并且最后赢得感慨的权利,在别人收获的时节,感慨为什么成功的又不是我!
video2lady Email Homepage
2011-10-29 10:33
Rip Blu-ray to WMV with Holeesoft Blu-ray to WMV Ripper
Have you found an easy way to transfer blu-ray disc into wmv video format? Holeesoft Blu-ray to WMV converter is made especially for windows users, which allows you to convert blu-ray movie to wmv file playable on various WMV players.
Holeesoft Blu-ray to WMV Ripper Main Functions
1. Convert Blu-ray to WMV video format.
2. Output Devices Supported: Zune, Creative Zen, Dell Axim, General Pocket PC, Palm, HP iPAQ, Xbox360, etc.
http://download.cnet.com/Holeesoft-Blu-ray-DVD-to-WMV-Converter/3000-2194_4-75448230.html
vjs8ni0ave Email Homepage
2011-10-29 11:36
,north face male hoody

| Back to logs list
405229 2007年02月11日13:14 Reading (loading. ..) Comments ( 0 ) Category : Personal Diary


| Back to logs list
  express cancel


the other:

  
   ferragamo shoes on sale  girl
  
   You bad
  
   A set of teaching materials for children to learn good English ( Complete )
louis vuitton uk Email Homepage
2011-11-23 08:59
This louis vuitton uk for sale belongs to the sounding just what are termed as Louis Vuitton vintage best sellers, many other products and services for the reason that range appearing companies.You will easily notice the unfold zippers of this coach outlet store online. That is the decoration. There are some inside pockets for you as well. They are easy to match your clothes and to carry.Let us inspire your inner beauty with fine christian louboutin sale. Purse the elegance in bridal wedding. Enjoy the fashion.
窝下载 Homepage
2011-12-5 22:34
窝下载 每个单秒的请求负载很高
coach factory outlet Email Homepage
2012-5-17 11:25
Today, following half a century, mentor leather-bases coach factory outlet continues to be the delicate craft of leather-based master is accountable for,Would you like to meet more friends, or go with the times? If yes, coach factory online is opening welcome doors to you.in the market you definitely can find various colorways that are designed in as well as the high quality that applied in. For most of you would like to come. So just come to our coach factory outlet online store to choose one.
louis vuitton sale Email Homepage
2012-5-17 11:25
Louis Vuitton belt at louis vuitton sale is one kind of fashion accessory with high cost performance among the Louis Vuitton accessories.Offering quality LV products with favorable prices, louis vuitton outlet store is at your service. Hurry up, or you can not seize the chance.in fact, louis vuitton is one of the most famous fashion design master.he opened the fist suitcase shop called after his name.
coach outlet online Email Homepage
2012-5-17 11:26
I heard of coach outlet online through the advertisement when I was shopping. And now I often brow the webpage and buy Coach bags online.It is a symbol regarding position not to mention nature.Here I would like to launch a excellent bags pertaining to business men.Which may be coach outlet store.coach outlet has always been simple,durable style features to win consumers.The products are more flexible,with easy bleaching,wear characteristics,and simply use a damp cloth.
coach outlet, Email Homepage
2012-5-17 11:26
Remember the coach outlet provide coach bags which won't be deteriorated into its overall styles by any means. It will maintain its looks, colors, and uniqueness for long time.coach outlet store online has been voted by Hour Detroit magazine readers as the Best of Detroit in their 12th annual readers'poll.Lots of women like which usually amount normally include a coach outlet online ,it provides coziness to many girls that don't even think it is a great bushel of great interest directly to them.
xujie777 Email
2012-5-18 16:24
We aim to make all our customers satisfy with our products. You will find a variety of Men's fashion louis vuitton uk, fashion Women's cheap Louis Vuitton bags in our store at affordable price.Thinking of interesting ways to cost a milestone birthday? louis vuitton online shop had one of the most distinctive distinctive celebrations.bakery along with living room operated by means of about three moment louis vuitton online Most effective Pastry Chef’s of the year Rammy Nominee Chef’s.
xujie777 Email
2012-5-18 16:25
The choices are likely to be basically countless seeing that louis vuitton outlet occurs with the help of completely new and also incredible concepts once in a while.Louis vuitton Wholesale Monogram Canvas HandbagsLouis Vuitton Collection Beach Handbags louis vuitton bags outlet Damier Canvas HandbagsLouis vuitton Mahina HandbagsLouis Vuitton Monogram Mini Lin HandbagsLouis Vuitton Monogram Multicolore HandbagsLouis vuitton Monogram Vernis HandbagsLouis Vuitton Wholesale Epi Leather HandbagsLouis Vuitton For Men HandbagsLouis Vuitton Damier Canvas WalletsLouis Vuitton Epi Leather WalletsLouis Vuitton Monogram Canvas WalletsLouis Vuitton Monogram Vernis WalleLouis Vuitton ShoesLouis Vuitton Men wallets.As the Authentic Louis Vuitton are so high-priced, so came the louis vuitton handbags outlet.
分页: 2/6 第一页 上页 1 2 3 4 5 6 下页 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]