Book Image

Advanced MySQL 8

By : Eric Vanier, Birju Shah, Tejaswi Malepati
Book Image

Advanced MySQL 8

By: Eric Vanier, Birju Shah, Tejaswi Malepati

Overview of this book

Advanced MySQL 8 teaches you to enhance your existing database infrastructure and build various tools to improve your enterprise applications and overall website performance. The book starts with the new and exciting MySQL 8.0 features and how to utilize them for maximum efficiency. As you make your way through the chapters, you will learn to optimize MySQL performance using indexes and advanced data query techniques for large queries. You will also discover MySQL Server 8.0 settings and work with the MySQL data dictionary to boost the performance of your database. In the concluding chapters, you will cover MySQL 8.0 Group Replication, which will enable you to create elastic, highly available, and fault-tolerant replication topologies. You will also explore backup and recovery techniques for your databases and understand important tips and tricks to help your critical data reach its full potential. By the end of this book, you’ll have learned about new MySQL 8.0 security features that allow a database administrator (DBA) to simplify user management and increase the security of their multi-user environments.
Table of Contents (13 chapters)
11
Advanced MySQL Performance Tips and Techniques

The thread cache

How does MySQL use memory?

MySQL has three actions to help improve the performance of database operations: allocate, reserve some buffers, and cache. The default configuration allows a MySQL server to boot a server with a minimum of 512 MB of RAM. You can improve the performance of MySQL by increasing the values of some system variables related to caches and buffers, as I mentioned in the previous sections.

Suppose your MySQL 8.0 has the following values when running commands:

  • SHOW GLOBAL STATUS LIKE 'max_used_connections'; gives 200
  • SHOW GLOBAL STATUS LIKE 'Threads_created'; gives 200
  • SHOW GLOBAL STATUS LIKE 'connections'; gives 400

The common question that arises is, Do I have to increase the thread_cache_size variable?

This is often subject to the following context: "I'm running SHOW PROCESSLIST, I see open connections...