views:

422

answers:

1

I noticed that 'show processlist' on our MySQL server indicates a lot of threads in 'System lock' state, often followed by just 'Locked', the latter which I'd expect since we have some selects locking behind an update/insert on a MyISAM table.

But 'System lock' shows up a lot more than just 'Locked' (sometimes adding up to 2 seconds to a simple select, according to the profiler), and I don't understand what it indicates. I couldn't find much info on system lock online, but what's there mostly discusses situations with multiple mysqld's accessing the same db, which is not my case. Furthermore, my 'skip external locking' variable is false.

Anyone have experience with this?

Addendum:

If it helps, I tend to see more system locks than table locks ('Locked') by about 3 to 1 in the processlist. Is it possible that for some reason 'System lock' is being output for what's effectively regular table locking?

A: 

you will see this status while mysql is waiting for the OS to take a lock that mysql has requested. is your server scarce on file handles?

longneck
This can be checked by using: ulimit -n
Jeremy
Thanks for the quick replies. If ulimit -n is the key limit, then I don't think that's it by itself. We raised it way up just to be sure, and we still get system locks.
Yash