¾ÆÆÄÄ¡ Æ©´× Á¤¸®
±Û   ¾´   ÀÌ linux
³¯         Â¥ 2003³â 03¿ù 21ÀÏ 23½Ã 32ºÐ 07ÃÊ
º»         ¹® 1. À¥ ÆäÀÌÁö ·Îµù½Ã°£ È®ÀÎ
#time -pa lynx -source http://www.gwise.com > /dev/null
real 0.74
user 0.16
sys 0.09
-------------
½ÇÁ¦ Á¢¼Ó½Ã°£ : 0.74-(0.16+0.09)=0.49ÃÊ

2. ¾ÆÆÄÄ¡ º¥Ä¡ ¸¶Å·
#man ab »ç¿ë¹ý º¸±â
-n requests ¿äûÀ» ¼öÇàÇÒ °³¼ö
-c concurrency ¿äûÀ» ¸¸µé °³¼ö·Î µ¿½Ã »ç¿ëÀÚ °³³äÀ¸·Î ÀÌÇØÇÏ¸é µÇ°Ú´Ù.
-v verbosity ¾ó¸¶³ª ÀÚ¼¼ÇÑ Á¤º¸¸¦ È­¸é¿¡ Ãâ·ÂÇØ ÁÙ °ÍÀÎÁö °áÁ¤
-w HTML ¹®¼­Çü½ÄÀ¸·Î Å×À̺í·Î ¸¸µé¾î °á°ú¸¦ È­¸é¿¡ Ãâ·Â
-k HTTP ÇÁ·ÎÅäÄÝÀÇ Áö¼Ó¿¬°á (KeepAlive) ±â´ÉÀ» »ç¿ë

#./ab -n 100 -c 10 http://www.gwise.com:80/
10 ¸íÀÇ À¯Àú°¡ µ¿½Ã¿¡ http://www.gwise.com/index.html À» ¿äûÇÏ´Â °ÍÀ» ¸ð
ÀÇ ½ÇÇè.
°¢°¢ÀÇ ½Ã¹Ä·¹ÀÌÆ® À¯Àú´Â ¿äûÀ» 10 ¹ø¾¿ ÇÏ°Ô µË´Ï´Ù

# ab -n 1500 -c 50 http://www.apache.kr.net:80/
¿äûÀ» 30 x 50 (50 ¸íÀÇ »ç¿ëÀÚ°¡, °¢°¢ 30 ¹øÀÇ ¿äû)

Requests per second: 80.48
ÃÊ´ç 80.48°³¸¦ ¿äû ÇßÀ½.

'MaxRequestsPerChild¡¯ ´Â ¸Þ¸ð¸® ´©¼öÇö»ó(?) µîÀÌ ¹ß»ýÇÏÁö ¾Ê´Â´Ù¸é °¡´É
ÇÑ ÀÌ °ªÀ» ³ô°Ô ¼³Á¤ÇϽðí¿ä(ÆĶó¹ÌÅÍÀÇ °ªÀ» 0 À¸·Î ¼³Á¤ÇØ ¹«ÇÑ´ë·Î ÇϽÇ
¼öµµ ÀÖ½À´Ï´Ù) StartServers¡¯ ´Â ÇÁ·Î¼¼½º°¡ active µÇ¾î ÀÖ´Â °æ¿ì°¡ ÀûÀ»
°æ¿ì °ªÀ» ³·°Ô ¼³Á¤ÇϽðí, Á¢¼Ó·®ÀÌ ¾ÆÁÖ ¸¹À» °æ¿ì´Â MaxClients ¿¡ °¡±õ
°Ô Á¶ÀýÇϽñ⠹ٶó¸ç, MaxSpareServers ¸¦ MaxClients ¿Í °°°Ô ¼³Á¤ÇÕ´Ï´Ù.
MaxClients ´Â ³Ê¹« ³·°Ô ¼³Á¤ÇÏÁö ¾Êµµ·Ï ÁÖÀÇÇϽñ⠹ٶó¸ç, ±×·¸´Ù°í ¶Ç ³Ê
¹« Å©°Ô ÀâÀ¸¼Åµµ ¾ÈµË´Ï´Ù


