cari
Rumahpangkalan datatutorial mysqlMySQL Thread Pool: Problem Definition

A new thread pool plugin is now a part of the MySQL Enterprise Edition.

In this blog we will cover the problem that the thread pool is solving

and some high-level description of how it solves this problem.

In the traditional MySQL server model there is a one-to-one mapping between

thread and connection. Even the MySQL server has lots of code where thread

or some abbreviation of thread is actually representing a connection.

Obviously this mapping has served MySQL very well over the years, but there

are some cases where this model don't work so well.

One such case is where there are much more connections executing queries

simultaneously compared to the number of CPUs available in the server. The

MySQL Server also have scalability bottlenecks where performance suffers

when too many connections execute in parallel.

So effectively there are two reasons that can make performance suffer in

the original MySQL Server model.

The first is that many connections executing in parallel means that the

amount of data that the CPUs work on increases. This will decrease the

CPU cache hit rates. Lowering the CPU cache hit rate can have a significant

negative impact on server performance. Actually in some cases the amount

of memory allocated by the connections executing in parallel could at times

even supersede the memory available in the server. In this case we enter a

state called swapping which is very detrimental to performance.

The second problem is that the number of parallel queries and transactions

can have a negative impact on the throughput through the "critical sections"

of the MySQL Server (critical section is where mutexes are applied to

ensure only one CPU changes a certain data structure at a time, when such

a critical section becomes a scalability problem we call it a hot spot).

Statements that writes are more affected since they use more critical

sections.

Neither of those problems can be solved in the operating system scheduler.

However there are some operating systems that have attempted solving this

problem for generic applications on a higher level in the operating system.

Both of those problems have the impact that performance suffers more and

more as the number of statements executed in parallel increases.

In addition there are hot spots where the mutex is held for a longer time

when many concurrent statements and/or transactions are executed in

parallel. One such example is the transaction list in InnoDB where each

transaction is listed in a linked list. Thus when the number of concurrent

transactions increases the time to scan the list increases and the time

holding the lock increases and thus the hot spot becomes even hotter

as the concurrency increases.

Current solutions to these issues exist in InnoDB through use of the

configuration parameter --innodb-thread-concurrency. When this parameter

is set to a nonzero value, this indicates how many threads are

able to run through InnoDB code concurrently. This solution have its

use cases where it works well. It does however have the drawback that

the solution itself contains a hot spot that limits the MySQL server

scalability. It does also not contain any solution to limiting the

number of concurrent transactions.

In a previous alpha version of the MySQL Server (MySQL 6.0) a thread

pool was developed. This thread pool solved the problem with limiting

the number of concurrent threads executing. It did nothing to solve

the problem with limiting the number of concurrent transactions.

It was also a scalability bottleneck in itself. Finally it didn't

solve all issues regarding long queries and blocked queries.

This made it possible for the MySQL Server to become completely

blocked.

When developing the thread pool extension now available in the MySQL

Enterprise Edition we decided to start from a clean plate with the

following requirements:

1) Limit the number of concurrently executing statements to ensure

that each statement execution has sufficient CPU and memory resources

to fulfill its task.

2) Split threads and connection into thread groups that are

independently managed. This is to ensure that the thread pool

plugin itself doesn't become a scalability bottleneck. The

aim is that each thread group has one or zero active threads

at any point in time.

3) Limit the number of concurrently executing transactions

through prioritizing queued connections dependent on if

they have started a transaction or not.

4) Avoid deadlocks when a statement execution becomes long or

when the statement is blocked for some reason for an extended

time.

If you are interested in knowing more details of how the new

thread pool solves these requirements there will be a

webinar on Thursday 20 Oct 2011 at 9.00 PDT. Check here

for details on how to access it.

If you want to try out the thread pool go here.

参考:

http://mikaelronstrom.blogspot.ae/2011/10/mysql-thread-pool-problem-definition.html

Kenyataan
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Kurangkan penggunaan memori MySQL di DockerKurangkan penggunaan memori MySQL di DockerMar 04, 2025 pm 03:52 PM

Artikel ini meneroka mengoptimumkan penggunaan memori MySQL di Docker. Ia membincangkan teknik pemantauan (statistik Docker, skema prestasi, alat luaran) dan strategi konfigurasi. Ini termasuk had memori docker, swapping, dan cgroups, bersama -sama

Cara menyelesaikan masalah MySQL tidak dapat membuka perpustakaan bersamaCara menyelesaikan masalah MySQL tidak dapat membuka perpustakaan bersamaMar 04, 2025 pm 04:01 PM

Artikel ini menangani ralat "tidak dapat membuka perpustakaan kongsi" MySQL. Isu ini berpunca daripada ketidakupayaan MySQL untuk mencari perpustakaan bersama yang diperlukan (.so/.dll fail). Penyelesaian melibatkan mengesahkan pemasangan perpustakaan melalui pakej sistem m

