[MDEV-22990] Threadpool : Optimize network/named pipe IO for Windows Created: 2020-06-23 Updated: 2021-02-17 Resolved: 2020-06-26 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Platform Windows, Server |
| Fix Version/s: | 10.6.0 |
| Type: | Task | Priority: | Major |
| Reporter: | Vladislav Vaintroub | Assignee: | Vladislav Vaintroub |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The WSARecv() calls that we use for the notification about new queries from client, allow (and are typically used with) the output buffer, so whenever notification happens, you already have read off the data. So far we passed 0-sized buffer to WSARecv (which I think is not officially documented, but appears to always work). This emulates Unix-poll readiness notification, works fine, but can be much better optimized. For example, before the query starts, we currently we do WSARecv() at least 3 times - once to get completion/readiness notification ( receiving 0 bytes ), another time when the packet header is read (4 bytes buffer), and the rest of packet (depends on how length parsed from the header). Even if 2 later calls would normally read from the socket buffer, and return without wait , it is an unnecessarily expensive copying from winsock buffers into user buffers. These 3 WSARecv calls can be reduced to 1 , if we passed a buffer during network AIO, which is filled upon AIO completion. Note that in sysbench point-select workload that runs in memory, reading user input with ReadFile(WSARecv) is the most expensive operation, measured at 12% with named pipes |
| Comments |
| Comment by Vladislav Vaintroub [ 2020-06-23 ] | ||||||||||||
|
Excerpt from profiler run on current 10.5 (sysbench in-memory) functions sorted by Self CPU.
|