3. À¥ ¼­¹ö »ðÁú ¸·±â
BrowserMatch "WebZip" go_out
BrowserMatch "Teleport" go_out
BrowserMatch "GetRight" go_out



....
Deny from env=go_out


4. ¾ÆÆÄÄ¡ Æ©´×
ÀÏ¹Ý ¼­¹ö¿¡¼­´Â ´Ù¸¥°ÍÀº ±×³É Default °ªÀ¸·Î µÐ´Ù.
(´ëÇü ¼­¹öÀÇ °æ¿ì ¸»°í´Â ƯÈ÷ ¾µ ÀÏ¾î ¾øÀ» °ÍÀÌ´Ù.)

Áõ°¡ ½Ãų °æ¿ì ¹è¼ö·Î ÇÑ´Ù. ²À ÀÌ·¸°Ô ÇØ¾ß ÇÑ´Ù°¡ ¾Æ´Ï¶ó
ÀÌ·¸°Ô Çϸé ÁÁ´Ù.

Timeout 300
Ŭ¶óÀ̾ðÆ®ÀÇ ¿äû¿¡ ÀÇÇؼ­ Server¿Í ¿¬°á µÇ¾úÀ»¶§
Ŭ¶óÀ̾ðÆ®¿Í ¼­¹ö°£ÀÇ ¾Æ¹«·± ¸Þ½ÃÁö°¡ ¹ß»ýÇÏÁö ¾Ê¾ÒÀ»¶§
¿À·ù·Î ó¸®ÇÏ´Â ½Ã°£
³×Æ®¿öÅ© ¼Óµµ°¡ ³ª»Ü¼ö·Ï ¼öÄ¡°ªÀ» ³ô°Ô ÇÑ´Ù.

KeepAlive on
Áö¼ÓÀûÀÎ Á¢¼Ó, Áï ¼­¹ö ¿¬°á¿¡ ´ëÇÏ¿© Çѹø ÀÌ»óÀÇ ¿äûÀ» Çã¿ë ¿©ºÎ.

MaxKeepAliveRequests 100
Ŭ¶óÀ̾ðÆ®°¡ Á¢¼ÓµÈ ½Ã°£µ¿¾È ¾ÆÆÄÄ¡ ¼­¹ö¿¡ ¿äûÇÒ ¼ö Àִ ó¸® process °³
¼ö

StartServers 5 X ? =20 -> Ãʹݿ¡ ¶ã process ±× ÀÌ»ó ±×ÀÌÇÏÀÇ Àǹ̵µ ¾ø
´Ù.
MinSpareServers 5 X ? =20 -> Spare ÇÁ·Î¼¼½º°¡ ÀÌ°Í ÀÌÇÏ À϶§ ²ø¾î ¿Ã·Á
ÁØ´Ù.
MaxSpareServers 10 X ? =40 -> Spare ÇÁ·Î¼¼½º°¡ ÀÌ°Í ÀÌ»ó À϶§ ÁøÁ¤(?)½Ã
ÄÑ ÁØ´Ù.
¸» ±×´ë·Î Spare.... ¾ðÁ¦ ÀÖÀ»Áö ¸ð¸¦ ¿äû¿¡ ´ëÇؼ­ ÄÄÇ»ÅÍ ½º½º·Î°¡
Á¶ÀýÇØ ÁØ´Ù.

MaxClients 150
Ŭ¶óÀ̾ðÆ®µéÀÌ µ¿½Ã¿¡ ÃÖ´ë·Î Á¢¼ÓÇßÀ»¶§ °¡´ÉÇÑ ÃÖ´ë ¼­¹öÀÌ ¼ö¸¦ ÁöÁ¤.
Ulimit -a ~~~ max process...ÀÌ ¼öÄ¡ ÀÌ»ó Áõ°¡ ¸øÇÔ.
httpd.h
HARD_SERVER_LIMIT=250 Á¶Á¤Çؼ­ ´Ù½Ã ÄÄÆÄÀÏ °¡´É

