Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Nginx + PHP£¨FastCGI£©¡±Web·þÎñÆ÷

   ÏÂÃæÊÇÓÃ100¸ö²¢·¢Á¬½Ó·Ö±ðȥѹÉú²ú»·¾³ÖÐͬһ¸ºÔؾùºâÆ÷VIPÏ¡¢ÌṩÏàͬ·þÎñµÄÁ½Ì¨·þÎñÆ÷£¬Ò»Ì¨ÎªNginx£¬Áíһ̨ΪApache£¬NginxÿÃë´¦ÀíµÄÇëÇóÊýÊÇApacheµÄÁ½±¶¶à£¬Nginx·þÎñÆ÷µÄϵͳ¸ºÔØ¡¢CPUʹÓÃÂÊÔ¶µÍÓÚApache£º
¡¡¡¡Äã¿ÉÒÔ½«Á¬½ÓÊý¿ªµ½10000¡«30000£¬È¥Ñ¹NginxºÍApacheÉϵÄphpinfo.php£¬ÕâÊÇÓÃä¯ÀÀÆ÷·ÃÎÊNginxÉϵÄphpinfo.phpÒ»ÇÐÕý³££¬¶ø·ÃÎÊApache·þÎñÆ÷µÄphpinfo.php£¬ÔòÊǸÃÒ³ÎÞ·¨ÏÔʾ¡£4GÄÚ´æµÄ·þÎñÆ÷£¬¼´Ê¹ÔÙÓÅ»¯£¬ApacheÒ²ºÜÄÑÔÚ“webbench -c 30000 -t 60 http://xxx.xxx.xxx.xxx/phpinfo.php”µÄѹÁ¦Çé¿öÏÂÕý³£·ÃÎÊ£¬¶øµ÷Õû²ÎÊýÓÅ»¯ºóµÄNginx¿ÉÒÔ¡£
¡¡¡¡webbench ÏÂÔصØÖ·£ºhttp://blog.s135.com/post/288/
¡¡¡¡×¢Ò⣺webbench ×öѹÁ¦²âÊÔʱ£¬¸ÃÈí¼þ×ÔÉíÒ²»áÏûºÄCPUºÍÄÚ´æ×ÊÔ´£¬ÎªÁ˲âÊÔ׼ȷ£¬Ç뽫 webbench °²×°ÔÚ±ðµÄ·þÎñÆ÷ÉÏ¡£
¡¡¡¡²âÊÔ½á¹û£º##### Nginx + PHP #####
ÒýÓÃ
[root@localhost webbench-1.5]# webbench -c 100 -t 30 http://192.168.1.21/phpinfo.php
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http://192.168.1.49/phpinfo.php
100 clients, running 30 sec.
Speed=102450 pages/min, 16490596 bytes/sec.
Requests: 51225 susceed, 0 failed.
top - 14:06:13 up 27 days,  2:25,  2 users,  load average: 14.57, 9.89, 6.51
Tasks: 287 total,   4 running, 283 sleeping,   0 stopped,   0 zombie
Cpu(s): 49.9% us,  6.7% sy,  0.0% ni, 41.4% id,  1.1% wa,  0.1% hi,  0.8% si
Mem:   6230016k total,  2959468k used,  3270548k free,   635992k buffers
Swap:  2031608k total,     3696k used,  2027912k free,  1231444k cached
¡¡¡¡²âÊÔ½á¹û£º#####  Apache + PHP #####
ÒýÓÃ
[root@localhost webbench-1.5]# webbench -c 100 -t 30 http://192.168.1.27/phpinfo.php
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http://192.168.1.45/phpinfo.php
100 clients, running 30 sec.
Speed=42184 pages/min, 31512914 bytes/sec.
Requests: 2109


Ïà¹ØÎĵµ£º

