Hello there,
I do use nss-mysql for account validation in an internet pub.
The server running MySQL is a Linux box, as well the clients.
After a day or two of ininterrupted work, I just get the server
freeze, with too much processes on the server MySQL.
The problem (as I have tracked down) is that each connection
from a client opens a new thread connecting to the server.
When the user logs out, the process is kept running.
Same user can open lots of connections a day, so after a day
or two I have exausted all MySQL available connection to
the server which stops answering.
Is this misconfiguration or a bug?
Linux serverking 2.4.18-4GB #1 Tue Jul 30 03:50:31 CEST 2002 i686 unknown
mysql Ver 11.15 Distrib 3.23.48, for suse-linux (i686)
nss-mysql library version 0.43
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
There are two projects for 'NSS MySQL' - libnss-mysql (mine), and 'nss-mysql' (the one you're using, which I don't develop). nss-mysql can be found at http://savannah.nongnu.org/projects/nss-mysql
Take care,
-=| Ben
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm having the exact same problem. After doing a bunch of testing There were well over a hundred mysql process running. I've verified this problem on 3 different systems.
I'm using version 0.7.
Keith
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Im still having problems with open processes. Today it slowed things down enough where I was getting blow errors in a shell program. It was taking over 50% of the system resources once you totall all the MySQL processes.
Anyways from what I can see a mysql thread starts for every user, regardless of weather there a user in files, or mysql. The processes seem to close as users leave, but if I change my nsswitch.conf the processes hang.
I have 60-80 users logging in though ssh and running terminal programs. When I get that many users logged in it sucks up all the system resources.
I'm running ncsd, is there anything I can do to tweak preformace? We can't have login process take more than about 5% of the system resources.
All the systems are at least 1ghz and 512M ram.
Let me know if there is anyting I can help test or if there is any output I can give you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You could set up MySQL to close idle connections after a specified period of time. In your my.cnf you can add
[libnss_mysql]
wait_timeout=60
So it will disconnect after 60 secods of idle time. I haven't checked the syntax of the above - forgive me if it's incorrect.
At this point, I want to clarify - you're not having problem with *stale* open connections, but rather too many, due to at least one MySQL session being open for every login that you have, correct?
It should be noted that nscd won't cache 'shadow' entries - so a connection will always be made to MySQL to verify the user's password when they log in.
The only sane way to keep the connections down would be to set a timeout in the MySQL server, or for me to provide an option to shut off persistent connections (I wouldn't recommend this for performance reasons, *especially* if this is over tcp/ip).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's hard for me to pinpoint the exact problem. I watch the mysql process, then the next day I get a emergency call that our temrnial program is getting errors, I check process and there are tons of mysql process running. I'm not sure if this is something that happens over time, or when there are tons of users on.
I'm trying to get as much info as I can but in a production enviornment the main thing is it works. So I usually just have to kill mysql in nsswitch.conf and restart mysql.
Maybe if there is a way we can load test the system without actual users having to be one. I'm willing to spend the time i fyou have any suggestions.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What is "my.cnf" I dont have a file like that, and I'm not sure waht your refering too.
Also a concept question I'm trying to grap:
Why does the connection have to stay open at all? This is probally my limited understanding, but I would think all mysql has to do is connect get the user info, then disconnect. Why does it need to keep the connection open at all? It would seem more efficent to do a quick open/close then open and stay open incase it needs the process. Kind of like PHP and MySQL. We have usually 50-150 users activly using our dynamic php/mysql website but there are never more than 10-20 MySQL processes running.
Thanks again for spending the time
Keith
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'll need to think about a way to 'script' 60+ separate logins to a machine...
In the mean time.. the 'my.cnf' file is the MySQL server configuration file. It's not created by default (except by the RedHat RPMS). It's generally expected to be in the /etc directory. Just create the file and put these two lines in it (corrected from above suggestion)
[mysqld]
set-variable=wait_timeout=60
As far as why persistent connections is a good thing.. the way NSS is designed, there's no real good way to know when a process may be done making user queries.. If we were to close after every query, then consider this example:
A directory of 5,000 files, owned by users in MySQL. Perform an 'ls -l' in this directory. Without persistent connections, *5000* individual connections would be made. Worse, if this were TCP/IP, there would now be 5000 sockets sitting in the CLOSE_WAIT state. A real resource mess at this point. If you took it to, say, 70,000 queries, you'd run out of sockets, and your server would no longer be able to talk TCP to the world. I've actually caused this to happen :-)
I recommend setting the timeout above on your MySQL server (requires restarting the daemon). Verify that it's set using:
mysql -e 'show variables like "wait_timeout"'
The default is 28800.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello there,
I do use nss-mysql for account validation in an internet pub.
The server running MySQL is a Linux box, as well the clients.
After a day or two of ininterrupted work, I just get the server
freeze, with too much processes on the server MySQL.
The problem (as I have tracked down) is that each connection
from a client opens a new thread connecting to the server.
When the user logs out, the process is kept running.
Same user can open lots of connections a day, so after a day
or two I have exausted all MySQL available connection to
the server which stops answering.
Is this misconfiguration or a bug?
Linux serverking 2.4.18-4GB #1 Tue Jul 30 03:50:31 CEST 2002 i686 unknown
mysql Ver 11.15 Distrib 3.23.48, for suse-linux (i686)
nss-mysql library version 0.43
Hi!
There are two projects for 'NSS MySQL' - libnss-mysql (mine), and 'nss-mysql' (the one you're using, which I don't develop). nss-mysql can be found at http://savannah.nongnu.org/projects/nss-mysql
Take care,
-=| Ben
I'm having the exact same problem. After doing a bunch of testing There were well over a hundred mysql process running. I've verified this problem on 3 different systems.
I'm using version 0.7.
Keith
Actually I liked. On two machines I have that process problem and they are running version
mysql Ver 11.15 Distrib 3.23.48, for suse-linux (i686)
On my other System it didn't have run away process like the other two. This one is running version:
mysql Ver 11.18 Distrib 3.23.52, for suse-linux (i686)
Hope that helps some. Not sure if that's something that can be fixed in yoru library or if it's mysql's problem.
Keith
Just wanted to say the open process problem was fixed when I upgrade mysql to the curent stable release
mysql Ver 11.18 Distrib 3.23.54, for pc-linux (i686)
Keith
Thanks for the info, Keith. Seems that perhaps 3.23.48 has a bug in it, eh?
Im still having problems with open processes. Today it slowed things down enough where I was getting blow errors in a shell program. It was taking over 50% of the system resources once you totall all the MySQL processes.
Anyways from what I can see a mysql thread starts for every user, regardless of weather there a user in files, or mysql. The processes seem to close as users leave, but if I change my nsswitch.conf the processes hang.
I have 60-80 users logging in though ssh and running terminal programs. When I get that many users logged in it sucks up all the system resources.
I'm running ncsd, is there anything I can do to tweak preformace? We can't have login process take more than about 5% of the system resources.
All the systems are at least 1ghz and 512M ram.
Let me know if there is anyting I can help test or if there is any output I can give you.
You could set up MySQL to close idle connections after a specified period of time. In your my.cnf you can add
[libnss_mysql]
wait_timeout=60
So it will disconnect after 60 secods of idle time. I haven't checked the syntax of the above - forgive me if it's incorrect.
At this point, I want to clarify - you're not having problem with *stale* open connections, but rather too many, due to at least one MySQL session being open for every login that you have, correct?
It should be noted that nscd won't cache 'shadow' entries - so a connection will always be made to MySQL to verify the user's password when they log in.
The only sane way to keep the connections down would be to set a timeout in the MySQL server, or for me to provide an option to shut off persistent connections (I wouldn't recommend this for performance reasons, *especially* if this is over tcp/ip).
It's hard for me to pinpoint the exact problem. I watch the mysql process, then the next day I get a emergency call that our temrnial program is getting errors, I check process and there are tons of mysql process running. I'm not sure if this is something that happens over time, or when there are tons of users on.
I'm trying to get as much info as I can but in a production enviornment the main thing is it works. So I usually just have to kill mysql in nsswitch.conf and restart mysql.
Maybe if there is a way we can load test the system without actual users having to be one. I'm willing to spend the time i fyou have any suggestions.
What is "my.cnf" I dont have a file like that, and I'm not sure waht your refering too.
Also a concept question I'm trying to grap:
Why does the connection have to stay open at all? This is probally my limited understanding, but I would think all mysql has to do is connect get the user info, then disconnect. Why does it need to keep the connection open at all? It would seem more efficent to do a quick open/close then open and stay open incase it needs the process. Kind of like PHP and MySQL. We have usually 50-150 users activly using our dynamic php/mysql website but there are never more than 10-20 MySQL processes running.
Thanks again for spending the time
Keith
I'll need to think about a way to 'script' 60+ separate logins to a machine...
In the mean time.. the 'my.cnf' file is the MySQL server configuration file. It's not created by default (except by the RedHat RPMS). It's generally expected to be in the /etc directory. Just create the file and put these two lines in it (corrected from above suggestion)
[mysqld]
set-variable=wait_timeout=60
As far as why persistent connections is a good thing.. the way NSS is designed, there's no real good way to know when a process may be done making user queries.. If we were to close after every query, then consider this example:
A directory of 5,000 files, owned by users in MySQL. Perform an 'ls -l' in this directory. Without persistent connections, *5000* individual connections would be made. Worse, if this were TCP/IP, there would now be 5000 sockets sitting in the CLOSE_WAIT state. A real resource mess at this point. If you took it to, say, 70,000 queries, you'd run out of sockets, and your server would no longer be able to talk TCP to the world. I've actually caused this to happen :-)
I recommend setting the timeout above on your MySQL server (requires restarting the daemon). Verify that it's set using:
mysql -e 'show variables like "wait_timeout"'
The default is 28800.