MaxClient 150 -> µ¿½Ã¿¡ ¶° ÀÖÀ»¼ö ÀÖ´Â ÃÖ´ë process
´õ ¸¹Àº ¼ö¸¦ ¿øÇҽà httpd.h ¼Ò½º ÆÄÀÏÀÇ
HARD_SERVER_LIMIT °ªÀ» ¼öÁ¤ ÇÑ ´ÙÀ½ ´Ù½Ã ÄÄÆÄÀÏ ÇØ¾ß ÇÑ´Ù.

#ulimit -a
core file size (blocks) 0
data seg size (kbytes) unlimited
file size (blocks) unlimited
max memory size (kbytes) unlimited
stack size (kbytes) 8192
cpu time (seconds) unlimited
max user processes 2048
pipe size (512 bytes) 8
open files 1024
virtual memory (kbytes) 2105343
-----------------------
À§ÀÇ max user processes ÀÇ ¼ö¸¦ ÃÊ°ú ÇÒ ¼ö ¾ø´Ù.

MaxRequestPerChild 100
ÇÑ ÇÁ·Î¼¼½º°¡ ¸î ¹øÀÇ ¼­ºñ½º¸¦ ÇÏ°í ¼Ò¸êµÉ °ÍÀÎÁö Á¤ÇÑ´Ù.
M$°è¿­¿¡¼­´Â º° Àǹ̰¡ ¾øÀ¸¹Ç·Î 0À» ÇÑ´Ù.
ÇÏÁö¸¸ Unix °è¿­Àº 0À» »ç¿ëÇÏÁö ¾Ê´Â °ÍÀÌ ÁÁ´Ù.

°¡Àå Áß¿äÇÑ °ÍÀºTimeout ¼³Á¤ÀÔ´Ï´Ù. À§¿¡¼­ keep-alive ¸¦ ¼³Á¤ÇØ ³õÀº
°æ¿ì, ÇϳªÀÇ connection¿¡¼­ °è¼ÓÇؼ­ ´ÙÀ½ request¸¦ ó¸®ÇÒ ¼ö Àֱ⠶§¹®
¿¡ È¿À²Àû
À̶ó°í ÇÏÁö¸¸, ½ÇÁ¦·Î´Â ±×·¸Áö ¾Ê½À´Ï´Ù. keep-alive ¸¦ Çã¿ëÇÏ°í ±×
timeoutÀ»
5Ãʷθ¸ ¼³Á¤Çصµ, ÇϳªÀÇ request¸¦ ó¸®ÇÑ ÈÄ Àû¾îµµ 5Ãʵ¿¾ÈÀº ±× httpd°¡
´Ù¸¥
ÀÛ¾÷À» ÇÏÁö ¸øÇÏ°í ´ÙÀ½ request¸¦ ±â´Ù¸®°Ô µË´Ï´Ù.

º¸Åë À¥ºê¶ó¿ìÀúµéÀº ¼­¹ö·Î µ¿½Ã¿¡ 4°³ÀÇ connectionÀ» ¸¸µé°Ô µË´Ï´Ù. ÇÑ Æä
ÀÌÁö¸¦
º¸´Âµ¥ À̹ÌÁö µîµî Çؼ­ º¸Åë 4°³ÀÇ connectionÀ» ¸¸µå´Â °ÍÀº ±âº»ÀÌÁÒ. ÀÌ
·¸°Ô µÇ¸é
httpd°¡ 100°³ ¶° ÀÖ´Ù°í Çصµ, ½ÇÁ¦·Î´Â µ¿½Ã¿¡ 25¸íÀÇ ¹æ¹®ÀÚ¹Û¿¡ ó¸®ÇÏÁö
¸øÇÕ´Ï´Ù.