ËÑË÷ÒýÇæ¼¼ÊõºËÐĽÒÃÜ(PHP°æ)

     ̸µ½ÍøÒ³ËÑË÷ÒýÇæʱ£¬´ó¶àÊýÈ˶¼»áÏëµ½ÑÅ»¢¡£µÄÈ·£¬ÑÅ»¢¿ª´´ÁËÒ»¸ö»¥ÁªÍøÂçµÄËÑË÷ʱ´ú¡£È»¶ø£¬ÑÅ»¢Ä¿Ç°ÓÃÓÚËÑË÷ÍøÒ³µÄ¼¼ÊõÈ´²¢·Ç¸Ã¹«Ë¾Ô­ÏÈ×Ô¼º¿ª·¢µÄ¡£2000Äê8Ô£¬ÑÅ»¢²ÉÓÃÁËGoogle£¨www.google.com£©Õâ¼ÒÓÉ˹̹¸£´óѧѧÉú´´½¨µÄ·çÏÕ¹«Ë¾µÄ¼¼Êõ¡£ÀíÓɷdz£¼òµ¥£¬GoogleµÄËÑË÷ÒýÇæ±ÈÑÅ»¢ÏÈǰʹÓÃµÄ ......

PHP×öWebÏîÄ¿µÄÓÅȱµã

PHPµÄÓŵ㣺
¡¡¡¡1. ¿çƽ̨£¬ÐÔÄÜÓÅÔ½£¬¸úLinux/Unix½áºÏ±ð¸úWindows½áºÏÐÔÄÜÇ¿45%£¬²¢ÇҺͺܶàÃâ·ÑµÄƽ̨½áºÏ·Ç³£Ê¡Ç®£¬±ÈÈçLAMP(Linux/Apache/Mysql/PHP)»òÕßFAMP(FreeBSD/Apache/Mysql/PHP)½áºÏ£¬»òÕßÊý¾ÝÓ¦Óù»´ó¿ÉÒÔ¿¼ÂÇ»»PostgreSQL»òÕßOracle£¬Ö§³ÖNÖÖÊý¾Ý¿â¡£(N >= 10)
¡¡¡¡2. Óï·¨¼òµ¥£¬Èç¹ûÓÐѧϰCºÍPerlµÄº ......

phpÏîÄ¿¿ò¼ÜÉè¼Æ

Ò»¡¢¸ÅÊö
ÒòΪ×î½üСÏîÄ¿±È½Ï¶à£¬¶øÇÒÏîÄ¿Ö®¼äµÄÖظ´¶ÈÓֱȽϴó£¬ËùÒÔ¸ãÁËÒ»¸öÏîÄ¿¿ò¼ÜËƵĶ«Î÷£¬±ß×ö±ßÐ޸ġ£
Ä¿Ç°ÀïÃæÒѾ­ÈÝÄÉÁ˲»ÉÙ¼¸¸öÏîÄ¿£¬Ò²¸ãÁËЩÀàËÆ»ù´¡¹¹¼þÒ»ÑùµÄ¶«Î÷£º
flykobe@105 quick $ ls -FX
 inc/      jzj/  m2/      mstatic/  t/     te ......

phpÖмòµ¥µÄ·ÖÒ³

<%
rs.pagesize=14
page=cint(Request.QueryString("page"))
if page<1 then
page=1
elseif page>rs.pagecount then
page=rs.pagecount
end if
rs.AbsolutePage=page
IF rs.BOF and rs.eof then
Response.Write("<br><br>±¾Õ¾ÔÝÎÞÈÕÖ¾¼Ç¼£¡£¡<br><br>")
response.end
end if ......

PHP MKTIME

ͻȻÏëÆðÁËÔÚÒ»´ÎÃæÊÔµÄʱºòÒªÎÒд³öδÀ´Ò»ÌìÊÇÐÇÆÚ¼¸£¬µ±Ê±Ã»Óиøд³öÀ´¡£ÏÖÔÚÏëÏ뻹ÊǾõµÃ¶ÔdateºÍmktimeµÄ¸ÅÄîºÜÄ£ºý£¬ÔÚÕâÀï¼Ç¼ÏÂÒÔ±¸ºóÓ㺳ÌÐòÈçÏÂ
<?php
echo date( "l dS 0f F Y h£ºi£ºs A" );
echo "<br>";
print("July 1, 2010 is on a " . date("l", mktime(0,0,0,7,11,2010)));
?>
Êä³ö½á¹û ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