

When Database Warm Up is Not Really UP
source link: https://www.tuicool.com/articles/hit/buUVFzM
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

The common wisdom with database performance management is that a “cold” database server has poor performance. Then, as it “warms up”, performance improves until finally you reach a completely warmed up state with peak database performance. In other words, that to get peak performance from MySQL you need to wait for database warm up.
This thinking comes from the point of view of database cache warmup. Indeed from the cache standpoint, you start with an empty cache and over time the cache is filled with data. Moreover the longer the database runs, the more statistics about data access patterns it has, and the better it can manage database cache contents.
Over recent years with the rise of SSDs, cache warmup has become less of an issue. High Performance NVMe Storage can do more than 1GB/sec read, meaning you can warm up a 100GB database cache in less than 2 minutes. Also, SSD IO latency tends to be quite good so you’re not paying as high a penalty for a higher miss rate during the warm up stage.
It is not all so rosy with database performance over time. Databases tend to delay work when possible, but there is only so much delaying you can do. When the database can’t delay work any longer performance tends to be negatively impacted. Here are some examples of delaying work:
- Checkpointing: depending on the database technology and configuration, checkpointing may be delayed for 30 minutes or more after database start
- Change Buffer (Innodb) can delay index maintenance work
- Pushing Messages from Buffers to Leaves (TokuDB) can be delayed until space in the buffers is exhausted
- Compaction for RocksDB and other LSM-Tree based system can take quite a while to reach steady state
In all these cases database performance can be a lot better almost immediately after start compared to when it is completely “warmed up”.
An experiment with database warm up
Let’s illustrate this with a little experiment running Sysbench with MySQL and Innodb storage engine for 15 minutes:
sysbench --db-driver=mysql --threads=200 --rand-type=uniform --report-interval=10 --percentile=99 --time=900 --mysql-user=root --mysql-password= /usr/share/sysbench/oltp_update_index.lua --table_size=100000000 run
Let’s look in detail at what happens during the run using graphs from Percona Monitoring and Management
As you can see the number of updates/sec we’re doing actually gets worse (and more uneven) after the first 3 minutes, while a jump to peak performance is almost immediate
The log space usage explains some of this—in the first few minutes, we did not need to do as aggressive flushing as we had to do later.
On the InnoDB I/O graph we can see a couple of interesting things. First, you can see how quickly warm up happens—in 2 minutes the IO is already at half of its peak. You can also see the explanation for the little performance dip after its initial high performance (around 19:13)—this is where we got close to using all log space, so active flushing was required while, at the same time, a lot of IO was still needed for cache warmup.
Reaching Steady Stateis another term commonly used to describe the stage after warm up completes. Note though that such steady state is not guaranteed to be steady at all. In fact, the most typical steady state is unsteady. For example, you can see in this blog post both InnoDB and MyRocks have quite a variance.
Summary
While the term database warm up may imply performance after warm up will be better, it is often not the case. “Reaching Steady State” is a better term as long as you understand that “steady” does not mean uniform performance.
Recommend
-
42
The human brain is a marvelous machine that scientists, philosophers, and mathematicians have sought to emulate for centuries. If a human can do it—with its emotional flaws and such—couldn’t a machine do it better? If the...
-
19
Warm Up Logs from Cold Storage · Banzai Cloud This website stores cookies on your computer. These cookies are used to collect information about how you interact with our website and allow us to rememb...
-
20
Warm fuzzy feelings from my web server logs I love to see it when people explore and discover new things for themselves. Sometimes it's just a matter of suggesting that a doorway exists, metaphorically speaking, and then they'll...
-
6
The art of business phone calls: warm transfers I've talked about the dying art of making outgoing business calls in a polite and clueful manner. Making intelligent use...
-
20
new-window-manager-warm.png (1920×1200)
-
11
A Warm Serif Family With Calligraphic Style: Qeskile Voyage From Din Studio December 21, 2020 ...
-
21
Flic Uses CES Warm-Up Event to Demo Next-Generation Smart Buttons By Dan Price 2 hours ago...
-
13
How to add warm-up and cool-down time to Scheduler events. The additional time segments are stored and displayed automatically but drag and drop is only enabled for the core event.
-
10
Dec 28 2020 Speeding up warm builds in Xcode Programmers who have ever developed software for Apple platforms in the early days of Swift...
-
17
JVM 预热(warm-up)是一个臭名昭著的问题。尽管基于JVM的应用程序有着出色的性能,但是需要一个预热的过程,在预热期间,性能不是最佳的。它可以归...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK