LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-06-2011, 02:52 AM   #1
taara
LQ Newbie
 
Registered: Mar 2009
Posts: 23
Blog Entries: 1

Rep: Reputation: 2
Stuck with MySQL swaping on CentOS


Hi,

I am running a dedicated mysql server on centOS 5.6 and Kernel Linux 2.6.18-238.el5, swappiness is set to 60 which is default.

thing is I have around 3000 databases, most of which are inactive, the server has 20G of RAM and 8 CPU Threads. MySQL is not using a lot of CPU time nor is it using a lot of Resident memory (Exactly 15G), virtual space (VIRT) in use by mysql is 20.2G and swap shown by top for MySQL is 4.5G BUT free -m shows me that linux has caches about 3G of ram used 9G of swap and I do not understand anymore how this happens.

Should I reduce swappiness to 40 ?
what can I change in my.cnf


my.cnf below:

[client]
port = 3306
socket = /var/lib/mysql/mysql.sock

[mysqld_safe]
socket = /var/lib/mysql/mysql.sock
nice = 0

[mysqld]

user = mysql
socket = /var/lib/mysql/mysql.sock
port = 3306

skip-external-locking
max_connections=100

myisam-recover = BACKUP
max_connections = 200
table_cache = 128
thread_concurrency = 16

query_cache_limit = 4M
query_cache_size = 1024M

sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M

wait_timeout = 28800
tmp_table_size = 128M
max_heap_table_size = 128M

general_log_file = /var/log/mysql/mysql.log

innodb_log_buffer_size = 16M
innodb_flush_log_at_trx_commit = 1
innodb_buffer_pool_size = 7G
innodb_additional_mem_pool_size = 24M
innodb_thread_concurrency = 16


[mysqldump]
quick
quote-names
max_allowed_packet = 16M

[isamchk]
key_buffer = 16M

I posted my question to mysql forums also but can't get any help from there.
 
Old 12-07-2011, 11:03 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,137

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Since you haven't listed any performance numbers I assume that you don't care about the effect on performance, just on memory use? Are you under the misperception that all swapping is bad? If the process size approaches physical memory size, then some memory will be swapped so that there is always some available memory when needed at the expense of memory which is initialized but seldom or never used. Andrew Morton sets swapiness on his own machine to 100.

Without knowing what you are trying to achieve it's difficult to suggest changes to config.
 
Old 12-08-2011, 02:05 AM   #3
taara
LQ Newbie
 
Registered: Mar 2009
Posts: 23

Original Poster
Blog Entries: 1

Rep: Reputation: 2
HI,
Thanks for your replay, well, the thing is that I am not sure that the system is stable like this. I have noticed that if there is such a large amount of swap and at least half of it is owned by mysql, it seems that mysql is not able to shut down properly for maintenance. And I am concerned that if I run it like this for longer periods I might encounter corruption or something else unpleasant.

What I would like to achieve is that my db server is stable, even if it comes with performance penalties. Right now I don't think it is stable. But hey, I am not a DBA.

Well I have been stuck with this problem for over a month now, I have read the book "high performance mysql", I have read dozens of articles about mysql configuration but I fail to get the config right, since I have no real experience with big mysql servers.

I am quite desperate.

Last edited by taara; 12-08-2011 at 02:11 AM.
 
Old 12-08-2011, 01:24 PM   #4
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,137

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
What does "not stable" mean? Is it crashing?

What does "not able to shut down properly" mean? Does it take a long time? A 20 GB application will not shut down in 10 seconds.
 
Old 12-27-2011, 06:41 AM   #5
taara
LQ Newbie
 
Registered: Mar 2009
Posts: 23

Original Poster
Blog Entries: 1

Rep: Reputation: 2
Yes, my mysql server has crashed twice in the past (well before I configured innoDB variables as they are in the my.cnf that I posted, since then it has not crashed but I have also rebooted mysql server on a frequent maintenance schedule just in case)
Not able to shut down properly means that it does not shut down. I need to kill -15 it, it takes a long time to try shutting down and then it fails and it keeps running but cant log in.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Stuck w/ twm Window Manager in CentOS 5.3 JMCraig Red Hat 3 01-08-2010 03:41 PM
error in installing mysql i.e. mysql-5.1.34-linux-powerpc-glibc23 in centos 4.4 i686 pankajd Linux - Newbie 1 06-07-2009 02:00 PM
get stuck in stalling Attansic L2 with Centos 4.4 chinchin Linux - Networking 1 08-21-2008 05:53 PM
get stuck in stalling Attansic L2 with Centos chinchin Linux - Hardware 4 08-19-2008 05:45 PM
centOS stuck on loadup.... galrub Linux - Newbie 2 03-19-2007 03:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration