Wierd MySQL Connection Problems

I've looked through search and the only people I can find with this problem can't connect at all. My problem is that every so often (like 2-10 times per hour) I can't connect to MySQL at all, no service can, its like its dead in the water for no reason.

Can't connect to local MySQL server through socket '/var/tmp/mysql.sock' (11)
I've only noticed it with php by I suspect its mysql because I can restart it and everything will be fine. I always get the error. When I do a "ps ax | grep mysql" I get hundreds of processes running and I think this is my main problem. It has something to do with having to many connections to mysql but I have no idea how to track and stop the problem.

The server is a beefy p4 2.8ht with a gig of ram and it doesnt seem to be having swap issues. Heres some info:

#mysqladmin status
Uptime: 11283 Threads: 2 Questions: 999399 Slow queries: 2558 Opens: 2163 Flush tables: 1 Open tables: 483 Queries per second avg: 88.576
when the server is getting really bogged down its
#mysqladmin status
Uptime: 11706 Threads: 213 Questions: 1025080 Slow queries: 3356 Opens: 2207 Flush tables: 1 Open tables: 480 Queries per second avg: 87.569
top
17:49:51 up 41 days, 19:26, 3 users, load average: 1.95, 2.80, 6.56
466 processes: 459 sleeping, 4 running, 0 zombie, 3 stopped
CPU states: cpu user nice system irq softirq iowait idle
total 82.4% 0.0% 10.8% 0.0% 1.0% 2.4% 102.6%
cpu00 42.4% 0.0% 5.3% 0.0% 0.7% 1.3% 50.0%
cpu01 40.0% 0.0% 5.6% 0.1% 0.3% 1.1% 52.5%
Mem: 1024392k av, 833892k used, 190500k free, 0k shrd, 11152k buff
605576k actv, 102640k in_d, 6288k in_c
Swap: 2040244k av, 331120k used, 1709124k free 191664k cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
31789 root 15 0 3360 1360 1280 S 51.4 0.1 9:30 1 httpd
10684 mysql 15 0 79056 49M 1272 S 30.4 4.9 10:22 0 mysqld
4153 root 16 0 1620 1620 912 R 1.5 0.1 0:00 0 top
23836 named 25 0 1972 1176 584 S 0.1 0.1 19:09 0 named
1 root 15 0 112 80 56 S 0.0 0.0 0:30 0 init
2 root RT 0 0 0 0 SW 0.0 0.0 0:00 0 migration/0
3 root RT 0 0 0 0 SW 0.0 0.0 0:00 1 migration/1
4 root 15 0 0 0 0 SW 0.0 0.0 0:04 1 keventd
5 root 34 19 0 0 0 SWN 0.0 0.0 0:00 0 ksoftirqd/0
6 root 34 19 0 0 0 SWN 0.0 0.0 0:00 1 ksoftirqd/1
9 root 15 0 0 0 0 SW 0.0 0.0 0:13 0 bdflush
7 root 15 0 0 0 0 SW 0.0 0.0 20:24 0 kswapd
8 root 15 0 0 0 0 SW 0.0 0.0 17:34 1 kscand
# free -m
total used free shared buffers cached
Mem: 1000 682 317 0 6 89
-/+ buffers/cache: 586 413
Swap: 1992 315 1677
[/tmp]# ls -la mysql.sock
srwxrwxrwx 1 mysql mysql 0 Dec 21 14:17 mysql.sock=
I've tried and failed to stem the problem by tweaking my config, but it seemed to do nothing.
# cat /etc/my.cnf
[mysqld]
#datadir=/var/lib/mysql
socket=/tmp/mysql.sock
skip-locking
skip-innodb
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
max_connections=1200
interactive_timeout=100
wait_timeout=100
connect_timeout=10
thread_cache_size=128
key_buffer=16M
join_buffer=1M
max_allowed_packet=16M
table_cache=1024
record_buffer=1M
sort_buffer_size=2M
read_buffer_size=2M
max_connect_errors=10
# Try number of CPU's*2 for thread_concurrency
thread_concurrency=2
myisam_sort_buffer_size=64M
log-bin
server-id=1

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
#pid-file=/var/lib/mysql/mysql.pid
open_files_limit=8192

[mysqldump]
quick
max_allowed_packet=16M

[mysql]
no-auto-rehash
#safe-updates

[isamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M

[myisamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M

[mysqlhotcopy]
interactive-timeout

[client]
port = 3306
socket = /tmp/mysql.sock
Thanks in advance for any advice or helpful hints.

 

 

 

 

Top