From: Michael Widenius Date: January 11 2010 12:13am Subject: re: myisam_use_mmap = 1 but still lots of [p]read()s List-Archive: http://lists.mysql.com/internals/37625 Message-Id: <19274.27932.810335.831056@narttu2.askmonty.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! >>>>> "Robert" == Robert Milkowski writes: Robert> Hi, Robert> Solaris 10 64bit x86, MySQL 5.1.41 Robert> Despite having myisam_use_mmap = 1 in my.cnf there are still lots of Robert> pread(), read() syscalls to myisam data files. I can see that mysql Robert> detected and honored (at least to some extend) the myisam_use_mmap Robert> setting as if I do: pmap PID_of_mysql I can see myisam files being Robert> mmaped like: Robert> By looking at _mi_get_block_info() i can see at the beginning of the Robert> function that it is calling my_read() which in turn is calling read() Robert> syscall. It's a similar story with _mi_read_rnd_dynamic_record() function. Robert> I haven't look closely at the code but it looks like changing the Robert> discussed two functions to do memcpy() from a mmaped region or even Robert> better set a pointer to mmap'ed region (assuming no modifications are Robert> done) shouldn't be that hard. Robert> During peak hours I can see several hundreds read()/s, sometimes even Robert> more, and getting rid of all these syscalls would probably improve Robert> performance. You are right; Currently the myisam_use_mmap is not fully implemented. Looking quickly at the mi_dynrec.c code, it looks like the following functions needs to be fixed to get read of the reads: _mi_read_cache() _mi_read_rnd_dynamic_record() _mi_get_block_info() Should not be that much work. _mi_cmp_buffer() doesn't have to be changed as this is not used by MySQL. _mi_write_part_record() doens't have to be changed as the write calls are only used when writing to a buffer that will be written to end of file. Regards, Monty Creator of MySQL