아파치 mod_cache mod_disk_cache 알아보기
아파치 성능향상
아파치 모듈 mod_disk_cache
mod_disk_cache는 mod_cache가 필요하다.
설명 : Content cache storage manager keyed to URIs
상태 : Experimental
모듈명 : disk_cache_module
소스파일 : mod_disk_cache.c
CacheIgnoreCacheControl 지시어
설명: | 클라이언트가 캐쉬하지않는 내용을 요청함을 무시한다. |
---|---|
문법: | CacheIgnoreCacheControl On|Off |
기본값: | CacheIgnoreCacheControl Off |
사용장소: | 주서버설정, 가상호스트 |
상태: | Experimental |
모듈: | mod_cache |
보통 no-cache나 no-store 헤더값을 가진 문서는 캐쉬에 저장하지않는다.CacheIgnoreCacheControl
지시어는 이런 행동을 변경한다.CacheIgnoreCacheControl
On을 사용하면 서버는 문서에 no-cache나 no-store 헤더값이 있어도 문서를 캐쉬한다. 인증이 필요한 문서는 절대로 캐쉬하지 않는다.
mod_disk_cache는 디스크기반 저장관리자를 구현한다. 이 모듈은 기본적으로 mod_proxy와 같이 사용한다.
내용을 URI를 토대로 만든 키로 캐쉬에 저장하고 가져온다. 접근보호가 된 내용은 캐쉬하지않는다.
설정 옵션
https://www.linux.co.kr/apache/apache2_manual/mod/mod_cache.html
Proxy 서버와 함께 이용할때 유용하고, 특히 WebService등에서 변화 주기가 낮은 서비스에 대해서 이 Cache 기능을 사용하면 성능 향상에 도움이 될것 같다.
LoadModule cache_module modules/mod_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
<IfModule mod_cache.c>
<IfModule mod_disk_cache.c>
CacheRoot /env/pahache2/cache
CacheSize 256
CacheEnable disk /book
CacheDirLevels 5
CacheDirLength 3
</IfModule>
<IfModule mod_mem_cache.c>
CacheEnable mem /book
MCacheSize 4096
MCacheMaxObjectCount 100
MCacheMinObjectSize 1
MCacheMaxObjectSize 2048
</IfModule>
</IfModule>
mod_cache 설정 A
http://itrooms.tistory.com/47
<IfModule mod_cache.c>
<IfModule mod_disk_cache.c>
CacheEnable disk /
CacheRoot /var/cache/mod_cache/tmp
CacheDirLevels 2
CacheDirLength 1
CacheMaxFileSize 300000
CacheMinFileSize 1
#CacheIgnoreCacheControl On
CacheIgnoreNoLastMod On
CacheIgnoreQueryString Off
CacheIgnoreHeaders None
CacheLastModifiedFactor 0.1
CacheDefaultExpire 300
CacheMaxExpire 86400
#CacheStoreNoStore On
#CacheStorePrivate On
</IfModule>
</IfModule>
<IfModule cache_module> <IfModule disk_cache_module> CacheRoot /httpd/2.2.31/cacheroot CacheEnable disk / </IfModule> </IfModule>
윈도우용 모드캐시 완벽가이드
<IfModule cache_disk_module>
CacheRoot C:/temp/cache
CacheEnable disk /
CacheDirLevels 2
CacheDirLength 3
CacheIgnoreNoLastMod On
CacheIgnoreCacheControl On
CacheIgnoreQueryString Off
CacheDefaultExpire 3600
CacheMaxExpire 86400
CacheMaxFileSize 5000000
</IfModule>
</IfModule>