Unix Technical Forum

apache, mysql & swap

This is a discussion on apache, mysql & swap within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> Hey, is it possible to somehow 'limit' or tune usage of swapfile on apache/mysql, apart from disabling swap completely? ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-20-2008, 01:49 PM
Miha Verlic
 
Posts: n/a
Default apache, mysql & swap

Hey,
is it possible to somehow 'limit' or tune usage of swapfile on
apache/mysql, apart from disabling swap completely?
I've got quite loaded web+sql server and frome time to time swap usage
goes up to 1gb and in the meantime server performance is very crippled.
After few hours swap frees itself and performance is back to normal. Any
clues?
--
Miha
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-20-2008, 01:49 PM
Eef Hartman
 
Posts: n/a
Default Re: apache, mysql & swap

Miha Verlic <fluke@no-spam.krneki.org> wrote:
> is it possible to somehow 'limit' or tune usage of swapfile on
> apache/mysql, apart from disabling swap completely?


Limit the number of users that can use _at the same time_ apache
cq mysql. The system is running out of memory because of too many
users (and thus too many "data segments" for all the threads cq
processes of apache cq mysql.

For apache, this is in the /etc/apache/httpd.conf file:
MaxClients 150 (this is the Slackware default, you probably want
this value lower).
I wouldn't know for mysql, we never ever have more then 2 instances
running (and mostly on different machines too) - our webserver
doesn't use sql, just the system managers do (and we only have 2 of
those).
--
************************************************** ******************
** Eef Hartman, Delft University of Technology, dept. EWI/TW **
** e-mail: E.J.M.Hartman@math.tudelft.nl, fax: +31-15-278 7295 **
** snail-mail: P.O. Box 5031, 2600 GA Delft, The Netherlands **
************************************************** ******************
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-20-2008, 01:50 PM
Miha Verlic
 
Posts: n/a
Default Re: apache, mysql & swap

Eef Hartman wrote:
> Limit the number of users that can use _at the same time_ apache
> cq mysql. The system is running out of memory because of too many
> users (and thus too many "data segments" for all the threads cq
> processes of apache cq mysql.


Limit is set to 1024 apache MaxClients and mysql max connections 700.
If I set limits any lower I'm getting "Too many connections" errors.

I do not want to (or better yet cannot) limit this though - current
configuration is working OK for a few hours or even days and then
suddenly mysql starts using 512-1024mb of swap and server performance is
unbearable untill apache&mysql are restarted...

--
Miha
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-20-2008, 01:50 PM
Chris Elvidge
 
Posts: n/a
Default Re: apache, mysql & swap

Miha Verlic wrote:
> Hey,
> is it possible to somehow 'limit' or tune usage of swapfile on
> apache/mysql, apart from disabling swap completely?
> I've got quite loaded web+sql server and frome time to time swap usage
> goes up to 1gb and in the meantime server performance is very crippled.
> After few hours swap frees itself and performance is back to normal. Any
> clues?


More memory. Do not kill the swap. It's there for when memory gets low.

--
C
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-20-2008, 01:50 PM
Miha Verlic
 
Posts: n/a
Default Re: apache, mysql & swap

Chris Elvidge wrote:
> More memory. Do not kill the swap. It's there for when memory gets low.


Server already has 4gb of memory, and only 1 big database ~1,6gb with
proper indexes created...
--
Miha
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-20-2008, 01:50 PM
Blumf
 
Posts: n/a
Default Re: apache, mysql & swap

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Miha Verlic wrote:
> Server already has 4gb of memory, and only 1 big database ~1,6gb with
> proper indexes created...


You'd probably be better taking this to a mysql forum, chances are its a
stray transaction or other error in the app causing problems. Either way
it sounds like a DB tuning issue which messing around with the swap file
won't fix.

Blumf
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDu+ZVMid3IcxolsoRAi2QAJ9l5gDX7UFOmDi/5Fk0s2avBbU0SQCdE9Ed
yH3kF2oV/63YKdm8syrOy1s=
=SNCz
-----END PGP SIGNATURE-----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-20-2008, 01:50 PM
Grant
 
Posts: n/a
Default Re: apache, mysql & swap

On Wed, 04 Jan 2006 11:45:22 +0100, Miha Verlic <fluke@no-spam.krneki.org> wrote:

>Eef Hartman wrote:
>> Limit the number of users that can use _at the same time_ apache
>> cq mysql. The system is running out of memory because of too many
>> users (and thus too many "data segments" for all the threads cq
>> processes of apache cq mysql.

>
>Limit is set to 1024 apache MaxClients and mysql max connections 700.
>If I set limits any lower I'm getting "Too many connections" errors.


You could limit incoming connections, better than falling over?
>
>I do not want to (or better yet cannot) limit this though - current
>configuration is working OK for a few hours or even days and then
>suddenly mysql starts using 512-1024mb of swap and server performance is
>unbearable untill apache&mysql are restarted...


Check if your database is creating very large temp tables due to
poor SQL query design. Another option is to look at denormalising
some of your tables for query response speed, reduce number of
tables needed to satisfy a query. (Design by access method, rather
than a formal fully normalised database design).

A few years ago it used to be that mysql fell over on overload where
postgresql just slowed down, but kept going. Dunno if that still
applies.

Grant.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-20-2008, 01:52 PM
Miha Verlic
 
Posts: n/a
Default Re: apache, mysql & swap

Grant wrote:
> Check if your database is creating very large temp tables due to
> poor SQL query design. Another option is to look at denormalising
> some of your tables for query response speed, reduce number of
> tables needed to satisfy a query. (Design by access method, rather
> than a formal fully normalised database design).


This is of course on TODO list and I'm in touch with programmers, but
until they fix this "poor design" it's up to me :/

> A few years ago it used to be that mysql fell over on overload where
> postgresql just slowed down, but kept going. Dunno if that still
> applies.


Actually lowering key_buffer_size does exactly that apparently... it
seems slow on moments, but at least it works... better...
I guess I was a bit too generous with giving resources to mysql...
--
Miha
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:38 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com