Meltdown Vulnerability Impact On MariaDB Server

Recent attacks, dubbed Meltdown and Spectre, have had a significant impact on various data processors and data security. In response, processors require modifications to the operating system; however, those modifications can be expensive and lead to potential slowdown in the applications and services. The following will explore the performance impact of the Meltdown workaround in the Linux kernel specific to MariaDB Server.

Test Environment

All tests were run on our benchmark machine: 2x 8 core Intel Xeon E5 v3 (Haswell) running Ubuntu Server LTS. We compared kernels 4.4.0-104 and 4.4.0-109. 4.4.0-104 is the last Ubuntu kernel in the 4.4.0 line without the KPTI patch. KPTI stands for Kernel Page Tabe Isolation and is meant as a remedy for the Meltdown attack.

The benchmark is sysbench 1.0 OLTP in read-only and read/write mode. The MariaDB Server version used for this benchmark is MariaDB Server 10.2.11 (GA). MariaDB Server was running mostly with defaults. The InnoDB Buffer Pool was configured to large (all reads coming from memory). The durability was for production (flush-log-at-trx-commit=1). Storage in this machine is SSD.

Since the performance often depends on the malloc implementation, a system function that allocates memory for the program, I ran two series of tests. One with the default glibc malloc and a second with tcmalloc (preloaded with the –malloc-lib option for mysqld_safe).

Results

The numbers shown below are queries per second. Note: higher is better.

OLTP read-only

glibc malloc

tcmalloc

threads

4.4.0

4.4.0 KPTI

change

4.4.0

4.4.0 KPTI

change

1

17111

14894

-12.96%

16091

16039

-0.32%

2

31966

28777

-9.98%

29426

29396

-0.10%

4

56142

53817

-4.14%

54330

56160

+3.37%

8

109148

107049

-1.92%

105223

103910

-1.25%

16

206156

202927

-1.57%

206005

204688

-0.64%

32

279125

259109

-7.17%

290233

278157

-4.16%

64

270800

240219

-11.29%

290560

281810

-3.01%

128

259024

226367

-12.61%

282176

276145

-2.14%

256

262552

232061

-11.61%

284642

277417

-2.54%

Screen Shot 2018-01-24 at 8.51.03 AM.png

The impact of KPTI seems to be much higher at high concurrency. Tcmalloc delivers not only better results, but also the impact of KPTI is somewhat lessened.

OLTP read/write

glibc malloc

tcmalloc

threads

4.4.0

4.4.0 KPTI

change

4.4.0

4.4.0 KPTI

change

1

4706

4584

-2.59%

4772

4805

+0.69%

2

9407

9283

-1.32%

9620

9515

-1.09%

4

15912

15860

-0.33%

16436

15975

-2.80%

8

30531

29200

-4.36%

30786

32298

+4.91%

16

61954

61102

-1.38%

63526

63651

+0.20%

32

126154

121657

-3.56%

129561

128284

-0.99%

64

192459

180334

-6.30%

198795

195860

-1.48%

128

220700

200473

-9.16%

234564

229417

-2.19%

256

227077

164281

-27.65%

241731

235218

-2.69%

Screen Shot 2018-01-24 at 8.51.21 AM.png

For read/write workload the KPTI impact is even higher at high thread counts. Again tcmalloc seems to deliver better results.

Conclusion

The Meltdown patch in the Linux kernel reduces the performance of MariaDB Server by 5% and, in some cases, more than 10%, depending on workload and concurrency. The performance impact is higher with high concurrency. In that case, it may help to try running MariaDB Server with a preloaded high-concurrency memory allocator like tcmalloc, jemalloc or other allocator of choice.

Additional Resources

There are some reports from third parties about KPTI regression for MySQL or general performance impact from Redhat that are worth reviewing. Their results are in line with what we found.