| Bug #58759 | Unnecessary poll before write | ||
|---|---|---|---|
| Submitted: | 6 Dec 2010 15:01 | Modified: | 15 Jan 2013 14:00 |
| Reporter: | Olaf van der Spek (Basic Quality Contributor) | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: C API (client library) | Severity: | S5 (Performance) |
| Version: | 5.1.49 | OS: | Any |
| Assigned to: | Matthew Lord | CPU Architecture: | Any |
| Tags: | qc | ||
[15 Jan 2013 14:00]
Matthew Lord
I can only assume that you're referring to libmysql when you say the C API? We are not explicitly making each poll call in libmysql, but rather with strace you are seeing lower level syscalls. The poll is done to ensure that the FD is available/ready for I/O and that nothing has changed (permissions, file was changed/extended/etc., file was deleted/unlinked, etc.). The poll call is also actually necessary in order to do (or at least attempt) non-blocking IO. One of the flags used/set (also seen in your example output) is POLLIN or "Data other than high priority data may be read without blocking.". I will close this for now as Not a Bug. If you feel that I'm somehow mistaken, please let me know. Thank you for the bug report, and for using MySQL!

Description: The client lib appears to do a poll before every write. AFAIK this isn't necessary and should thus not be done. poll([{fd=3, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout) write(3, "+\0\0\0\3select name, value from xbt"..., 47) = 47 read(3, "\1\0\0\1\0025\0\0\2\3def\3xbt\nxbt_config\nxbt"..., 16384) = 139 poll([{fd=3, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout) write(3, "3\0\0\0\3select begin, end from xbt_"..., 55) = 55 read(3, "\1\0\0\1\2I\0\0\2\3def\3xbt\23xbt_deny_from_"..., 16384) = 173 How to repeat: strace