mirror of
https://github.com/apache/httpd.git
synced 2025-04-18 22:24:07 +03:00
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1331236 13f79535-47bb-0310-9956-ffa450edef68
191 lines
7.8 KiB
XML
191 lines
7.8 KiB
XML
<?xml version="1.0" encoding="EUC-KR"?>
|
|
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
|
|
<?xml-stylesheet type="text/xsl" href="../style/manual.ko.xsl"?>
|
|
<!-- English Revision: 420990:1330994 (outdated) -->
|
|
|
|
<!--
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
this work for additional information regarding copyright ownership.
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
(the "License"); you may not use this file except in compliance with
|
|
the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
-->
|
|
|
|
<modulesynopsis metafile="mod_file_cache.xml.meta">
|
|
|
|
<name>mod_file_cache</name>
|
|
<description>메모리에 정적 파일들을 캐쉬</description>
|
|
<status>Experimental</status>
|
|
<sourcefile>mod_file_cache.c</sourcefile>
|
|
<identifier>file_cache_module</identifier>
|
|
|
|
<summary>
|
|
|
|
<note type="warning">
|
|
이 모듈은 조심해서 사용해야 한다. <module>mod_file_cache</module>를
|
|
사용하여 사이트를 엉망으로 만들기 쉽기때문에 이 문서를
|
|
꼼꼼히 읽길 바란다.
|
|
</note>
|
|
|
|
<p>거의 변하지 않고 자주 요청되는 파일을 <em>캐쉬</em>에
|
|
저장하여 서버 부하를 줄일 수 있다. <module>mod_file_cache</module>는
|
|
자주 요청되는 <em>정적</em> 파일을 두가지 방식으로 캐쉬에
|
|
저장한다. 설정 지시어를 사용하여 <module>mod_file_cache</module>가
|
|
파일을 열고(open) <code>mmap()</code>할지 아니면 파일을
|
|
열고 <em>파일 핸들</em>을 저장할지 결정한다. 두 방식 모두
|
|
파일을 서비스하기위해 필요한 작업의 일부를 (특히 파일 입출력
|
|
작업) 파일을 요청할 때마다 매번 하는 대신 서버가 시작할때
|
|
한번만 하여 서버 부하가 감소한다.</p>
|
|
|
|
<p>주의: 이 방법은 CGI 프로그램이나 특별한 내용핸들러를
|
|
통해 서비스하는 파일의 서비스 속도를 높일 수 없다. 이 방법은
|
|
보통 아파치 core 내용핸들러가 서비스하는 일반파일에만
|
|
적용된다.</p>
|
|
|
|
<p>이 모듈은 아파치 1.3에 있는 <code>mod_mmap_static</code>
|
|
모듈의 기능을 확장한 결과다.</p>
|
|
</summary>
|
|
|
|
<section id="using"><title>mod_file_cache 사용하기</title>
|
|
|
|
<p><module>mod_file_cache</module>는 주서버 설정에서 <directive
|
|
module="mod_file_cache">MMapFile</directive>과 <directive
|
|
module="mod_file_cache">CacheFile</directive> 지시어를 사용하여
|
|
설정한 정적 파일들을 캐쉬에 저장한다.</p>
|
|
|
|
<p>모든 플래폼이 두 지시어를 모두 지원하는 것은 아니다.
|
|
예를 들어, 윈도우즈용 아파치는 현재 <directive
|
|
module="mod_file_cache">MMapStatic</directive> 지시어를
|
|
지원하지 않지만, AIX 같은 다른 플래폼은 둘 모두를 지원한다.
|
|
지원하지않는 지시어를 사용할 경우 서버 오류 로그에 오류문을
|
|
남긴다. 지원하지않는 지시어를 사용해도 서버는 동작하지만
|
|
파일을 캐쉬에 저장하지 않는다. 두 지시어를 모두 지원하는
|
|
플래폼을 사용한다면 어떤 방식이 더 좋은지 실험해보라.</p>
|
|
|
|
<section><title>MMapFile 지시어</title>
|
|
|
|
<p><module>mod_file_cache</module>의 <directive
|
|
module="mod_file_cache">MMapFile</directive> 지시어는
|
|
설정한 정적 파일들을 <code>mmap()</code> 시스템호출을
|
|
사용하여 메모리에 대응한다. 최신 유닉스류 운영체제라면
|
|
보통 이 시스템호출이 있지만, 없는 운영체제도 있다. 또,
|
|
<code>mmap()</code>할 수 있는 파일 크기와 개수를 시스템이
|
|
제한할 수 있으므로 미리 실험해보는 것이 좋다.</p>
|
|
|
|
<p>서버는 시작할때와 재시작할때만 <code>mmap()</code>한다.
|
|
그래서 파일시스템에서 해당 파일중 하나라도 변경되면 서버를
|
|
재시작<em>해야</em> 한다 (<a href="../stopping.html">중단과
|
|
재시작</a> 문서 참고). 다시 말해서 파일이 변경되었는데
|
|
서버를 재시작하지 않으면 완전히 이상하게 요청을 서비스할지도
|
|
모른다. 이전 파일을 지우고(unlink) 그 자리에 새로운 파일을
|
|
만들는 방식으로 파일을 수정해야 한다. <code>rdist</code>나
|
|
<code>mv</code>와 같은 대다수의 도구가 이런 방식으로 동작한다.
|
|
매번 추가로 불필요한 <code>stat()</code> 검사가 필요하고
|
|
입출력 감소라는 원래 의도에 반하기때문에 이 모듈은 파일의
|
|
변화를 무시한다.</p>
|
|
</section>
|
|
|
|
<section><title>CacheFile 지시어</title>
|
|
|
|
<p><module>mod_file_cache</module>의 <directive
|
|
module="mod_file_cache">CacheFile</directive> 지시어는
|
|
설정 지시어에 열거한 파일(과 파일들)을 열어서 파일의
|
|
<em>핸들(handle)</em> 혹은 <em>파일 기술자(file descriptor)</em>를
|
|
캐쉬에 저장한다. 파일을 요청하면 서버는 캐쉬에서 핸들을
|
|
찾아서 소켓 API <code>sendfile()</code>에 (윈도우즈에서는
|
|
<code>TransmitFile()</code>) 넘긴다.</p>
|
|
|
|
<!-- XXX
|
|
<p>Insert more details about sendfile API...</p>
|
|
-->
|
|
|
|
<p>서버는 시작할때와 재시작할때만 파일 핸들을 캐쉬한다.
|
|
그래서 파일시스템에서 캐쉬한 파일중 하나라도 변경되면
|
|
서버를 재시작<em>해야</em> 한다 (<a
|
|
href="../stopping.html">중단과 재시작</a> 문서 참고).
|
|
다시 말해서 파일이 변경되었는데 서버를 재시작하지 않으면
|
|
완전히 이상하게 요청을 서비스할지도 모른다. 이전 파일을
|
|
지우고(unlink) 그 자리에 새로운 파일을 만드는 방식으로
|
|
파일을 수정해야 한다. <code>rdist</code>나 <code>mv</code>와
|
|
같은 대다수의 도구가 이런 방식으로 동작한다.</p>
|
|
</section>
|
|
|
|
<note><title>주의</title>
|
|
<p>디렉토리의 모든 파일을 재귀적으로 캐쉬에 저장하는 지시어는
|
|
없다. 대신 다음과 같이 해보라... <directive
|
|
module="core">Include</directive> 지시어를 참고하여 다음과
|
|
같은 명령어를 실행한다:</p>
|
|
|
|
<example>
|
|
find /www/htdocs -type f -print \<br />
|
|
| sed -e 's/.*/mmapfile &/' > /www/conf/mmap.conf
|
|
</example>
|
|
</note>
|
|
</section>
|
|
|
|
<directivesynopsis>
|
|
<name>MMapFile</name>
|
|
<description>시작시 여러 파일을 메모리에 대응한다</description>
|
|
<syntax>MMapFile <var>file-path</var> [<var>file-path</var>] ...</syntax>
|
|
<contextlist><context>server config</context></contextlist>
|
|
|
|
<usage>
|
|
<p><directive>MMapFile</directive> 지시어는 서버가 시작할때
|
|
(공백으로 구분한 아규먼트로 지정한) 여러 파일을 메모리에
|
|
대응한다(map). 서버 종료시 자동으로 대응을 푼다(unmap).
|
|
파일시스템에서 파일이 변경되면 파일들을 다시
|
|
<code>mmap()</code>하기위해 최소한 서버에 <code>HUP</code>이나
|
|
<code>USR1</code> 시그널을 보내야 한다.</p>
|
|
|
|
<p><var>file-path</var> 아규먼트를 조심해라. 아규먼트는
|
|
아파치의 URL-파일명 변환 핸들러가 만든 파일시스템 경로와
|
|
정확히 일치해야 한다. 한번 더 불필요한 <code>stat()</code>
|
|
시스템호출이 필요하기때문에 inode나 심볼링크 <em>등</em>을
|
|
경로를 지정할 수 없다. 이 모듈은 <module>mod_alias</module>나
|
|
<module>mod_rewrite</module>로 재작성한 파일명을 다룰 수
|
|
있기도 없기도 하다.</p>
|
|
|
|
<example><title>예제</title>
|
|
MMapFile /usr/local/apache/htdocs/index.html
|
|
</example>
|
|
</usage>
|
|
</directivesynopsis>
|
|
|
|
<directivesynopsis>
|
|
<name>CacheFile</name>
|
|
<description>시작시 여러 파일 핸들을 캐쉬한다</description>
|
|
<syntax>CacheFile <var>file-path</var> [<var>file-path</var>] ...</syntax>
|
|
<contextlist><context>server config</context></contextlist>
|
|
|
|
<usage>
|
|
<p><directive>CacheFile</directive> 지시어는 서버가 시작할때
|
|
여러 파일을 열고(open) 파일들의 핸들을 캐쉬에 저장한다.
|
|
서버 종료시 자동으로 캐쉬한 파일의 핸들을 닫는다(close).
|
|
파일시스템에서 파일이 변경되면 파일을 다시 캐쉬하기위해
|
|
서버를 재시작해야 한다.</p>
|
|
|
|
<p><var>file-path</var> 아규먼트를 조심해라. 아규먼트는
|
|
아파치의 URL-파일명 변환 핸들러가 만든 파일시스템 경로와
|
|
정확히 일치해야 한다. 한번 더 불필요한 <code>stat()</code>
|
|
시스템호출이 필요하기때문에 inode나 심볼링크 <em>등</em>을
|
|
경로를 지정할 수 없다. 이 모듈은 <module>mod_alias</module>나
|
|
<module>mod_rewrite</module>로 재작성한 파일명을 다룰 수
|
|
있기도 없기도 하다.</p>
|
|
|
|
<example><title>예제</title>
|
|
CacheFile /usr/local/apache/htdocs/index.html
|
|
</example>
|
|
</usage>
|
|
</directivesynopsis>
|
|
|
|
</modulesynopsis>
|