MySQL Forums
Forum List  »  Performance

Re: Server just hanging (Copying to tmp table)
Posted by: Thomas Deliduka
Date: September 01, 2005 04:39AM

There is something DEFINITELY related to open files. I don't see that MySQL is calling ulimit -n xxxx anywhere but I did add it to my script. I actually added "ulimit -n unlimited" and I see my open files limit is 12288 which is the number ulimit puts it to when running that command. I'm getting ahead of myself though. I'll tell you what happened to me this morning (at this point I hadn't added ulimit to the startup script).

Got a page at 6am. My servers were not responding again. I figured it was the server but I decided to take the opportunity to debug. This time I noticed it wasn't hung queries, it's that connections could not be made to the server. Mysqlreport said:

__ Tables ______________________________________________________________
Open 1.23k of 2400 %Cache: 51.42
Opened 6.71k 0.02/s

I checked ulimit -a and it was set to 1024 for "-n" but earlier yesterday I set that to unlimited so something changed it back! (Automated process somehow?)

when I set it to unlimited again on the command line connections started coming through. I found that interesting. Although on one site the server said that I must run "mysqladmin flush-hosts" in order to connect because there were too many concurrent connections (mysql report still listed only 198 out of 300 total connections used)

So, I ran flush-hosts and that allowed that site in and things started running nicer for a few minutes. Then things bogged down again and people couldn't connect (literally about 4 minutes later) I as confused as to why this happened so I checked ulimit again and it was still 12288. I checked mysql report and it was pretty much the same. I logged into the server and flushed tables and things started running smoothly again.

I noticed in sysctl that kern.maxfiles was set to 12288 so I thought this was related to ulimit -n being set to that max. (although I thought at the time ulimit was setting kern.maxfiles but I think that is the other way around) So, I set kern.maxfiles in sysctl.conf to 12288 and rebooted. I found that the server was still running with a ulimit of 1024 unless I manually changed it. So I added "ulimit -n unlimited" to the MySQL server startup script. And I now see what I reported to you at the top.

I think my server hit max files for some reason. I'm going to play around here and see what I can find out.

I know enough to be dangerous. Thanks for being patient!

Options: ReplyQuote

Written By
December 07, 2006 10:30AM
Re: Server just hanging (Copying to tmp table)
September 01, 2005 04:39AM
September 23, 2005 01:56AM
October 05, 2005 04:58AM
October 05, 2005 11:49PM
October 06, 2005 01:34AM
October 06, 2005 04:57PM
January 21, 2008 10:14AM
January 21, 2008 10:53AM
May 19, 2008 09:41AM
February 05, 2008 10:27AM
March 12, 2008 08:37AM
November 14, 2008 12:31AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.