VariablesController.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Displays a list of server status variables
  5. *
  6. * @package PhpMyAdmin\Controllers
  7. */
  8. declare(strict_types=1);
  9. namespace PhpMyAdmin\Controllers\Server\Status;
  10. use PhpMyAdmin\Util;
  11. /**
  12. * Class VariablesController
  13. * @package PhpMyAdmin\Controllers\Server\Status
  14. */
  15. class VariablesController extends AbstractController
  16. {
  17. /**
  18. * @param array $params Request parameters
  19. * @return string HTML
  20. */
  21. public function index(array $params): string
  22. {
  23. if (isset($params['flush'])) {
  24. $this->flush($params['flush']);
  25. }
  26. if ($this->data->dataLoaded) {
  27. $categories = [];
  28. foreach ($this->data->sections as $sectionId => $sectionName) {
  29. if (isset($this->data->sectionUsed[$sectionId])) {
  30. $categories[$sectionId] = [
  31. 'id' => $sectionId,
  32. 'name' => $sectionName,
  33. 'is_selected' => false,
  34. ];
  35. if (! empty($params['filterCategory'])
  36. && $params['filterCategory'] === $sectionId
  37. ) {
  38. $categories[$sectionId]['is_selected'] = true;
  39. }
  40. }
  41. }
  42. $links = [];
  43. foreach ($this->data->links as $sectionName => $sectionLinks) {
  44. $links[$sectionName] = [
  45. 'name' => 'status_' . $sectionName,
  46. 'links' => $sectionLinks,
  47. ];
  48. }
  49. $descriptions = $this->getDescriptions();
  50. $alerts = $this->getAlerts();
  51. $variables = [];
  52. foreach ($this->data->status as $name => $value) {
  53. $variables[$name] = [
  54. 'name' => $name,
  55. 'value' => $value,
  56. 'is_numeric' => is_numeric($value),
  57. 'class' => $this->data->allocationMap[$name] ?? null,
  58. 'doc' => '',
  59. 'has_alert' => false,
  60. 'is_alert' => false,
  61. 'description' => $descriptions[$name] ?? '',
  62. 'description_doc' => [],
  63. ];
  64. // Fields containing % are calculated,
  65. // they can not be described in MySQL documentation
  66. if (mb_strpos($name, '%') === false) {
  67. $variables[$name]['doc'] = Util::linkToVarDocumentation(
  68. $name,
  69. $this->dbi->isMariaDB()
  70. );
  71. }
  72. if (isset($alerts[$name])) {
  73. $variables[$name]['has_alert'] = true;
  74. if ($value > $alerts[$name]) {
  75. $variables[$name]['is_alert'] = true;
  76. }
  77. }
  78. if (isset($this->data->links[$name])) {
  79. foreach ($this->data->links[$name] as $linkName => $linkUrl) {
  80. $variables[$name]['description_doc'][] = [
  81. 'name' => $linkName,
  82. 'url' => $linkUrl,
  83. ];
  84. }
  85. }
  86. }
  87. }
  88. return $this->template->render('server/status/variables/index', [
  89. 'is_data_loaded' => $this->data->dataLoaded,
  90. 'filter_text' => ! empty($params['filterText']) ? $params['filterText'] : '',
  91. 'is_only_alerts' => ! empty($params['filterAlert']),
  92. 'is_not_formatted' => ! empty($params['dontFormat']),
  93. 'categories' => $categories ?? [],
  94. 'links' => $links ?? [],
  95. 'variables' => $variables ?? [],
  96. ]);
  97. }
  98. /**
  99. * Flush status variables if requested
  100. *
  101. * @param string $flush Variable name
  102. * @return void
  103. */
  104. private function flush(string $flush): void
  105. {
  106. $flushCommands = [
  107. 'STATUS',
  108. 'TABLES',
  109. 'QUERY CACHE',
  110. ];
  111. if (in_array($flush, $flushCommands)) {
  112. $this->dbi->query('FLUSH ' . $flush . ';');
  113. }
  114. }
  115. /**
  116. * @return array
  117. */
  118. private function getAlerts(): array
  119. {
  120. // name => max value before alert
  121. return [
  122. // lower is better
  123. // variable => max value
  124. 'Aborted_clients' => 0,
  125. 'Aborted_connects' => 0,
  126. 'Binlog_cache_disk_use' => 0,
  127. 'Created_tmp_disk_tables' => 0,
  128. 'Handler_read_rnd' => 0,
  129. 'Handler_read_rnd_next' => 0,
  130. 'Innodb_buffer_pool_pages_dirty' => 0,
  131. 'Innodb_buffer_pool_reads' => 0,
  132. 'Innodb_buffer_pool_wait_free' => 0,
  133. 'Innodb_log_waits' => 0,
  134. 'Innodb_row_lock_time_avg' => 10, // ms
  135. 'Innodb_row_lock_time_max' => 50, // ms
  136. 'Innodb_row_lock_waits' => 0,
  137. 'Slow_queries' => 0,
  138. 'Delayed_errors' => 0,
  139. 'Select_full_join' => 0,
  140. 'Select_range_check' => 0,
  141. 'Sort_merge_passes' => 0,
  142. 'Opened_tables' => 0,
  143. 'Table_locks_waited' => 0,
  144. 'Qcache_lowmem_prunes' => 0,
  145. 'Qcache_free_blocks' =>
  146. isset($this->data->status['Qcache_total_blocks'])
  147. ? $this->data->status['Qcache_total_blocks'] / 5
  148. : 0,
  149. 'Slow_launch_threads' => 0,
  150. // depends on Key_read_requests
  151. // normally lower then 1:0.01
  152. 'Key_reads' => isset($this->data->status['Key_read_requests'])
  153. ? (0.01 * $this->data->status['Key_read_requests']) : 0,
  154. // depends on Key_write_requests
  155. // normally nearly 1:1
  156. 'Key_writes' => isset($this->data->status['Key_write_requests'])
  157. ? (0.9 * $this->data->status['Key_write_requests']) : 0,
  158. 'Key_buffer_fraction' => 0.5,
  159. // alert if more than 95% of thread cache is in use
  160. 'Threads_cached' => isset($this->data->variables['thread_cache_size'])
  161. ? 0.95 * $this->data->variables['thread_cache_size'] : 0,
  162. // higher is better
  163. // variable => min value
  164. //'Handler read key' => '> ',
  165. ];
  166. }
  167. /**
  168. * Returns a list of variable descriptions
  169. *
  170. * @return array
  171. */
  172. private function getDescriptions(): array
  173. {
  174. /**
  175. * Messages are built using the message name
  176. */
  177. return [
  178. 'Aborted_clients' => __(
  179. 'The number of connections that were aborted because the client died'
  180. . ' without closing the connection properly.'
  181. ),
  182. 'Aborted_connects' => __(
  183. 'The number of failed attempts to connect to the MySQL server.'
  184. ),
  185. 'Binlog_cache_disk_use' => __(
  186. 'The number of transactions that used the temporary binary log cache'
  187. . ' but that exceeded the value of binlog_cache_size and used a'
  188. . ' temporary file to store statements from the transaction.'
  189. ),
  190. 'Binlog_cache_use' => __(
  191. 'The number of transactions that used the temporary binary log cache.'
  192. ),
  193. 'Connections' => __(
  194. 'The number of connection attempts (successful or not)'
  195. . ' to the MySQL server.'
  196. ),
  197. 'Created_tmp_disk_tables' => __(
  198. 'The number of temporary tables on disk created automatically by'
  199. . ' the server while executing statements. If'
  200. . ' Created_tmp_disk_tables is big, you may want to increase the'
  201. . ' tmp_table_size value to cause temporary tables to be'
  202. . ' memory-based instead of disk-based.'
  203. ),
  204. 'Created_tmp_files' => __(
  205. 'How many temporary files mysqld has created.'
  206. ),
  207. 'Created_tmp_tables' => __(
  208. 'The number of in-memory temporary tables created automatically'
  209. . ' by the server while executing statements.'
  210. ),
  211. 'Delayed_errors' => __(
  212. 'The number of rows written with INSERT DELAYED for which some'
  213. . ' error occurred (probably duplicate key).'
  214. ),
  215. 'Delayed_insert_threads' => __(
  216. 'The number of INSERT DELAYED handler threads in use. Every'
  217. . ' different table on which one uses INSERT DELAYED gets'
  218. . ' its own thread.'
  219. ),
  220. 'Delayed_writes' => __(
  221. 'The number of INSERT DELAYED rows written.'
  222. ),
  223. 'Flush_commands' => __(
  224. 'The number of executed FLUSH statements.'
  225. ),
  226. 'Handler_commit' => __(
  227. 'The number of internal COMMIT statements.'
  228. ),
  229. 'Handler_delete' => __(
  230. 'The number of times a row was deleted from a table.'
  231. ),
  232. 'Handler_discover' => __(
  233. 'The MySQL server can ask the NDB Cluster storage engine if it'
  234. . ' knows about a table with a given name. This is called discovery.'
  235. . ' Handler_discover indicates the number of time tables have been'
  236. . ' discovered.'
  237. ),
  238. 'Handler_read_first' => __(
  239. 'The number of times the first entry was read from an index. If this'
  240. . ' is high, it suggests that the server is doing a lot of full'
  241. . ' index scans; for example, SELECT col1 FROM foo, assuming that'
  242. . ' col1 is indexed.'
  243. ),
  244. 'Handler_read_key' => __(
  245. 'The number of requests to read a row based on a key. If this is'
  246. . ' high, it is a good indication that your queries and tables'
  247. . ' are properly indexed.'
  248. ),
  249. 'Handler_read_next' => __(
  250. 'The number of requests to read the next row in key order. This is'
  251. . ' incremented if you are querying an index column with a range'
  252. . ' constraint or if you are doing an index scan.'
  253. ),
  254. 'Handler_read_prev' => __(
  255. 'The number of requests to read the previous row in key order.'
  256. . ' This read method is mainly used to optimize ORDER BY … DESC.'
  257. ),
  258. 'Handler_read_rnd' => __(
  259. 'The number of requests to read a row based on a fixed position.'
  260. . ' This is high if you are doing a lot of queries that require'
  261. . ' sorting of the result. You probably have a lot of queries that'
  262. . ' require MySQL to scan whole tables or you have joins that'
  263. . ' don\'t use keys properly.'
  264. ),
  265. 'Handler_read_rnd_next' => __(
  266. 'The number of requests to read the next row in the data file.'
  267. . ' This is high if you are doing a lot of table scans. Generally'
  268. . ' this suggests that your tables are not properly indexed or that'
  269. . ' your queries are not written to take advantage of the indexes'
  270. . ' you have.'
  271. ),
  272. 'Handler_rollback' => __(
  273. 'The number of internal ROLLBACK statements.'
  274. ),
  275. 'Handler_update' => __(
  276. 'The number of requests to update a row in a table.'
  277. ),
  278. 'Handler_write' => __(
  279. 'The number of requests to insert a row in a table.'
  280. ),
  281. 'Innodb_buffer_pool_pages_data' => __(
  282. 'The number of pages containing data (dirty or clean).'
  283. ),
  284. 'Innodb_buffer_pool_pages_dirty' => __(
  285. 'The number of pages currently dirty.'
  286. ),
  287. 'Innodb_buffer_pool_pages_flushed' => __(
  288. 'The number of buffer pool pages that have been requested'
  289. . ' to be flushed.'
  290. ),
  291. 'Innodb_buffer_pool_pages_free' => __(
  292. 'The number of free pages.'
  293. ),
  294. 'Innodb_buffer_pool_pages_latched' => __(
  295. 'The number of latched pages in InnoDB buffer pool. These are pages'
  296. . ' currently being read or written or that can\'t be flushed or'
  297. . ' removed for some other reason.'
  298. ),
  299. 'Innodb_buffer_pool_pages_misc' => __(
  300. 'The number of pages busy because they have been allocated for'
  301. . ' administrative overhead such as row locks or the adaptive'
  302. . ' hash index. This value can also be calculated as'
  303. . ' Innodb_buffer_pool_pages_total - Innodb_buffer_pool_pages_free'
  304. . ' - Innodb_buffer_pool_pages_data.'
  305. ),
  306. 'Innodb_buffer_pool_pages_total' => __(
  307. 'Total size of buffer pool, in pages.'
  308. ),
  309. 'Innodb_buffer_pool_read_ahead_rnd' => __(
  310. 'The number of "random" read-aheads InnoDB initiated. This happens'
  311. . ' when a query is to scan a large portion of a table but in'
  312. . ' random order.'
  313. ),
  314. 'Innodb_buffer_pool_read_ahead_seq' => __(
  315. 'The number of sequential read-aheads InnoDB initiated. This'
  316. . ' happens when InnoDB does a sequential full table scan.'
  317. ),
  318. 'Innodb_buffer_pool_read_requests' => __(
  319. 'The number of logical read requests InnoDB has done.'
  320. ),
  321. 'Innodb_buffer_pool_reads' => __(
  322. 'The number of logical reads that InnoDB could not satisfy'
  323. . ' from buffer pool and had to do a single-page read.'
  324. ),
  325. 'Innodb_buffer_pool_wait_free' => __(
  326. 'Normally, writes to the InnoDB buffer pool happen in the'
  327. . ' background. However, if it\'s necessary to read or create a page'
  328. . ' and no clean pages are available, it\'s necessary to wait for'
  329. . ' pages to be flushed first. This counter counts instances of'
  330. . ' these waits. If the buffer pool size was set properly, this'
  331. . ' value should be small.'
  332. ),
  333. 'Innodb_buffer_pool_write_requests' => __(
  334. 'The number writes done to the InnoDB buffer pool.'
  335. ),
  336. 'Innodb_data_fsyncs' => __(
  337. 'The number of fsync() operations so far.'
  338. ),
  339. 'Innodb_data_pending_fsyncs' => __(
  340. 'The current number of pending fsync() operations.'
  341. ),
  342. 'Innodb_data_pending_reads' => __(
  343. 'The current number of pending reads.'
  344. ),
  345. 'Innodb_data_pending_writes' => __(
  346. 'The current number of pending writes.'
  347. ),
  348. 'Innodb_data_read' => __(
  349. 'The amount of data read so far, in bytes.'
  350. ),
  351. 'Innodb_data_reads' => __(
  352. 'The total number of data reads.'
  353. ),
  354. 'Innodb_data_writes' => __(
  355. 'The total number of data writes.'
  356. ),
  357. 'Innodb_data_written' => __(
  358. 'The amount of data written so far, in bytes.'
  359. ),
  360. 'Innodb_dblwr_pages_written' => __(
  361. 'The number of pages that have been written for'
  362. . ' doublewrite operations.'
  363. ),
  364. 'Innodb_dblwr_writes' => __(
  365. 'The number of doublewrite operations that have been performed.'
  366. ),
  367. 'Innodb_log_waits' => __(
  368. 'The number of waits we had because log buffer was too small and'
  369. . ' we had to wait for it to be flushed before continuing.'
  370. ),
  371. 'Innodb_log_write_requests' => __(
  372. 'The number of log write requests.'
  373. ),
  374. 'Innodb_log_writes' => __(
  375. 'The number of physical writes to the log file.'
  376. ),
  377. 'Innodb_os_log_fsyncs' => __(
  378. 'The number of fsync() writes done to the log file.'
  379. ),
  380. 'Innodb_os_log_pending_fsyncs' => __(
  381. 'The number of pending log file fsyncs.'
  382. ),
  383. 'Innodb_os_log_pending_writes' => __(
  384. 'Pending log file writes.'
  385. ),
  386. 'Innodb_os_log_written' => __(
  387. 'The number of bytes written to the log file.'
  388. ),
  389. 'Innodb_pages_created' => __(
  390. 'The number of pages created.'
  391. ),
  392. 'Innodb_page_size' => __(
  393. 'The compiled-in InnoDB page size (default 16KB). Many values are'
  394. . ' counted in pages; the page size allows them to be easily'
  395. . ' converted to bytes.'
  396. ),
  397. 'Innodb_pages_read' => __(
  398. 'The number of pages read.'
  399. ),
  400. 'Innodb_pages_written' => __(
  401. 'The number of pages written.'
  402. ),
  403. 'Innodb_row_lock_current_waits' => __(
  404. 'The number of row locks currently being waited for.'
  405. ),
  406. 'Innodb_row_lock_time_avg' => __(
  407. 'The average time to acquire a row lock, in milliseconds.'
  408. ),
  409. 'Innodb_row_lock_time' => __(
  410. 'The total time spent in acquiring row locks, in milliseconds.'
  411. ),
  412. 'Innodb_row_lock_time_max' => __(
  413. 'The maximum time to acquire a row lock, in milliseconds.'
  414. ),
  415. 'Innodb_row_lock_waits' => __(
  416. 'The number of times a row lock had to be waited for.'
  417. ),
  418. 'Innodb_rows_deleted' => __(
  419. 'The number of rows deleted from InnoDB tables.'
  420. ),
  421. 'Innodb_rows_inserted' => __(
  422. 'The number of rows inserted in InnoDB tables.'
  423. ),
  424. 'Innodb_rows_read' => __(
  425. 'The number of rows read from InnoDB tables.'
  426. ),
  427. 'Innodb_rows_updated' => __(
  428. 'The number of rows updated in InnoDB tables.'
  429. ),
  430. 'Key_blocks_not_flushed' => __(
  431. 'The number of key blocks in the key cache that have changed but'
  432. . ' haven\'t yet been flushed to disk. It used to be known as'
  433. . ' Not_flushed_key_blocks.'
  434. ),
  435. 'Key_blocks_unused' => __(
  436. 'The number of unused blocks in the key cache. You can use this'
  437. . ' value to determine how much of the key cache is in use.'
  438. ),
  439. 'Key_blocks_used' => __(
  440. 'The number of used blocks in the key cache. This value is a'
  441. . ' high-water mark that indicates the maximum number of blocks'
  442. . ' that have ever been in use at one time.'
  443. ),
  444. 'Key_buffer_fraction_%' => __(
  445. 'Percentage of used key cache (calculated value)'
  446. ),
  447. 'Key_read_requests' => __(
  448. 'The number of requests to read a key block from the cache.'
  449. ),
  450. 'Key_reads' => __(
  451. 'The number of physical reads of a key block from disk. If Key_reads'
  452. . ' is big, then your key_buffer_size value is probably too small.'
  453. . ' The cache miss rate can be calculated as'
  454. . ' Key_reads/Key_read_requests.'
  455. ),
  456. 'Key_read_ratio_%' => __(
  457. 'Key cache miss calculated as rate of physical reads compared'
  458. . ' to read requests (calculated value)'
  459. ),
  460. 'Key_write_requests' => __(
  461. 'The number of requests to write a key block to the cache.'
  462. ),
  463. 'Key_writes' => __(
  464. 'The number of physical writes of a key block to disk.'
  465. ),
  466. 'Key_write_ratio_%' => __(
  467. 'Percentage of physical writes compared'
  468. . ' to write requests (calculated value)'
  469. ),
  470. 'Last_query_cost' => __(
  471. 'The total cost of the last compiled query as computed by the query'
  472. . ' optimizer. Useful for comparing the cost of different query'
  473. . ' plans for the same query. The default value of 0 means that'
  474. . ' no query has been compiled yet.'
  475. ),
  476. 'Max_used_connections' => __(
  477. 'The maximum number of connections that have been in use'
  478. . ' simultaneously since the server started.'
  479. ),
  480. 'Not_flushed_delayed_rows' => __(
  481. 'The number of rows waiting to be written in INSERT DELAYED queues.'
  482. ),
  483. 'Opened_tables' => __(
  484. 'The number of tables that have been opened. If opened tables is'
  485. . ' big, your table cache value is probably too small.'
  486. ),
  487. 'Open_files' => __(
  488. 'The number of files that are open.'
  489. ),
  490. 'Open_streams' => __(
  491. 'The number of streams that are open (used mainly for logging).'
  492. ),
  493. 'Open_tables' => __(
  494. 'The number of tables that are open.'
  495. ),
  496. 'Qcache_free_blocks' => __(
  497. 'The number of free memory blocks in query cache. High numbers can'
  498. . ' indicate fragmentation issues, which may be solved by issuing'
  499. . ' a FLUSH QUERY CACHE statement.'
  500. ),
  501. 'Qcache_free_memory' => __(
  502. 'The amount of free memory for query cache.'
  503. ),
  504. 'Qcache_hits' => __(
  505. 'The number of cache hits.'
  506. ),
  507. 'Qcache_inserts' => __(
  508. 'The number of queries added to the cache.'
  509. ),
  510. 'Qcache_lowmem_prunes' => __(
  511. 'The number of queries that have been removed from the cache to'
  512. . ' free up memory for caching new queries. This information can'
  513. . ' help you tune the query cache size. The query cache uses a'
  514. . ' least recently used (LRU) strategy to decide which queries'
  515. . ' to remove from the cache.'
  516. ),
  517. 'Qcache_not_cached' => __(
  518. 'The number of non-cached queries (not cachable, or not cached'
  519. . ' due to the query_cache_type setting).'
  520. ),
  521. 'Qcache_queries_in_cache' => __(
  522. 'The number of queries registered in the cache.'
  523. ),
  524. 'Qcache_total_blocks' => __(
  525. 'The total number of blocks in the query cache.'
  526. ),
  527. 'Rpl_status' => __(
  528. 'The status of failsafe replication (not yet implemented).'
  529. ),
  530. 'Select_full_join' => __(
  531. 'The number of joins that do not use indexes. If this value is'
  532. . ' not 0, you should carefully check the indexes of your tables.'
  533. ),
  534. 'Select_full_range_join' => __(
  535. 'The number of joins that used a range search on a reference table.'
  536. ),
  537. 'Select_range_check' => __(
  538. 'The number of joins without keys that check for key usage after'
  539. . ' each row. (If this is not 0, you should carefully check the'
  540. . ' indexes of your tables.)'
  541. ),
  542. 'Select_range' => __(
  543. 'The number of joins that used ranges on the first table. (It\'s'
  544. . ' normally not critical even if this is big.)'
  545. ),
  546. 'Select_scan' => __(
  547. 'The number of joins that did a full scan of the first table.'
  548. ),
  549. 'Slave_open_temp_tables' => __(
  550. 'The number of temporary tables currently'
  551. . ' open by the slave SQL thread.'
  552. ),
  553. 'Slave_retried_transactions' => __(
  554. 'Total (since startup) number of times the replication slave SQL'
  555. . ' thread has retried transactions.'
  556. ),
  557. 'Slave_running' => __(
  558. 'This is ON if this server is a slave that is connected to a master.'
  559. ),
  560. 'Slow_launch_threads' => __(
  561. 'The number of threads that have taken more than slow_launch_time'
  562. . ' seconds to create.'
  563. ),
  564. 'Slow_queries' => __(
  565. 'The number of queries that have taken more than long_query_time'
  566. . ' seconds.'
  567. ),
  568. 'Sort_merge_passes' => __(
  569. 'The number of merge passes the sort algorithm has had to do.'
  570. . ' If this value is large, you should consider increasing the'
  571. . ' value of the sort_buffer_size system variable.'
  572. ),
  573. 'Sort_range' => __(
  574. 'The number of sorts that were done with ranges.'
  575. ),
  576. 'Sort_rows' => __(
  577. 'The number of sorted rows.'
  578. ),
  579. 'Sort_scan' => __(
  580. 'The number of sorts that were done by scanning the table.'
  581. ),
  582. 'Table_locks_immediate' => __(
  583. 'The number of times that a table lock was acquired immediately.'
  584. ),
  585. 'Table_locks_waited' => __(
  586. 'The number of times that a table lock could not be acquired'
  587. . ' immediately and a wait was needed. If this is high, and you have'
  588. . ' performance problems, you should first optimize your queries,'
  589. . ' and then either split your table or tables or use replication.'
  590. ),
  591. 'Threads_cached' => __(
  592. 'The number of threads in the thread cache. The cache hit rate can'
  593. . ' be calculated as Threads_created/Connections. If this value is'
  594. . ' red you should raise your thread_cache_size.'
  595. ),
  596. 'Threads_connected' => __(
  597. 'The number of currently open connections.'
  598. ),
  599. 'Threads_created' => __(
  600. 'The number of threads created to handle connections. If'
  601. . ' Threads_created is big, you may want to increase the'
  602. . ' thread_cache_size value. (Normally this doesn\'t give a notable'
  603. . ' performance improvement if you have a good thread'
  604. . ' implementation.)'
  605. ),
  606. 'Threads_cache_hitrate_%' => __(
  607. 'Thread cache hit rate (calculated value)'
  608. ),
  609. 'Threads_running' => __(
  610. 'The number of threads that are not sleeping.'
  611. ),
  612. ];
  613. }
  614. }