
01-12-2003, 11:15 PM
|
|
WHT Addict
|
|
Join Date: Jan 2002
Posts: 150
|
|
Server Using Swap... Why Is That?
I'm on a new server with the following specs:
- P4 2GHz
- 1 GB RAM
- 80 GB 7200RPM Drive
- RH Linux 7.2
- PHP 4.3.0
- MySQL 3.23.41
Recently the server would get slow for brief moments so I SSH'd in and checked out top and saw this:
Code:
2:09pm up 3 days, 20:28, 1 user, load average: 0.48, 0.68, 0.63
133 processes: 130 sleeping, 3 running, 0 zombie, 0 stopped
CPU states: 26.7% user, 6.0% system, 0.0% nice, 67.2% idle
Mem: 1031184K av, 1016808K used, 14376K free, 0K shrd, 78936K buff
Swap: 1044216K av, 5236K used, 1038980K free 802480K cached
It looks like my memory is almost all used up and some disk swap is starting to be used. My site averages about 1xx people on a day and can reach over 200 or more at times. Could I just need additional memory or do I most likely have to tweak a few settings to get things straight. Also, is it possible I have a memory leak that's causing the memory to disipate?
Here's my my.cnf:
Code:
[mysqld]
port = 3306
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-locking
set-variable = max_connections=450
set-variable = key_buffer=16M
set-variable = myisam_sort_buffer_size=64M
set-variable = join_buffer=1M
set-variable = record_buffer=1M
set-variable = sort_buffer=2M
set-variable = table_cache=1024
set-variable = thread_cache_size=256
set-variable = wait_timeout=9600
set-variable = connect_timeout=10
set-variable = max_allowed_packet=16M
set-variable = max_connect_errors=10
[mysql.server]
user=mysql
basedir=/var/lib
[safe_mysqld]
open_files_limit=8192
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[mysqldump]
quick
set-variable = max_allowed_packet=16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[isamchk]
set-variable = key_buffer=128M
set-variable = sort_buffer=128M
set-variable = read_buffer=2M
set-variable = write_buffer=2M
[myisamchk]
set-variable = key_buffer=128M
set-variable = sort_buffer=128M
set-variable = read_buffer=2M
set-variable = write_buffer=2M
[mysqlhotcopy]
interactive-timeout
And here's my dbstats:
http://www.evolutionm.net/dbstats.php
Thanks,
Mark
|

01-12-2003, 11:57 PM
|
|
Web Hosting Master
|
|
Join Date: Feb 2002
Posts: 981
|
|
not enough memory, that's why it is using up swap.
52mb of used swap, is to early to worry about memory leak 
__________________
Powered by AMD & FreeBSD.
"Documentation is like sex:
when it is good, it is very, very good;
and when it is bad, it is better than nothing."
|

01-12-2003, 11:58 PM
|
|
iNET Interactive
|
|
Join Date: May 2001
Location: Dayton, Ohio
Posts: 4,869
|
|
Try upgrading to the latest MySQL...
Your my.cnf looks fine and 1gb SHOULD be enough, not quite sure though yet...
Mind doing a free -m?
__________________
-Mat
|

01-13-2003, 01:56 AM
|
|
WHT Addict
|
|
Join Date: Jan 2002
Posts: 150
|
|
Here's the results of free -m:
Code:
total used free shared buffers cached
Mem: 1007 947 59 0 77 736
-/+ buffers/cache: 133 873
Swap: 1019 5 1014
Mark
|

01-13-2003, 04:36 AM
|
|
Web Hosting Guru
|
|
Join Date: Jul 2002
Location: Kolding, Denmark
Posts: 292
|
|
No problem whatsoever in your memory usage:
2:09pm up 3 days, 20:28, 1 user, load average: 0.48, 0.68, 0.63
133 processes: 130 sleeping, 3 running, 0 zombie, 0 stopped
CPU states: 26.7% user, 6.0% system, 0.0% nice, 67.2% idle
Mem: 1031184K av, 1016808K used, 14376K free, 0K shrd, 78936K buff
Swap: 1044216K av, 5236K used, 1038980K free 802480K cached
Out of 1 GB RAM approximately 800 MB is used as cache - that is, only 200 MB is used by apps. That's perfectly normal since Linux uses otherwise wasted memory space as cache to speed up things as much as possible.
I've seen systems using 500 MB swap and having 800 MB cached - no problems since the cache is larger than the swap.
__________________
Best regards,
Anders C. Madsen
Golden Planet Support - http://www.goldenplanet.com
|

01-13-2003, 09:58 AM
|
|
WHT Addict
|
|
Join Date: Jan 2002
Posts: 150
|
|
Oh, I thought the cache at the bottom was for swap, so I got all confused! Thansk for the heads up.
Mark
|

01-13-2003, 10:07 AM
|
|
Web Hosting Guru
|
|
Join Date: Oct 2000
Posts: 337
|
|
One more thing to keep in mind is that Linux will swap out idle pages, even if it doesn't need to, to make more room available for cache.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
| Postbit Selector |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
| Login: |
|
|
| Advertisement: |
|
|
| Web Hosting News: |
|
|
|