I measured the benefit using the insert benchmark from Tokutek on a server that can do a lot of IO. CPU overheads are measured using oprofile. The data below lists the percentage of time for the top 4 functions in mysqld. The checksum is computed in buf_calc_page_new_checksum. By using the fast checksum, the checksum overhead drops from 33.6% to 22.1% for gcc -O2 and from 31.6% to 17.3% for gcc -O3.
Overhead for gcc -O2
Using the original checksum code:
- 33.6% - buf_calc_page_new_checksum
- 10.4% - memcpy
- 4.4% - os_aio_simulated_handle
- 4.3% - rec_get_offsets_func
- 22.1% - buf_calc_page_new_checksum
- 12.1% - memcpy
- 5.1% - rec_get_offsets_func
- 4.9% - os_aio_simulated_handle
Using the original checksum code:
- 31.6% - buf_calc_page_new_checksum
- 12.6% - memcpy
- 5.8% - rec_get_offsets_func
- 2.6 - os_aio_simulated_handle
- 17.3% - buf_calc_page_new_checksum
- 13.6% - memcpy
- 6.8% - rec_get_offsets_func
- 2.0% - os_aio_simulated_handle


as you give up backward compatibility, why bother with 32 bit words for checksum calculation? you can use 64 bit words -should go even faster.
ReplyDeleteIt probably would, but then you need to replace the checksum function with one that works for 64-bit integers.
ReplyDelete