±×¸®°í keep-alive timeoutÀÌ 5ÃÊÀÎ °æ¿ì, ÇÑ ¸íÀÇ ¹æ¹®ÀÚ¸¦ ó¸®ÇÑ ÈÄ Àû¾î
µµ 5Ãʵ¿¾ÈÀº
°è¼ÓÇؼ­ ±â´Ù¸®¸é¼­ httpd°¡ ³î°Ô µË´Ï´Ù.(±×·¸´Ù°í Çؼ­ httpdÀÇ ¼ö¸¦ ´Ã¿©
ÁÖ¸é ¾ÕÀÇ
¹®Á¦ ¶§¹®¿¡ load°¡ ¸ô¸± ¶§ ¼ø°£ÀûÀ¸·Î ºÎÇÏ°¡ Áö³ªÄ¡°Ô ¸¹ÀÌ °É¸®°Ô µË´Ï
´Ù. ¾î¶²
request´Â ¼öÃÊ°¡ Áö³­ ÈÄ ´äÀ» ¹Þ´Â µî quality of service°¡ ¸¹ÀÌ ¶³¾îÁö
ÁÒ.)

°á±¹ ÇÑ ¸íÀÇ ¹æ¹®ÀÚ¸¦ ó¸®Çϴµ¥ 4°³ÀÇ httpd°¡ 5Ãʵ¿¾È ÀÛ¾÷ÇÑ´Ù´Â ¶æÀÌ
°í, 100°³ÀÇ
httpd¸¦ ¶ç¿öºÁ¾ß 1ÃÊ¿¡ 5¸íÀÇ ¹æ¹®ÀÚ¹Û¿¡ ó¸®ÇÏÁö ¸øÇÏ´Â ¼ÀÀÔ´Ï´Ù. ( 1
¸í / 5 sec /
4 httpd = 5 / 1 sec / 100 httpd )

±×·¡¼­ °Ë»ö¿£Áø ¼­ºñ½º µî trafficÀÌ ¸¹Àº »çÀÌÆ®¿¡¼­´Â keep-alive ¿É¼ÇÀ»
¹Ýµå½Ã ²¨
³õ°Ô µË´Ï´Ù. ±×¸®°í connection timeoutµµ »ó´çÈ÷ ª°Ô ¼³Á¤ÇØ ³õÁÒ. 4~5ÃÊ
À̳»·Î ¸»ÀÔ´Ï´Ù


5. ¾ÆÇÇÄ¡ Æ©´×-2(·Î±×±â·Ï ·ÎÅ×ÀÌÆ®·Î)
/home/apache/conf/httpd.conf
CustomLog /home/apache/logs/access_log common
TransferLog "|/home/apache/bin/rotatelogs /home/apache/logs/access_log
86400"
TransferLog "|/home/apache/bin/rotatelogs /home/apache/logs/error_log
86400"
--------------
24½Ã°£ ¸¶´Ù ·Î±× È­ÀÏÀ» °»½ÅÇØ ÁØ´Ù.
24X60X60=86400ÃÊ

6. ¾ÆÆÄÄ¡ ¿¡·¯ ¸Þ½ÃÁö ¹Ù²Ù±â
httpd.conf
Customizable error response (Apache style)
2) local redirects
ErrorDocument 404 /cgi-bin/missing404.pl

missing404.pl
---------------
#!/usr/bin/perl
print<<"(END_HTML)";
Content-type: text/html\n\n
¿äûÇÑ URL ÀÌ ¾ø½À´Ï´Ù.






¿äûÇϽŠhttp://www.gwise.com$ENV{'REQUEST_URI'} ÀÌ

Á¸Àç ÇÏÁö ¾Ê½À´Ï´Ù.





¼­¹ö°ü¸®ÀÚ
¿¡°Ô ¹®ÀÇ ¹Ù¶ø´Ï´Ù.



(END_HTML)
exit;
---------------

7. ¾ÆÆÄÄ¡ ¿¡·¯ ÄÚµå
HTTP 1.1 status codes [TOP]

