Date: Wed, 19 Nov 2008 03:35:57 -0800 From: Jeremy Chadwick <koitsu@FreeBSD.org> To: Ivan Voras <ivoras@freebsd.org> Cc: freebsd-stable@freebsd.org Subject: Re: High system in %system load . Message-ID: <20081119113557.GA85252@icarus.home.lan> In-Reply-To: <gg0qi7$v7n$1@ger.gmane.org> References: <fd2a4c1f0811180637m6ee44d4fv4cf97d18e322ca5a@mail.gmail.com> <gfun0o$lvq$1@ger.gmane.org> <fd2a4c1f0811180904k396dff47m43d537a07ae87579@mail.gmail.com> <gg0qi7$v7n$1@ger.gmane.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Nov 19, 2008 at 11:43:09AM +0100, Ivan Voras wrote: > Igor Lyapin wrote: > > I already sent # top head in my first mail > > that's all non idle top process > > > > last pid: 56920; load averages: 2.90, 2.25, 1.72 up > > 0+22:10:12 20:04:05 > > 210 processes: 2 running, 207 sleeping, 1 zombie > > CPU states: 8.3% user, 0.0% nice, 32.5% system, 0.3% interrupt, 58.9% > > idle > > Mem: 1268M Active, 1904M Inact, 479M Wired, 154M Cache, 214M Buf, 125M Free > > Swap: 8192M Total, 8192M Free > > > > PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU > > COMMAND > > 55546 www 1 -4 0 198M 24912K ufs 1 0:25 29.39% httpd > > 55986 www 1 -4 0 198M 23228K ufs 2 0:08 21.39% httpd > > 56030 www 1 -4 0 199M 23400K ufs 1 0:05 11.23% httpd > > Ok, high sys load in "ufs" state for me was often caused by PHP session > storage. By default, PHP will store all session records in a single > directory, which can grow to monstruous sizes. If this is also your > case, here are some things to try: > > a) increase vfs.ufs.dirhash_maxmem to 10 MB or something like that (look > at vfs.ufs.dirhash_mem to see if you're hitting the limit and if so, > monitor it to see what your dirhash_maxmem limit should be) > b) configure PHP to use "sharded" directory structure for sessions. Good catch, Ivan! Also, I recommend tuning the session.gc_* php.ini variables to expire sessions more often (less files laying around means less CPU due to readdir()). The defaults PHP uses are absurd. I also hate how the session files end up in /var/tmp, making a gigantic mess. I made a separate directory for them, with specific perms (1777) for security: drwxrwxrwt 2 root wheel 1024 Nov 19 03:33 /var/tmp/php_sessions/ The piece of php.ini we use on our production web servers: [session] session.save_path = "/var/tmp/php_sessions" session.gc_maxlifetime = 900 session.gc_probability = 25 session.gc_divisor = 100 See the PHP documentation for what these variables do. -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081119113557.GA85252>