====== Apache Web Server Performance ====== * [[http://httpd.apache.org/docs/2.2/en/misc/perf-tuning.html|Apache HTTPD 2.2 Performance Tuning]] [[http://httpd.apache.org/docs/2.4/en/misc/perf-tuning.html|2.4]] * 성능 위주로 가려면 MPM Worker 방식으로 가야한다. 하지만 몇몇모듈(PHP 등)이 작동하지 않는다. * [[http://code.google.com/intl/ko-KR/speed/page-speed/docs/using_mod.html|Google mod_pagespeed]] * [[http://code.google.com/p/modconcat/|mod_concat]] 여러 파일을 합쳐서 단일 파일로 전송. * [[http://www.devside.net/articles/apache-performance-tuning|Apache Performance Tuning]] * [[http://knight76.tistory.com/1964|김용환 블로그 :: 5분짜리 apache http 서버 성능 컨설팅 내용]] * [[http://unhandledexpression.com/2013/01/25/5-easy-tips-to-accelerate-ssl/|5 easy tips to accelerate SSL – Unhandled expression]] ===== worker/prefork 특징 ===== * [[http://httpd.apache.org/docs/2.4/mod/worker.html|worker 문서]] * [[http://londonplane.tistory.com/entry/Apache-2x-MPMprefork-worker-%EB%B0%A9%EC%8B%9D-%EC%84%B1%EB%8A%A5-%EB%B9%84%EA%B5%90|Apache 2.x MPM(prefork, worker) 방식 성능 비교]] * **prefork** 방식은 1 프로세스 1 쓰레드 방식으로, 메모리를 많이 소모하고 느리지만 안정적이다. * **worker** 방식은 1 프로세스 다중 쓰레드 방식으로, 메모리 소모가 적고 빠르지만, 여러 쓰레드가 하나의 프로세스안에서 경합을 벌일 경우 안정성에 문제가 될 수 있다. * 정적 리소스에 대한 평면적인 성능만 따지면 worker 방식이 prefork보다 2배 정도 빠르다. ===== MaxClients 설정 ===== * [[http://helloworld.naver.com/index.php?document_srl=132178|Apache MaxClients와 Tomcat의 Full GC]] * Linux의 swappiness 설정과 연계해서 Apache 의 MaxClients를 설정해야한다.(그외 다른 작업도 마찬가지) * 시스템의 전체 메모리 용량이 Swap을 발생시키는 용량이 되지 않도록 조정해야 한다. * Client 당 하나씩 생성되는 httpd 프로세스의 갯수는 모듈 로딩 상황에 따라 다르지만 보통 4mb 정도로 계산해본다.(실측해볼 것) * 따라서 **(Swap비적용 대상 메모리량 - 시스템과 다른 애플리케이션이 차지하는 메모리량) /4(mb)** 개 정도로 MaxClients를 설정한다.