100 : Continue
101 : Switching protocols
200 : OK, ¿¡·¯¾øÀÌ Àü¼Û ¼º°ø
201 : Created, POST ¸í·É ½ÇÇà ¹× ¼º°ø
202 : Accepted, ¼­¹ö°¡ Ŭ¶óÀ̾ðÆ® ¸í·ÉÀ» ¹ÞÀ½
203 : Non-authoritative information, ¼­¹ö°¡ Ŭ¶óÀ̾ðÆ® ¿ä±¸ Áß ÀϺθ¸ Àü
¼Û
204 : No content, Ŭ¶ó¾ðÆ® ¿ä±¸À» ó¸®ÇßÀ¸³ª Àü¼ÛÇÒ µ¥ÀÌÅÍ°¡ ¾øÀ½
205 : Reset content
206 : Partial content
300 : Multiple choices, ÃÖ±Ù¿¡ ¿Å°ÜÁø µ¥ÀÌÅ͸¦ ¿äû
301 : Moved permanently, ¿ä±¸ÇÑ µ¥ÀÌÅ͸¦ º¯°æµÈ Àӽà URL¿¡¼­ ã¾ÒÀ½
302 : Moved temporarily, ¿ä±¸ÇÑ µ¥ÀÌÅÍ°¡ º¯°æµÈ URL¿¡ ÀÖÀ½À» ¸í½Ã
303 : See other, ¿ä±¸ÇÑ µ¥ÀÌÅ͸¦ º¯°æÇÏÁö ¾Ê¾Ò±â ¶§¹®¿¡ ¹®Á¦°¡ ÀÖÀ½
304 : Not modified
305 : Use proxy
400 : Bad request, Ŭ¶óÀ̾ðÆ®ÀÇ À߸øµÈ ¿äûÀ¸·Î ó¸®ÇÒ ¼ö ¾øÀ½
401 : Unauthorized, Ŭ¶óÀ̾ðÆ®ÀÇ ÀÎÁõ ½ÇÆÐ
402 : Payment required, ¿¹¾àµÊ
403 : Forbidden, Á¢±ÙÀÌ °ÅºÎµÈ ¹®¼­¸¦ ¿äûÇÔ
404 : Not found, ¹®¼­¸¦ ãÀ» ¼ö ¾øÀ½
405 : Method not allowed, ¸®¼Ò½º¸¦ Çã¿ë¾ÈÇÔ
406 : Not acceptable, Çã¿ëÇÒ ¼ö ¾øÀ½
407 : Proxy authentication required, ÇÁ·Ï½Ã ÀÎÁõ ÇÊ¿ä
408 : Request timeout, ¿äû½Ã°£ÀÌ Áö³²
409 : Conflict
410 : Gone, ¿µ±¸ÀûÀ¸·Î »ç¿ëÇÒ ¼ö ¾øÀ½
411 : Length required
412 : Precondition failed, ÀüüÁ¶°Ç ½ÇÆÐ
413 : Request entity too large,
414 : Request-URI too long, URLÀÌ ³Ê¹« ±è
415 : Unsupported media type
500 : Internal server error, ³»ºÎ¼­¹ö ¿À·ù(À߸øµÈ ½ºÅ©¸³Æ® ½ÇÇà½Ã)
501 : Not implemented, Ŭ¶óÀ̾ðÆ®¿¡¼­ ¼­¹ö°¡ ¼öÇàÇÒ ¼ö ¾ø´Â ÇൿÀ» ¿ä±¸
ÇÔ
502 : Bad gateway, ¼­¹öÀÇ °úºÎÇÏ »óÅÂ
503 : Service unavailable, ¿ÜºÎ ¼­ºñ½º°¡ Á×¾ú°Å³ª ÇöÀç ¸ØÃã »óÅÂ
504 : Gateway timeout
505 : HTTP version not supported



°ü·Ã °Ô½Ã¹° : 1 (Total 1 Articles)
¹ø È£ Á¦ ¸ñ ±Û¾´ÀÌ ÀÛ¼ºÀÏ Á¶È¸¼ö ¼± ÅÃ
1  ¾ÆÆÄÄ¡ Æ©´× Á¤¸® linux03-03-21411