<-
Apache > HTTP Server > Documentation > Version 2.0 > ¸ðµâ

¾ÆÆÄÄ¡ ¸ðµâ mod_file_cache

°¡´ÉÇÑ ¾ð¾î:  en  |  ko 

¼³¸í:¸Þ¸ð¸®¿¡ Á¤Àû ÆÄÀϵéÀ» ij½¬
»óÅÂ:Experimental
¸ðµâ¸í:file_cache_module
¼Ò½ºÆÄÀÏ:mod_file_cache.c

¿ä¾à

ÀÌ ¸ðµâÀº Á¶½ÉÇؼ­ »ç¿ëÇØ¾ß ÇÑ´Ù. mod_file_cache¸¦ »ç¿ëÇÏ¿© »çÀÌÆ®¸¦ ¸ÁÄ¡±â ½¬¿ì¹Ç·Î ÀÌ ¹®Á¦¸¦ ²Ä²ÄÈ÷ Àоî¶ó.

°ÅÀÇ º¯ÇÏÁö ¾Ê°í ÀÚÁÖ ¿äûµÇ´Â ÆÄÀÏÀ» ij½¬¿¡ ÀúÀåÇÏ¿© ¼­¹ö ºÎÇϸ¦ ÁÙÀÏ ¼ö ÀÖ´Ù. mod_file_cache´Â µÎ°¡Áö ¹æ½ÄÀ¸·Î ÀÚÁÖ ¿äûµÇ´Â Á¤Àû ÆÄÀÏÀ» ij½¬¿¡ ÀúÀåÇÑ´Ù. ¼³Á¤ Áö½Ã¾î¸¦ ÅëÇØ mod_file_cache°¡ ÆÄÀÏÀ» ¿­°í(open) mmap()ÇÒÁö ÆÄÀÏÀ» ¹Ì¸® ¿­°í ÆÄÀÏ Çڵ鷯¸¦ ÀúÀåÇÒÁö °áÁ¤ÇÑ´Ù. µÎ ¹æ½Ä ¸ðµÎ ÆÄÀÏÀ» ¼­ºñ½ºÇϱâÀ§ÇÑ ÀÛ¾÷ÀÇ ÀϺθ¦ ((ƯÈ÷ ÆÄÀÏ ÀÔÃâ·Â) ÆÄÀÏ ¿äû¶§¸¶´Ù ÇÏ´Â ´ë½Å ¼­¹ö°¡ ½ÃÀÛÇÒ¶§ ÇÏ¿© ¼­¹ö ºÎÇϸ¦ °¨¼ÒÇÑ´Ù.

ÁÖÀÇ: ÀÌ ¹æ¹ýÀº CGI ÇÁ·Î±×·¥À̳ª Ưº°ÇÑ ³»¿ëÇڵ鷯¸¦ ÅëÇØ ¼­ºñ½ºÇÏ´Â ÆÄÀÏÀÇ ¼Óµµ¸¦ Çâ»óÇÒ ¼ö ¾ø´Ù. ÀÌ ¹æ¹ýÀº º¸Åë ¾ÆÆÄÄ¡ core ³»¿ëÇڵ鷯°¡ ¼­ºñ½ºÇÏ´Â ÀϹÝÆÄÀÏ¿¡¸¸ Àû¿ëµÈ´Ù.

ÀÌ ¸ðµâÀº ¾ÆÆÄÄ¡ 1.3ÀÇ mod_mmap_static ¸ðµâÀÇ ¿µÇâÀ» ¸¹ÀÌ ¹ÞÀº È®ÀåÀÌ´Ù.

Áö½Ã¾îµé

ÁÖÁ¦

top

mod_file_cache »ç¿ëÇϱâ

mod_file_cache´Â ÁÖ¼­¹ö ¼³Á¤¿¡¼­ MMapFile°ú CacheFile Áö½Ã¾î¸¦ ÅëÇØ ¼³Á¤ÇÑ Á¤Àû ÆÄÀϵéÀ» ij½¬¿¡ ÀúÀåÇÑ´Ù.

¸ðµç Ç÷¡ÆûÀÌ µÎ Áö½Ã¾î¸¦ ¸ðµÎ Áö¿øÇÏ´Â °ÍÀº ¾Æ´Ï´Ù. ¿¹¸¦ µé¾î, À©µµ¿ìÁî¿ë ¾ÆÆÄÄ¡´Â ÇöÀç MMapStatic Áö½Ã¾î¸¦ Áö¿øÇÏÁö ¾ÊÁö¸¸, AIX °°Àº ´Ù¸¥ Ç÷¡ÆûÀº µÑ ¸ðµÎ Áö¿øÇÑ´Ù. Áö¿øÇÏÁö¾Ê´Â Áö½Ã¾î¸¦ »ç¿ëÇÒ °æ¿ì ¼­¹ö ¿À·ù ·Î±×¿¡ ¿À·ù¹®À» ³²±ä´Ù. Áö¿øÇÏÁö¾Ê´Â Áö½Ã¾î¸¦ »ç¿ëÇصµ ¼­¹ö´Â ½ÃÀÛÇÏÁö¸¸ ÆÄÀÏÀ» ij½¬¿¡ ÀúÀåÇÏÁö ¾Ê´Â´Ù. µÎ Áö½Ã¾î¸¦ ¸ðµÎ Áö¿øÇÏ´Â Ç÷¡ÆûÀ» »ç¿ëÇÑ´Ù¸é ¾î¶² ¹æ½ÄÀÌ ´õ ÁÁÀºÁö ½ÇÇèÇغ¼ ¼ö ÀÖ´Ù.

MMapFile Áö½Ã¾î

mod_file_cacheÀÇ MMapFile Áö½Ã¾î´Â ¼³Á¤ÇÑ Á¤ÀûÀÎ ÆÄÀϵéÀ» mmap() ½Ã½ºÅÛÈ£ÃâÀ» »ç¿ëÇÏ¿© ¸Þ¸ð¸®¿¡ ´ëÀÀÇÑ´Ù. ¸¹Àº ÃÖ±Ù À¯´Ð½º·ù ¿î¿µÃ¼Á¦¿¡ ÀÌ ½Ã½ºÅÛÈ£ÃâÀÌ ÀÖÁö¸¸, ¾ø´Â ¿î¿µÃ¼Á¦µµ ÀÖ´Ù. ¶Ç, mmap()ÇÒ ¼ö ÀÖ´Â ÆÄÀÏ Å©±â¿Í °³¼ö¸¦ ½Ã½ºÅÛÀÌ Á¦ÇÑÇÒ ¼ö ÀÖÀ¸¹Ç·Î ½ÇÇèÇغ¸´Â °ÍÀÌ ÁÁ´Ù.

¼­¹ö°¡ ½ÃÀÛÇÒ¶§¿Í Àç½ÃÀÛÇÒ¶§¸¸ mmap()À» ÇÑ´Ù. ±×·¡¼­ ÆÄÀϽýºÅÛ¿¡¼­ ÇØ´ç ÆÄÀÏÁß Çϳª¶óµµ º¯°æµÈ °æ¿ì ¼­¹ö¸¦ Àç½ÃÀÛÇØ¾ß ÇÑ´Ù (Stopping and Restarting ¹®¼­ Âü°í). ´Ù½Ã °­Á¶Çϸé: ¼­¹ö¸¦ Àç½ÃÀÛÇÏÁö¾Ê°í ÆÄÀÏÀ» ¼öÁ¤ÇÏ¸é ¿äû ¼­ºñ½º°¡ ¿ÏÀüÈ÷ ÀÌ»óÇÒ ¼ö ÀÖ´Ù. ÀÌÀü ÆÄÀÏÀ» Áö¿ì°í(unlink) »õ·Î ÆÄÀÏÀ» ¸¸µé¾î¼­ ÆÄÀÏÀ» ¼öÁ¤ÇØ¾ß ÇÑ´Ù. rdist³ª mv¿Í °°ÀÌ ¸¹Àº µµ±¸°¡ ÀÌ·± ½ÄÀ¸·Î µ¿ÀÛÇÑ´Ù. ¸Å¹ø Ãß°¡·Î ºÒÇÊ¿äÇÑ stat() °Ë»ç°¡ ÇÊ¿äÇÏ°í ÀÔÃâ·Â °¨¼ÒÀÇ Àǵµ¿¡ ¹ÝÇϹǷΠÀÌ ¸ðµâÀº ÆÄÀÏ º¯È­¸¦ ½Å°æ¾²Áö¾Ê´Â´Ù.

CacheFile Áö½Ã¾î

mod_file_cacheÀÇ CacheFile Áö½Ã¾î´Â ¼³Á¤ Áö½Ã¾î¿¡ ¿­°ÅÇÑ ÆÄÀÏ(°ú ÆÄÀϵé)ÀÇ ÇÚµé(handle) ȤÀº ÆÄÀÏ ±â¼úÀÚ(file descriptor)¸¦ ¿­°í(open) ij½¬¿¡ ÀúÀåÇÑ´Ù. ÆÄÀÏÀ» ¿äûÇÏ¸é ¼­¹ö´Â ij½¬¿¡¼­ ÇÚµéÀ» ã¾Æ¼­ ¼ÒÄÏ API sendfile()¿¡ (À©µµ¿ìÁî¿¡¼­´Â TransmitFile()) ³Ñ±ä´Ù.

¼­¹ö°¡ ½ÃÀÛÇÒ¶§¿Í Àç½ÃÀÛÇÒ¶§¸¸ ÀÌ·± ÆÄÀÏÇÚµé ij½¬¸¦ ¸¸µç´Ù. ... This file handle caching is done once at server start or restart, only. So whenever one of the cached files changes on the filesystem you have to restart the server (see the Stopping and Restarting documentation). To reiterate that point: if the files are modified in place without restarting the server you may end up serving requests that are completely bogus. You should update files by unlinking the old copy and putting a new copy in place. Most tools such as rdist and mv do this.

ÁÖÀÇ

µð·ºÅ丮ÀÇ ¸ðµç ÆÄÀÏÀ» Àç±ÍÀûÀ¸·Î ij½¬¿¡ ÀúÀåÇÏ´Â Áö½Ã¾î¸¦ ¿ä±¸ÇÏÁö ¸¶¶ó. ´ë½Å ÀÌ·¸°Ô ÇغÁ¶ó... Include Áö½Ã¾î¸¦ Âü°íÇÏ°í ´ÙÀ½°ú °°Àº ¸í·ÉÀ» ½ÇÇàÇ϶ó:

find /www/htdocs -type f -print \
| sed -e 's/.*/mmapfile &/' > /www/conf/mmap.conf

top

CacheFile Áö½Ã¾î

¼³¸í:Cache a list of file handles at startup time
¹®¹ý:CacheFile file-path [file-path] ...
»ç¿ëÀå¼Ò:ÁÖ¼­¹ö¼³Á¤
»óÅÂ:Experimental
¸ðµâ:mod_file_cache

The CacheFile directive opens handles to one or more files (given as whitespace separated arguments) and places these handles into the cache at server startup time. Handles to cached files are automatically closed on a server shutdown. When the files have changed on the filesystem, the server should be restarted to to re-cache them.

Be careful with the file-path arguments: They have to literally match the filesystem path Apache's URL-to-filename translation handlers create. We cannot compare inodes or other stuff to match paths through symbolic links etc. because that again would cost extra stat() system calls which is not acceptable. This module may or may not work with filenames rewritten by mod_alias or mod_rewrite.

Example

CacheFile /usr/local/apache/htdocs/index.html

top

MMapFile Áö½Ã¾î

¼³¸í:Map a list of files into memory at startup time
¹®¹ý:MMapFile file-path [file-path] ...
»ç¿ëÀå¼Ò:ÁÖ¼­¹ö¼³Á¤
»óÅÂ:Experimental
¸ðµâ:mod_file_cache

The MMapFile directive maps one or more files (given as whitespace separated arguments) into memory at server startup time. They are automatically unmapped on a server shutdown. When the files have changed on the filesystem at least a HUP or USR1 signal should be send to the server to re-mmap() them.

Be careful with the file-path arguments: They have to literally match the filesystem path Apache's URL-to-filename translation handlers create. We cannot compare inodes or other stuff to match paths through symbolic links etc. because that again would cost extra stat() system calls which is not acceptable. This module may or may not work with filenames rewritten by mod_alias or mod_rewrite.

Example

MMapFile /usr/local/apache/htdocs/index.html

°¡´ÉÇÑ ¾ð¾î:  en  |  ko