Skip to content

Instantly share code, notes, and snippets.

@liujingyu
Created May 25, 2015 11:11
Show Gist options
  • Save liujingyu/fd897008ba353a9673b8 to your computer and use it in GitHub Desktop.
Save liujingyu/fd897008ba353a9673b8 to your computer and use it in GitHub Desktop.
apache 参数配置
线程数优化
Prefork优化的关键在于MaxClients与MaxRequestsPerChild。
MaxClients最佳的值:
apache_max_process_with_good_perfermance < (total_hardware_memory /apache_memory_per_process ) * 2
apache_max_process = apache_max_process_with_good_perfermance * 1.5
计算httpd平均占用内存
ps aux|grep -v grep|awk '/httpd/{sum+=$6;n++};END{print sum/n}' (kb)
显示每个进程占用了大约100M的内存,假设机器内存为32G,可拿出16G用于Apache。代入公式,得出
apache_max_process_with_good_perfermance = 16 * 1024 * 1024 /
108468*2=309
apache_max_process = 309 * 1.5=464
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment