mysql参数详解
1.日志监控三个经典状态参数
1.innodb_log_waits 用户将redo信息写到log_buffer中产生等待的次数,这种情况下一般都是log buffer的写性能差造成的。官方文档提示因为log_buffer太小导致的。这个参数体现了log_buffer的写性能 2.innodb_log_writes log_buffer发生物理写,写入redo_log文件的次数 3.innodb_os_log_written 日志每秒写的字节数
2.计算数据库检索数据命中率
Innodb_buffer_pool_read_requests:用户访问数据请求的次数(一次访问就是一次请求),这个参数就体现了系统的繁忙程度 Innodb_buffer_pool_reads:数据不在内存中,而在磁盘中,也就是说物理I/O的次数 内存命中率=(Innodb_buffer_pool_read_requests-Innodb_buffer_pool_reads)/Innodb_buffer_pool_read_requests
3.计算内存读的趋势
Innodb_data_read --发生物理读的总的字节数,这个值除以16k也就是等于Innodb_pages_read的值 Innodb_pages_read --每次读取的页数 innodb_rows_read --内存中实际读取的行数,反应了系统实际的工作量,如果异常,一定是出现了异常的SQL
4.调整mysql数据库的读写线程数量
innodb_write_io_threads--默认为4
innodb_read_io_threads--默认为4
是否进行调整我们要结合数据库读写性能,如果数据库在系统最繁忙的时候读写线程还有空闲等待的,那么我们就不需要进行调整,通过下面读写线程的状态,我们就看出数据库的读写线程的数量不需要进行调整
I/O thread 2 state: waiting for completed aio requests (read thread) I/O thread 3 state: waiting for completed aio requests (read thread) I/O thread 4 state: waiting for completed aio requests (read thread) I/O thread 5 state: waiting for completed aio requests (read thread) I/O thread 6 state: waiting for completed aio requests (write thread) I/O thread 7 state: waiting for completed aio requests (write thread) I/O thread 8 state: waiting for completed aio requests (write thread) I/O thread 9 state: waiting for completed aio requests (write thread)