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
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
  1. DZone
  2. Data Engineering
  3. Databases
  4. How CPU Governor Performance Affects MySQL

How CPU Governor Performance Affects MySQL

This article looks at how CPU governors and the new Intel CPUs and Linux distros affect MySQL performance.

Vadim Tkachenko user avatar by
Vadim Tkachenko
·
May. 12, 16 · Analysis
Like (2)
Save
Tweet
Share
3.99K Views

Join the DZone community and get the full member experience.

Join For Free

In this blog, we’ll examine how CPU governor performance affects MySQL.

It’s been a while since we looked into CPU governors, and with the new Intel CPUs and new Linux distros, I wanted to check how CPU governors affect MySQL performance.

Before jumping to results, let’s review what drivers manage CPU frequency. Traditionally, the default driver was “acpi-cpufreq”, but for the recent Intel CPUs and new Linux kernel it was changed to “intel_pstate”.

To check what driver is being used, run the command cpupower frequency-info .

cpupower frequency-info

analyzing CPU0:

driver:acpi-cpufreq

CPUs which run atthe same hardware frequency:0

CPUs which need tohave their frequency coordinated by software:0

maximum transition latency:10.0us.

hardware limits:1.20GHz-2.00GHz

available frequency steps:2.00GHz,2.00GHz,1.90GHz,1.80GHz,1.70GHz,1.60GHz,1.50GHz,1.40GHz,1.30GHz,1.20GHz

available cpufreq governors:conservative,ondemand,userspace,powersave,performance

current policy:frequency should be within1.20GHz and2.00GHz.

The governor"ondemand"may decide which speed touse

within thisrange.

current CPU frequency is1.20GHz(asserted by call tohardware).

cpufreq stats:2.00GHz:29.48%,2.00GHz:0.00%,1.90GHz:0.00%,1.80GHz:0.00%,1.70GHz:0.00%,1.60GHz:0.00%,1.50GHz:0.00%,1.40GHz:0.00%,1.30GHz:0.37%,1.20GHz:70.15%(7)

boost state support:

Supported:yes

Active:yes

In this case, we can see that the driver is “acpi-cpufreq”, and the governor is “ondemand”.

On my server (running Ubuntu 16.04, running “Intel(R) Xeon(R) CPU E5-2683 v3 @ 2.00GHz” CPUs), I get following output by default settings:

analyzing CPU0:

driver:intel_pstate

CPUs which run atthe same hardware frequency:0

CPUs which need tohave their frequency coordinated by software:0

maximum transition latency:0.97ms.

hardware limits:1.20GHz-3.00GHz

available cpufreq governors:performance,powersave

current policy:frequency should be within1.20GHz and3.00GHz.

The governor"performance"may decide which speed touse

within thisrange.

current CPU frequency is1.50GHz(asserted by call tohardware).

boost state support:

Supported:yes

Active:yes

So, it’s interesting to see that “intel_pstate” with the “performance” governor is chosen by default, and the CPU frequency range is 1.20GHz to 3.00GHz (even though the CPU specification is 2.ooGHz). If we check CPU specification page, it says that 2.00GHz is the “base frequency” and “3.00GHz” is the “Max Turbo” frequency.

In contrast to “intel_pstate”, “acpi-cpufreq” says “frequency should be within 1.20 GHz and 2.00 GHz.”

Also, “intel_pstate” only supports “performance” and “powersave” governors, while “acpi-cpufreq” has a wider range. For this blog, I only tested “ondemand” and “performance”.

Switching between CPU drivers is not easy, as it requires a server reboot—you need to pass a parameter to the kernel startup line. In Ubuntu, you can do this in /etc/default/grub by changing GRUB_CMDLINE_LINUX_DEFAULT to GRUB_CMDLINE_LINUX_DEFAULT="intel_pstate=disable", which will disable intel_pstate and will load acpi-cpufreq.

Is there a real difference in performance between different CPU drivers and CPU governors? To check, I took a sysbench OLTP read-only workload over a 10Gb network, where the data fits into memory (so it is CPU-burning workload).

The results are as follows. This is a chart for absolute throughput:

CPU governor performance

And to better understand relative performance, here is a chart on how other governors perform compared to “intel-pstate” with the performance governor. In this case, I showed relative performance to “PSTATE performance”, which equals “1”. In the chart, the orange bar is “PSTATE powersave” and shows the relative difference between “PSTATE powersave” and “PSTATE performance” (=1):

CPU governor performance

Here are the takeaways I see:

  • The combination of CPU driver and CPU governors still affect performance
  • ACPI ondemand might be not the best choice to achieve the best throughput
  • Intel_pstate “powersave” is slower on a fewer number of threads (I guess the Linux scheduler assign execution to “sleeping” CPU cores)
  • Both ACPI and Intel_pstate “performance” governor shows the best (and practically identical) performance
  • My Ubuntu 16.04 starts with “intel_pstate” + “performance” governor by default, but you still may want to check what the settings are in your case (and change to “performance” if it is not set).
MySQL

Published at DZone with permission of Vadim Tkachenko, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Handling Automatic ID Generation in PostgreSQL With Node.js and Sequelize
  • The Top 3 Challenges Facing Engineering Leaders Today—And How to Overcome Them
  • How to Cut the Release Inspection Time From 4 Days to 4 Hours
  • Getting Started With JMS-ActiveMQ: Explained in a Simple Way

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
  • +1 (919) 678-0300

Let's be friends: