0

由于 mysql 和 http 的负载很高,我最近为我的 apache 服务器设置了一个 nginx 反向代理。我运行一个 phpbb 论坛,每天访问量约为 12k。我现在的负载大约是 40。我已经关注了 tune-primer 和 mysqltuner,但负载仍然很高。

服务器:四核英特尔,2GB 内存

这是我的配置,

skip-locking
bind-address=127.0.0.1
key_buffer = 200M
#query_cache_type = OFF
max_allowed_packet = 1M
table_cache = 105
#thread_cache_size 10
query_cache_size = 12M
sort_buffer_size = 1M
join_buffer_size = 3M
query_cache_min_res_unit = 50K
read_buffer_size = 256K
read_rnd_buffer_size = 2M
max_connections = 200
net_buffer_length = 2K
log-slow-queries=/var/log/mysql/log-slow-queries.log
thread_stack = 128K
thread_cache_size = 200

[isamchk]
key_buffer = 32M
sort_buffer_size = 32M

[myisamchk]
key_buffer = 8M
sort_buffer_size = 8M

[mysqlhotcopy]
interactive-timeout

Apache prefork:

<IfModule prefork.c>
StartServers       2
MinSpareServers   2
MaxSpareServers   4
ServerLimit    70
MaxClients      70
MaxRequestsPerChild 700

最佳:

    top - 17:57:28 up 41 days,  9:32,  4 users,  load average: 48.89, 48.98, 41.17
Tasks: 229 total,  31 running, 190 sleeping,   6 stopped,   2 zombie
Cpu(s): 87.2%us, 12.6%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.2%si,  0.0%st
Mem:   2073600k total,  1986292k used,    87308k free,    77628k buffers
Swap:  4192956k total,    22712k used,  4170244k free,  1084108k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
15783 mysql     15   0  275m  75m 4180 S 97.4  3.7   2:56.22 mysqld
15116 apache    16   0 29852  15m 4468 R  8.3  0.8   0:15.08 httpd
15910 apache    15   0 30064  14m 3404 S  8.3  0.7   0:03.46 httpd
15075 apache    16   0 30640  15m 3416 R  8.0  0.8   0:17.79 httpd
15935 apache    16   0 29724  14m 3248 R  8.0  0.7   0:01.38 httpd
15933 apache    16   0 29212  14m 3492 S  7.3  0.7   0:01.42 httpd
14889 apache    16   0 30240  15m 4008 S  7.0  0.8   0:22.37 httpd
15120 apache    16   0 29808  15m 4472 R  7.0  0.8   0:16.10 httpd
14818 apache    16   0 29736  15m 4352 R  6.4  0.8   0:27.61 httpd
14829 apache    16   0 31180  16m 4052 S  6.4  0.8   0:24.71 httpd
15080 apache    15   0 29776  14m 3924 S  6.4  0.7   0:17.10 httpd
4

0 回答 0