douluo5937 2012-04-25 12:07
浏览 63

Apache2使用了很多CPU。 如何最好地调整?

I have a online game with quite a lot of trafic (1,5 milion query/hour). The game is a turnbased one on the iphone. However, the server runs slow:

CPU:  92% user, 3% kernel, 0% IO, 5% idle
Real Memory:   15.71 GB total, 985.17 MB used

Server stats:

Memory: 16 GB
Disk: 256GB SAS
Trafic:  2 * 1 Gbit 
CPU:    4 * 2Ghz

These are the settings I use:

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

and in phpmyadmin, I have:

max connections = 2000

Since many people play at the same time, I found an performance boost by increase the max connections, but I don't want to set it to high so the server crash. With 2000 connections now, the CPU is at 92 % (as stated above).

Is there anything I can do to make it faster?
Is it safe to increase the max_connections more?
Why is the CPU so high and the RAM memory so low?

Thanks in advance

Edit, Info from /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:
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line