我有一个流量很大的在线游戏(150 万查询/小时)。该游戏是iphone上的回合制游戏。但是,服务器运行缓慢:
CPU: 92% user, 3% kernel, 0% IO, 5% idle
Real Memory: 15.71 GB total, 985.17 MB used
服务器统计:
Memory: 16 GB
Disk: 256GB SAS
Trafic: 2 * 1 Gbit
CPU: 4 * 2Ghz
这些是我使用的设置:
ect/apache2/httpd.conf
Timeout 300
KeepAlive On
MaxKeepAliveRequests 500
KeepAliveTimeout 2
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 10
MaxSpareServers 20
ServerLimit 2000
MaxClients 1900
MaxRequestsPerChild 1000
在 phpmyadmin 中,我有:
max connections = 2000
由于很多人同时玩,我发现通过增加最大连接数可以提高性能,但我不想将其设置为高,以免服务器崩溃。现在有 2000 个连接,CPU 为 92%(如上所述)。
我能做些什么来让它更快吗?
更多地增加 max_connections 是否安全?
为什么 CPU 这么高而 RAM 内存这么低?
提前致谢
编辑,来自 /proc/cpuinfo 的信息
processor : 0
vendor_id : AuthenticAMD
cpu family : 16
model : 2
model name : Quad-Core AMD Opteron(tm) Processor 8356
stepping : 3
cpu MHz : 2320.957
cache size : 512 KB
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow constant_tsc rep_good tsc_reliable nonstop_tsc pni cx16 popcnt hypervisor lahf_lm extapic abm sse4a misalignsse 3dnowprefetch
bogomips : 4621.29
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : AuthenticAMD
cpu family : 16
model : 2
model name : Quad-Core AMD Opteron(tm) Processor 8356
stepping : 3
cpu MHz : 2320.957
cache size : 512 KB
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow constant_tsc rep_good tsc_reliable nonstop_tsc pni cx16 popcnt hypervisor lahf_lm extapic abm sse4a misalignsse 3dnowprefetch
bogomips : 4621.29
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
processor : 2
vendor_id : AuthenticAMD
cpu family : 16
model : 2
model name : Quad-Core AMD Opteron(tm) Processor 8356
stepping : 3
cpu MHz : 2320.957
cache size : 512 KB
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow constant_tsc rep_good tsc_reliable nonstop_tsc pni cx16 popcnt hypervisor lahf_lm extapic abm sse4a misalignsse 3dnowprefetch
bogomips : 4621.29
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
processor : 3
vendor_id : AuthenticAMD
cpu family : 16
model : 2
model name : Quad-Core AMD Opteron(tm) Processor 8356
stepping : 3
cpu MHz : 2320.957
cache size : 512 KB
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow constant_tsc rep_good tsc_reliable nonstop_tsc pni cx16 popcnt hypervisor lahf_lm extapic abm sse4a misalignsse 3dnowprefetch
bogomips : 4621.29
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: