¾ÆÆÄÄ¡±â¹Ý º¥Ä¡¸¶Å· ¹× °£´Ü Æ©´×
±Û   ¾´   ÀÌ linux
³¯         Â¥ 2003³â 06¿ù 12ÀÏ 11½Ã 21ºÐ 04ÃÊ
º»         ¹® ¾ÆÆÄÄ¡ ±â¹ÝÀ¸·Î À¥¼­¹ö ¿î¿µÇϽô ºÐµé²²¼­ Âü°íÇØ º¸¼¼¿ä.
½É½ÉÇÒ¶§ Å×½ºÆ®ÇØ º¸´Â°ÍµÎ Àç¹Ì ÀÖÀ»°Í °°¾Æ¿ä.
===========================================================

±Û¾´ÀÌ: ÁöÇö¸í ÀÛ¼ºÀÏ: 2001-05-08 20:11:22
1. À¥ ÆäÀÌÁö ·Îµù½Ã°£ È®ÀÎ
#time -pa lynx -source http://www.hanserver.net > /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.hanserver.net :80/
10 ¸íÀÇ À¯Àú°¡ µ¿½Ã¿¡ http://www.hanserver.net/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



°ü·Ã °Ô½Ã¹° : 1 (Total 1 Articles)
¹ø È£ Á¦ ¸ñ ±Û¾´ÀÌ ÀÛ¼ºÀÏ Á¶È¸¼ö ¼± ÅÃ
1  ¾ÆÆÄÄ¡±â¹Ý º¥Ä¡¸¶Å· ¹× °£´Ü Æ©´× linux03-06-12455