DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Building Scalable Real-Time Apps with AstraDB and Vaadin
Register Now

Trending

  • Application Architecture Design Principles
  • How To Scan and Validate Image Uploads in Java
  • Security Challenges for Microservice Applications in Multi-Cloud Environments
  • Constructing Real-Time Analytics: Fundamental Components and Architectural Framework — Part 2

Trending

  • Application Architecture Design Principles
  • How To Scan and Validate Image Uploads in Java
  • Security Challenges for Microservice Applications in Multi-Cloud Environments
  • Constructing Real-Time Analytics: Fundamental Components and Architectural Framework — Part 2
  1. DZone
  2. Data Engineering
  3. Databases
  4. Is your MySQL Server Loaded ?

Is your MySQL Server Loaded ?

Peter Zaitsev user avatar by
Peter Zaitsev
·
Mar. 22, 10 · News
Like (0)
Save
Tweet
Share
5.69K Views

Join the DZone community and get the full member experience.

Join For Free
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:

[root@db01 ~]# mysqladmin -i1  extended | grep Threads_running
| Threads_running | 1
| Threads_running | 1
| Threads_running | 1
| Threads_running | 19
| Threads_running | 1
| Threads_running | 1
| Threads_running | 20
| Threads_running | 1
| Threads_running | 1
| Threads_running | 1
| Threads_running | 11
| Threads_running | 1
 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:

| Threads_running					   | 33				   
| Threads_running | 27
| Threads_running | 1
| Threads_running | 28
| Threads_running | 19
| Threads_running | 21
| Threads_running | 2
| Threads_running | 27
| Threads_running | 27
| Threads_running | 32
| Threads_running | 27
| Threads_running | 1
| Threads_running | 24
| Threads_running | 29

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.

Database MySQL

Published at DZone with permission of Peter Zaitsev, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • Application Architecture Design Principles
  • How To Scan and Validate Image Uploads in Java
  • Security Challenges for Microservice Applications in Multi-Cloud Environments
  • Constructing Real-Time Analytics: Fundamental Components and Architectural Framework — Part 2

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: