当前位置: 技术问答>linux和unix
负载很重的FreeBSD服务器,运行Apache和cgi程序,大家有什么好主意么?
来源: 互联网 发布时间:2015-03-17
本文导语: $ uname -a FreeBSD www.example.com 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Mon Aug 27 14:37:44 GMT 2001 toor@www.example.com:/usr/src/sys/compile/mykern i386 $ uptime 3:44PM up 17:45, 1 user, load averages: 574.59, 788.30, 868.88 $ vmstat procs ...
$ uname -a
FreeBSD www.example.com 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Mon Aug 27 14:37:44 GMT 2001 toor@www.example.com:/usr/src/sys/compile/mykern i386
$ uptime
3:44PM up 17:45, 1 user, load averages: 574.59, 788.30, 868.88
$ vmstat
procs memory page disks faults cpu
r b w avm fre flt re pi po fr sr da0 da1 in sy cs us sy id
51471 0 603084 77676 1584 1 0 0 1729 440 0 0 1299 33192 3453 21 60 19
$ netstat -m
5464/8304/98304 mbufs in use (current/peak/max):
3098 mbufs allocated to data
2366 mbufs allocated to packet headers
1859/2292/24576 mbuf clusters in use (current/peak/max)
6660 Kbytes allocated to network (9% of mb_map in use)
0 requests for memory denied
0 requests for memory delayed
0 calls to protocol drain routines
$ top
last pid: 74471; load averages: 459.23, 650.76, 798.51 up 0+17:48:37 15:46:44
2414 processes:506 running, 1887 sleeping, 21 zombie
CPU states: 13.1% user, 0.0% nice, 84.3% system, 2.6% interrupt, 0.0% idle
Mem: 359M Active, 372M Inact, 231M Wired, 39M Cache, 112M Buf, 1992K Free
Swap: 1536M Total, 1536M Free
FreeBSD www.example.com 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Mon Aug 27 14:37:44 GMT 2001 toor@www.example.com:/usr/src/sys/compile/mykern i386
$ uptime
3:44PM up 17:45, 1 user, load averages: 574.59, 788.30, 868.88
$ vmstat
procs memory page disks faults cpu
r b w avm fre flt re pi po fr sr da0 da1 in sy cs us sy id
51471 0 603084 77676 1584 1 0 0 1729 440 0 0 1299 33192 3453 21 60 19
$ netstat -m
5464/8304/98304 mbufs in use (current/peak/max):
3098 mbufs allocated to data
2366 mbufs allocated to packet headers
1859/2292/24576 mbuf clusters in use (current/peak/max)
6660 Kbytes allocated to network (9% of mb_map in use)
0 requests for memory denied
0 requests for memory delayed
0 calls to protocol drain routines
$ top
last pid: 74471; load averages: 459.23, 650.76, 798.51 up 0+17:48:37 15:46:44
2414 processes:506 running, 1887 sleeping, 21 zombie
CPU states: 13.1% user, 0.0% nice, 84.3% system, 2.6% interrupt, 0.0% idle
Mem: 359M Active, 372M Inact, 231M Wired, 39M Cache, 112M Buf, 1992K Free
Swap: 1536M Total, 1536M Free
|
一些朋友的回复
well, you may want to :
run faster hardware
re-code your CGIs in a faster/compiled language
desactivate every apache module that are not absolutely compulsory
set "allooveride" to None everywhere in your httpd.conf
limit the number of httpd spawns to a smaller number so that the machine
does not lose time forking new processes and use this time to execute
CGIs faster
these are just ideas
patpro
//###########################################################
How to decrease the load? Well, from the statistics you posted, and
given that all the CGIs etc. do legitimate things, you need a faster
server (more CPU power) and/or multiple servers with load balancing, the
latter provided that the applications you run there are suited for load
balancing.
Uwe
--
Uwe Doering | EscapeBox - Managed On-Demand UNIX Servers
gemini@snafu.de | http://www.escapebox.net
//################################################################
If you're really getting enough traffic to explain this many concurrent
processes, then you should be celebrating, and buying more hardware.
If there's not really that much traffic, then you need to find some way
to re-design your CGI programs to spawn fewer processes.
well, you may want to :
run faster hardware
re-code your CGIs in a faster/compiled language
desactivate every apache module that are not absolutely compulsory
set "allooveride" to None everywhere in your httpd.conf
limit the number of httpd spawns to a smaller number so that the machine
does not lose time forking new processes and use this time to execute
CGIs faster
these are just ideas
patpro
//###########################################################
How to decrease the load? Well, from the statistics you posted, and
given that all the CGIs etc. do legitimate things, you need a faster
server (more CPU power) and/or multiple servers with load balancing, the
latter provided that the applications you run there are suited for load
balancing.
Uwe
--
Uwe Doering | EscapeBox - Managed On-Demand UNIX Servers
gemini@snafu.de | http://www.escapebox.net
//################################################################
If you're really getting enough traffic to explain this many concurrent
processes, then you should be celebrating, and buying more hardware.
If there's not really that much traffic, then you need to find some way
to re-design your CGI programs to spawn fewer processes.
|
加服务器,其他服务是什么?
|
很难有解决办法,除非升级服务器,特别是内存