quick mysql performance check
DESCRIPTION
This was the presentation by Wayne Leutwyler at the inaugural Central Ohio MySQL Meetup Group.TRANSCRIPT
![Page 1: Quick MySQL performance check](https://reader035.vdocument.in/reader035/viewer/2022081413/548f42f2b4795916248b47ee/html5/thumbnails/1.jpg)
MySQL Meetup September 8th, 2014
![Page 2: Quick MySQL performance check](https://reader035.vdocument.in/reader035/viewer/2022081413/548f42f2b4795916248b47ee/html5/thumbnails/2.jpg)
Text
Welcome!To the 1st of many MySQL Meetups!
![Page 3: Quick MySQL performance check](https://reader035.vdocument.in/reader035/viewer/2022081413/548f42f2b4795916248b47ee/html5/thumbnails/3.jpg)
Agenda:
• Food and registration 5:30 - 6:30
• Speaker 6:30 - 7:00
• Questions 7:00 - 7:30
• Networking 7:30 - 8:00
![Page 4: Quick MySQL performance check](https://reader035.vdocument.in/reader035/viewer/2022081413/548f42f2b4795916248b47ee/html5/thumbnails/4.jpg)
Quick Performance CheckPresented by: Wayne Leutwyler
![Page 5: Quick MySQL performance check](https://reader035.vdocument.in/reader035/viewer/2022081413/548f42f2b4795916248b47ee/html5/thumbnails/5.jpg)
When a quick look is needed.
Weekday management fire drill.
2am OnCall page.
Unhappy customer calls you to complain about response time.
Or anytime you just want to see how a certain database server is performing.
![Page 6: Quick MySQL performance check](https://reader035.vdocument.in/reader035/viewer/2022081413/548f42f2b4795916248b47ee/html5/thumbnails/6.jpg)
The Views.
v_InnoBPHitRate
v_table_cache_used
v_table_definition_cache_use
v_thread_cache_hit
v_thread_cache_used
v_tmp_to_disk
Below are 6 views that I find very useful for day today performance check, or the 2am issue.
![Page 7: Quick MySQL performance check](https://reader035.vdocument.in/reader035/viewer/2022081413/548f42f2b4795916248b47ee/html5/thumbnails/7.jpg)
v_InnoBPHitRateCREATE
ALGORITHM = UNDEFINED
DEFINER = `wayne`@`localhost`
SQL SECURITY DEFINER
VIEW `v_InnoBPHitRate` AS
select
round((100 - ((100 * `P2`.`VARIABLE_VALUE`) / `P1`.`VARIABLE_VALUE`)),
2) AS `InnoBP Hit Rate`,
`P2`.`VARIABLE_VALUE` AS `InnoBP Read Requests (from disk)`,
`P1`.`VARIABLE_VALUE` AS `InnoBP Reads (from BP)`
from
(`information_schema`.`GLOBAL_STATUS` `P1`
join `information_schema`.`GLOBAL_STATUS` `P2`)
where
((`P1`.`VARIABLE_NAME` = 'innodb_buffer_pool_read_requests')
and (`P2`.`VARIABLE_NAME` = 'innodb_buffer_pool_reads'))
I have always gone with 50%of total server ram for my InnoDBbuffer pool. Recommendations range from 50% to 80%.
![Page 8: Quick MySQL performance check](https://reader035.vdocument.in/reader035/viewer/2022081413/548f42f2b4795916248b47ee/html5/thumbnails/8.jpg)
v_table_cache_usedCREATE
ALGORITHM = UNDEFINED
DEFINER = `wayne`@`localhost`
SQL SECURITY DEFINER
VIEW `v_table_cache_used` AS
select
round(((`information_schema`.`global_status`.`VARIABLE_VALUE` /
`information_schema`.`GLOBAL_VARIABLES`.`VARIABLE_VALUE`) * 100),
2) AS `Table Cache % Used`
from
(`information_schema`.`global_status`
join `information_schema`.`GLOBAL_VARIABLES`)
where
((`information_schema`.`global_status`.`VARIABLE_NAME` = 'opened_tables')
and (`information_schema`.`GLOBAL_VARIABLES`.`VARIABLE_NAME` = 'table_open_cache'))
Below 90% Adjust: table_open_cache
![Page 9: Quick MySQL performance check](https://reader035.vdocument.in/reader035/viewer/2022081413/548f42f2b4795916248b47ee/html5/thumbnails/9.jpg)
v_table_definition_cache_useCREATE
ALGORITHM = UNDEFINED
DEFINER = `wayne`@`localhost`
SQL SECURITY DEFINER
VIEW `v_table_definition_cache_used` AS
select
round(((`information_schema`.`global_status`.`VARIABLE_VALUE`
/ `information_schema`.`GLOBAL_VARIABLES`.`VARIABLE_VALUE`) * 100),
2) AS `Table Definition Cache % Used`
from
(`information_schema`.`global_status`
join `information_schema`.`GLOBAL_VARIABLES`)
where
((`information_schema`.`global_status`.`VARIABLE_NAME` = 'open_table_definitions')
and (`information_schema`.`GLOBAL_VARIABLES`.`VARIABLE_NAME` = 'table_definition_cache'))
Above 100% adjust:table_definition_cache
![Page 10: Quick MySQL performance check](https://reader035.vdocument.in/reader035/viewer/2022081413/548f42f2b4795916248b47ee/html5/thumbnails/10.jpg)
v_thread_cache_hit
CREATE
ALGORITHM = UNDEFINED
DEFINER = `wayne`@`localhost`
SQL SECURITY DEFINER
VIEW `v_thread_cache_hit` AS
select
round((100 - ((`p1`.`VARIABLE_VALUE` / `p2`.`VARIABLE_VALUE`) * 100)),
2) AS `Thread Cache Hit Rate`,
`p1`.`VARIABLE_VALUE` AS `Threads Created`,
`p2`.`VARIABLE_VALUE` AS `Connections`
from
(`information_schema`.`global_status` `p1`
join `information_schema`.`global_status` `p2`)
where
((`p1`.`VARIABLE_NAME` = 'threads_created')
and (`p2`.`VARIABLE_NAME` = 'connections'))
Below 90% adjust:thread_cache_size
![Page 11: Quick MySQL performance check](https://reader035.vdocument.in/reader035/viewer/2022081413/548f42f2b4795916248b47ee/html5/thumbnails/11.jpg)
v_thread_cache_usedCREATE
ALGORITHM = UNDEFINED
DEFINER = `wayne`@`localhost`
SQL SECURITY DEFINER
VIEW `v_thread_cache_used` AS
select
round(((`information_schema`.`global_status`.`VARIABLE_VALUE`
/ `information_schema`.`GLOBAL_VARIABLES`.`VARIABLE_VALUE`) * 100),
2) AS `Thread Cache % Used`
from
(`information_schema`.`global_status`
join `information_schema`.`GLOBAL_VARIABLES`)
where
((`information_schema`.`global_status`.`VARIABLE_NAME` = 'threads_cached')
and (`information_schema`.`GLOBAL_VARIABLES`.`VARIABLE_NAME` = 'thread_cache_size'))
Above 100% adjust:thread_cache_size
![Page 12: Quick MySQL performance check](https://reader035.vdocument.in/reader035/viewer/2022081413/548f42f2b4795916248b47ee/html5/thumbnails/12.jpg)
v_tmp_to_diskCREATE
ALGORITHM = UNDEFINED
DEFINER = `wayne`@`localhost`
SQL SECURITY DEFINER
VIEW `v_tmp_to_disk` AS
select
round(((`p1`.`VARIABLE_VALUE` / `p2`.`VARIABLE_VALUE`) * 100),
2) AS `Percent TMP to Disk`
from
(`information_schema`.`global_status` `p1`
join `information_schema`.`global_status` `p2`)
where
((`p1`.`VARIABLE_NAME` = 'CREATED_TMP_DISK_TABLES')
and (`p2`.`VARIABLE_NAME` = 'CREATED_TMP_TABLES'))
If percent is 25% or higher adjust:tmp_table_sizemax_heap_table_size
![Page 13: Quick MySQL performance check](https://reader035.vdocument.in/reader035/viewer/2022081413/548f42f2b4795916248b47ee/html5/thumbnails/13.jpg)
Command Line Tools
top
iostat
vmstat
free
When you cant find an issue with the DB, time to check the system.
![Page 14: Quick MySQL performance check](https://reader035.vdocument.in/reader035/viewer/2022081413/548f42f2b4795916248b47ee/html5/thumbnails/14.jpg)
House Keeping
Put your trash in the proper place.
Don’t wonder around the building.
Please put the chairs back the way they were.
Please keep the noise down. We don’t want to disturb people still working.
![Page 15: Quick MySQL performance check](https://reader035.vdocument.in/reader035/viewer/2022081413/548f42f2b4795916248b47ee/html5/thumbnails/15.jpg)
Thank you!
Percona for the food and drinks.
CareWorks Tech for hosting our meeting.
![Page 16: Quick MySQL performance check](https://reader035.vdocument.in/reader035/viewer/2022081413/548f42f2b4795916248b47ee/html5/thumbnails/16.jpg)
The views expressed in this presentation are mine alone.
Thank You
questions?