Is your MySQL Server Loaded ?

So you’re running the benchmark/stress test – how do you tell if MySQL server is really loaded ? This looks like the trivial question but in fact, especially when workload consists of simple queries I see the load generation and network really putting a lot less load on MySQL than expected. For example you may have 32 threads (or processes) running queries as fast as they can… does it really mean there is an 32 concurrent queries ran all the time ? It may be the case or it may be not…

Take a look at this server for example:

This corresponds to what is expected to be stress load but we can see MySQL is getting only spikes of concurrent query executions and most commonly there are no queries executing. Value 1 for Threads_running corresponds to the connection which runs “SHOW STATUS” so you need to subscribe 1 from the reported amount to see the true number. No wonder in the case above there were a lot of free CPU and IO capacity.

Take a look at another sample:

In this case the load is higher and a lot more uniform – there are cases when actually 32 queries are active (this is test with 32 connections) – but you can see most of the time it is less than that.

Looking at Threads_running is a very simple and powerful tool to see whenever you’re really putting sustained load on the database you may be expecting.

It may be worth to explain what value of Threads_running represents. This is amount of queries which are being currently processing – the ball is on Server side. The server has gotten the query but has not completed sending response back yet. This is a very broad measure of activity – if query is waiting on IO, blocked on Mutex, table lock, row level lock, waiting on innodb_thread_concurrency it will be still considered running. This will be even the case when result of large query is being sent back and send operation is blocked because of slow network or the client. Because the measure is so broad it is very helpful to see if client is loading the server well – if it does the number of threads_running will be appropriately high.

Share this post

Comments (7)


    Any idea what “-1” as a Threads_running value could mean?

    March 19, 2010 at 10:35 pm
  • peter


    This probably means you’re running mysqladmin extended -i1 -r (note -r) which shows changes in status variables. This corresponds to amount of threads running decreased by 1.

    March 20, 2010 at 2:27 pm
  • Deep


    I’m not sure about this, but my problem is that I only see Threads_running=1 in my Show Status. Is it okay or sth wrong with my settings.

    I did some search and found this is okay as per these links

    But how come you can see threads running more than 1

    Thanx for your time


    April 1, 2010 at 1:11 am
  • arun


    you possibly do not have any non-sleeping threads (except the show slave status thread).


    August 25, 2010 at 10:47 am
  • Simon J Mudd

    Also look at this bug report I made recently:, as I have had issue with not seeing the wood for the trees so to speak because of a high number of running slaves on the server.

    April 15, 2013 at 1:34 pm
  • Peter Zaitsev


    Thanks for filing a bug report. It is important indeed.

    April 15, 2013 at 2:48 pm
  • Vitaly

    I see more threads_running on my MySQL 5.5 server recently (100 instead of 10-20).
    All other metrics [slow queries, locks, innodb row operations, end2end system performance …] seem in line with previous period.

    Should we check something else? just raise monitoring threshold?

    thank you

    December 3, 2013 at 3:19 am

Comments are closed.

Use Percona's Technical Forum to ask any follow-up questions on this blog topic.