[MDEV-27943] Reduce overhead of attaching THD to OS thread, in threadpool Created: 2022-02-25 Updated: 2023-09-27 Resolved: 2022-10-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Server |
| Affects Version/s: | 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8 |
| Fix Version/s: | 10.6.11, 10.7.7, 10.8.6, 10.9.4, 10.10.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladislav Vaintroub | Assignee: | Vladislav Vaintroub |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
To execute any command, a THD needs to be "attached" to the OS thread, which means, that
Some of that is expensive, when run millions of times, specifically, getting the os_thread_id on Linux is a system call. pthread_self, while not as expensive is still a library call. Also, current code used in THD::store_globals does a lot more currently, than it should do for threadpool, making thread_attach() on Linux about half as expensive as the inevitable epoll_ctl(). For simple commands like "do 1", thread_attaching can take as much as about 7% of the query execution overhead (excluding network IO) |