Bagaimana anda mengubah jadual di MySQL menggunakan pernyataan Alter Table?Bagaimana anda mengubah jadual di MySQL menggunakan pernyataan Alter Table?Mar 19, 2025 pm 03:51 PM

Artikel ini membincangkan menggunakan pernyataan jadual Alter MySQL untuk mengubah suai jadual, termasuk menambah/menjatuhkan lajur, menamakan semula jadual/lajur, dan menukar jenis data lajur.

Jalankan MySQL di Linux (dengan/tanpa bekas podman dengan phpmyadmin)Jalankan MySQL di Linux (dengan/tanpa bekas podman dengan phpmyadmin)Mar 04, 2025 pm 03:54 PM

Artikel ini membandingkan memasang MySQL pada Linux secara langsung berbanding menggunakan bekas podman, dengan/tanpa phpmyadmin. Ia memperincikan langkah pemasangan untuk setiap kaedah, menekankan kelebihan Podman secara berasingan, mudah alih, dan kebolehulangan, tetapi juga

Apa itu SQLite? Gambaran Keseluruhan KomprehensifApa itu SQLite? Gambaran Keseluruhan KomprehensifMar 04, 2025 pm 03:55 PM

Artikel ini memberikan gambaran menyeluruh tentang SQLite, pangkalan data relasi tanpa server tanpa mandiri. Ia memperincikan kelebihan SQLITE (kesederhanaan, mudah alih, kemudahan penggunaan) dan kekurangan (batasan konkurensi, cabaran skalabiliti). C

Menjalankan Pelbagai Versi MySQL di MacOS: Panduan Langkah demi LangkahMenjalankan Pelbagai Versi MySQL di MacOS: Panduan Langkah demi LangkahMar 04, 2025 pm 03:49 PM

Panduan ini menunjukkan pemasangan dan menguruskan pelbagai versi MySQL pada macOS menggunakan homebrew. Ia menekankan menggunakan homebrew untuk mengasingkan pemasangan, mencegah konflik. Pemasangan Butiran Artikel, Permulaan/Perhentian Perkhidmatan, dan PRA Terbaik

Bagaimana saya mengkonfigurasi penyulitan SSL/TLS untuk sambungan MySQL?Bagaimana saya mengkonfigurasi penyulitan SSL/TLS untuk sambungan MySQL?Mar 18, 2025 pm 12:01 PM

Artikel membincangkan mengkonfigurasi penyulitan SSL/TLS untuk MySQL, termasuk penjanaan sijil dan pengesahan. Isu utama menggunakan implikasi keselamatan sijil yang ditandatangani sendiri. [Kira-kira aksara: 159]

Apakah beberapa alat GUI MySQL yang popular (mis., MySQL Workbench, phpmyadmin)?Apakah beberapa alat GUI MySQL yang popular (mis., MySQL Workbench, phpmyadmin)?Mar 21, 2025 pm 06:28 PM

Artikel membincangkan alat MySQL GUI yang popular seperti MySQL Workbench dan PHPMyAdmin, membandingkan ciri dan kesesuaian mereka untuk pemula dan pengguna maju. [159 aksara]

See all articles

Alat AI Hot

Undresser.AI Undress

Undresser.AI Undress

Apl berkuasa AI untuk mencipta foto bogel yang realistik

AI Clothes Remover

AI Clothes Remover

Alat AI dalam talian untuk mengeluarkan pakaian daripada foto.

Undress AI Tool

Undress AI Tool

Gambar buka pakaian secara percuma

Clothoff.io

Clothoff.io

Penyingkiran pakaian AI

AI Hentai Generator

AI Hentai Generator

Menjana ai hentai secara percuma.

Alat panas

Dreamweaver CS6

Dreamweaver CS6

Alat pembangunan web visual

Hantar Studio 13.0.1

Hantar Studio 13.0.1

Persekitaran pembangunan bersepadu PHP yang berkuasa

Penyesuai Pelayan SAP NetWeaver untuk Eclipse

Penyesuai Pelayan SAP NetWeaver untuk Eclipse

Integrasikan Eclipse dengan pelayan aplikasi SAP NetWeaver.

mPDF

mPDF

mPDF ialah perpustakaan PHP yang boleh menjana fail PDF daripada HTML yang dikodkan UTF-8. Pengarang asal, Ian Back, menulis mPDF untuk mengeluarkan fail PDF "dengan cepat" dari tapak webnya dan mengendalikan bahasa yang berbeza. Ia lebih perlahan dan menghasilkan fail yang lebih besar apabila menggunakan fon Unicode daripada skrip asal seperti HTML2FPDF, tetapi menyokong gaya CSS dsb. dan mempunyai banyak peningkatan. Menyokong hampir semua bahasa, termasuk RTL (Arab dan Ibrani) dan CJK (Cina, Jepun dan Korea). Menyokong elemen peringkat blok bersarang (seperti P, DIV),

Muat turun versi mac editor Atom

Muat turun versi mac editor Atom

Editor sumber terbuka yang paling popular