Add status counters for tuning innodb_concurrency_tickets
Right now there is no way to tell how innodb_
1) # of times a thread has slept before joining queue
this tells us how often we reach innodb_
starting
2) # of times a thread has used up all available tickets and been put into queue
this tells us how often innodb_
single statement
3) # of times OS_THREAD_MAX_N was met and thread entered innodb anyway
this would indicate something bad??
4) total time waited by all threads
how much queuing was affecting performance
Blueprint information
- Status:
- Not started
- Approver:
- None
- Priority:
- Medium
- Drafter:
- None
- Direction:
- Approved
- Assignee:
- None
- Definition:
- New
- Series goal:
- None
- Implementation:
- Unknown
- Milestone target:
- None
- Started by
- Completed by
Related branches
Related bugs
Sprints
Whiteboard
I believe these can be answered at the following lines of file srv/srv0srv.c, using line
numbers from latest 5.1.45 source release
1) add after line 1060
1055 /* If the transaction is not holding resources, let it sleep
1056 for SRV_THREAD_
1057
1058 if (!has_slept && !trx->has_
1059 && NULL == UT_LIST_
1060
1061 has_slept = TRUE; /* We let it sleep only once to avoid
1062 starvation */
1063
1064 srv_conc_
2) add "if (trx->n_
1019 /* If trx has 'free tickets' to enter the engine left, then use one
1020 such ticket */
1021
1022 if (trx->n_
1023 trx->n_
1024
1025 return;
1026 }
1027
3) add before line 1109
1099 if (i == OS_THREAD_MAX_N) {
1100 /* Could not find a free wait slot, we must let the
1101 thread enter */
1102
1103 srv_conc_
1104 trx->declared_
1105 trx->n_
1106
1107 os_fast_
1108
1109 return;
1110 }
4) calculate difference of microtime between lines 1133 and 1135
1125 srv_conc_
1126
1127 os_fast_
1128
1129 /* Go to wait for the event; when a thread leaves InnoDB it will
1130 release this thread */
1131
1132 trx->op_info = "waiting in InnoDB queue";
1133
1134 os_event_
1135
1136 trx->op_info = "";
1137
1138 os_fast_
1139
1140 srv_conc_