MySQL Forums
Forum List  »  MyISAM

Re: Problems with system locking
Posted by: Ingo Strüwing
Date: April 27, 2006 04:36AM

Hi,

in the system lock state there is not just done file locking, but also MyISAM locking of the table. In that phase just one thread can access the table, others must wait there. The MyISAM table lock is also used during "system unlocking" though this is not shown in the processlist. If the unlock takes some time, other threads can hang in the "System lock" state.

Unlocking can take some time as the key cache is flushed in this phase. This means all key blocks that have been changed during the (e.g. INSERT) statement are written to the index file. But your key cache is small and should not require much searching for dirty pages (which could increase the CPU usage).

Can you exclude that you hit a disk full condition (or file size limit (ulimit -f))? In this case the key cache flushing can wait for some disk space to become free, hence a long system lock phase.

Otherwise I don't think that the CPU usage comes from the system lock state. There may be other effects triggered by this situation.

Can you please explain what you mean with "The query is quick ..., retrieving the data is the problem"? How do you measure the query time in contrast to the data retrieval time?

Regarding 127, especially if you get it quite regularily, is it possible that you hit the maximum table size? You can set it with the AVG_ROW_LENGTH and MAX_ROWS table options of CREATE TABLE and ALTER TABLE (ALTER TABLE makes a copy of the table, this will take some time...). You can view the max file lengths with "myisamchk -dv $DATADIR/db/table" (even while the server works on the table).

--skip-locking is still functional. --skip-external-locking doesn't seem to exist (not 100% sure). It is the default setting. So I dare to exclude that file (system) locking plays a role here.

So much for today.
Regards

Ingo Strüwing, Senior Software Developer - Storage Engines
MySQL AB, www.mysql.com

Options: ReplyQuote


Subject
Views
Written By
Posted
8935
April 26, 2006 05:37AM
Re: Problems with system locking
9561
April 27, 2006 04:36AM
3861
June 13, 2006 09:59PM
2752
June 14, 2006 10:22AM
2995
June 15, 2006 11:18AM
2872
July 14, 2006 03:52PM
2809
August 22, 2006 11:34AM


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.