|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的好朋友们!一.成绩来历
想失掉以后互联网公司的webserver是哪一个范例的?(ApacheNginxLighttpd)以是编写此步伐。次要统计百度Googlealibabatencent(qq)taobaorenrensina京东凡客yahoo昌大网易搜狐畅游等公司的webserver。固然,也有大概失掉的是反向代办署理办事器。这得详细看公司的背景体系架构了。
二.步伐
1.源码
viab.sh
[c-sharp]viewplaincopyhttp://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf
- #!/bin/bash
- #authorlongxibendi
- #bloghttp://blog.csdn.net/longxibendi
- #functiongetthewebserversinformationofcompanies
- if[-e/tmp/web_server.log];then
- rm-f/tmp/web_server.log
- fi
- if[-e/tmp/ab.log];then
- rm-f/tmp/ab.log
- fi
- forcompany_nameintaobao360buydangdangvanclmbaobaoalibaba谷歌百度yahoosinasohuren
- renchangyouwanmeisdo126163139
- do
- {
- ab-n1-c1http://www.${company_name}.com/index.html|tee/tmp/ab_${company_name}.log2>&1
- if[$?-eq0];then
- printf"%15s,%20s/n""${company_name}.com","`cat/tmp/ab_${company_name}.log|grep"Server
- Software"`">>/tmp/web_server.log
- fi
- sleep2
- }&
- done
- wait
- echo"ItisOK"
2.申明&实行步伐
经由过程ab网站主页,然后把失掉信息重定向到一个文件中,然后再从该文件中过滤信息,一致纪录到/tmp/web_server.log中
[c-sharp]viewplaincopyhttp://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf
- [root@localhostDesktop]#chmoda+xab.sh
- [root@localhostDesktop]#./ab.sh>/dev/null
3.实行了局,经由过程检察/tmp/web_server.log失掉网站webserver信息(有多是反向代办署理办事器)
[c-sharp]viewplaincopyhttp://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf
- [root@localhostDesktop]#cat/tmp/web_server.log
- 360buy.com,,ServerSoftware:jdws
- taobao.com,,ServerSoftware:nginx
- mbaobao.com,,ServerSoftware:
- 百度.com,,ServerSoftware:BWS/1.0
- renren.com,,ServerSoftware:nginx/0.7.67
- 谷歌.com,,ServerSoftware:gws
- changyou.com,,ServerSoftware:Apache
- sina.com,,ServerSoftware:Apache/2.0.63
- alibaba.com,,ServerSoftware:Apache/2.2.15
- 126.com,,ServerSoftware:Apache
- vancl.com,,ServerSoftware:Microsoft-IIS/6.0
- wanmei.com,,ServerSoftware:nginx
- sdo.com,,ServerSoftware:SVS
- sohu.com,,ServerSoftware:SWS
- dangdang.com,,ServerSoftware:nginx/0.7.61
- yahoo.com,,ServerSoftware:YTS/1.20.0
- 139.com,,ServerSoftware:Apache
- 163.com,,ServerSoftware:nginx
4.复杂剖析了局
sohu.com用的webserver是SWS(这个有多是本人开辟的,有多是用的SWS)
谷歌.com用的webserver是gws
百度.com用的webserver是BWS
taobao.com用的webserver是nginx
另有良多,看3的了局
三.伪多线程与单历程剧本对照
1.先看单历程的步伐
vi1_ab.sh
[c-sharp]viewplaincopyhttp://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf
- #!/bin/bash
- #authorlongxibendi
- #bloghttp://blog.csdn.net/longxibendi
- #functiongetthewebserversinformationofcompanies
- if[-e/tmp/web_server.log];then
- rm-f/tmp/web_server.log
- fi
- if[-e/tmp/ab.log];then
- rm-f/tmp/ab.log
- fi
- forcompany_nameintaobao360buydangdangvanclmbaobaoalibaba谷歌百度yahoosinasohurenrenchangyouwanmeisdo126163139
- do
- #{
- ab-n1-c1http://www.${company_name}.com/index.html|tee/tmp/ab.log2>&1
- if[$?-eq0];then
- printf"%10s,%20s/n""${company_name}.com","`cat/tmp/ab.log|grep"ServerSoftware"`">>/tmp/web_server.log
- fi
- #sleep3
- #}&
- done
- wait
- echo"ItisOK"
2.申明
下面的单历程步伐,只用一个历程完成,很复杂就不注释了。详细统计webserver完成与伪多线程步伐相似
3.两步伐实行效力对照
[c-sharp]viewplaincopyhttp://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf
- [root@localhostDesktop]#time-p./1_ab.sh>/dev/null
- real12.54
- user0.03
- sys1.74
- [root@localhostDesktop]#time-p./ab.sh>/dev/null
- real11.20
- user0.07
- sys2.00
4.剖析
能够看到伪多线程步伐分明比单历程步伐快
实在,假如在实行ab.sh的时分能够ps-ef|grepab.sh一下,就会发明分歧了
<divclass="dp-highlighterbg_c-sharp"style="font-family:Consolas,CourierNew,Courier,mono,serif;background-color:rgb(231,229,220);width:700.9166870117188px;overflow:auto;padding-top:1px;margin:18px0px!important;">[c-sharp]viewplaincopyhttp://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf
<olclass="dp-c"start="1"style="margin:0px0px1px45px!important;padding-right:0px;padding-left:0px;border:none;list-style-position:initial;list-style-image:initial;background-color:rgb(255,255,255);color:rgb(92,92,92);"><liclass="alt"style="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;">[root@localhost~]#ps-ef|grepab.sh<listyle="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;background-color:rgb(248,248,248);line-height:18px;">root268465761102:15pts/100:00:00/bin/bash./ab.sh<liclass="alt"style="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;">root2685426846002:15pts/100:00:00/bin/bash./ab.sh<listyle="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;background-color:rgb(248,248,248);line-height:18px;">root2685726846002:15pts/100:00:00/bin/bash./ab.sh<liclass="alt"style="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;">root2685926846002:15pts/100:00:00/bin/bash./ab.sh<listyle="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;background-color:rgb(248,248,248);line-height:18px;">root2686526846002:15pts/100:00:00/bin/bash./ab.sh<liclass="alt"style="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;">root2687126846002:15pts/100:00:00/bin/bash./ab.sh<listyle="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;background-color:rgb(248,248,248);line-height:18px;">root2687426846002:15pts/100:00:00/bin/bash./ab.sh<liclass="alt"style="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;">root2687526846002:15pts/100:00:00/bin/bash./ab.sh<listyle="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;background-color:rgb(248,248,248);line-height:18px;">root2688626846002:15pts/100:00:00/bin/bash./ab.sh<liclass="alt"style="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;color:inherit;line-height:18px;">root2688926846002:15pts/100:00:00/bin/bash./ab.sh<listyle="margin:0px!important;padding:0px3px0px10px!important;border-style:nonenonenonesolid;border-left-width:3px;border-left-color:rgb(108,226,108);list-style:decimal-leading-zerooutside;background-color:rgb(248,248,248);line-height:18px;">root2689226846002:15pts/100:00:00/bin/bash./ab.sh |
|