如何知道SqlSessionTemplate是否已正常关闭数据库连接

时间:2018-03-20 03:28:07

标签: mysql spring database-connection

我在Spring和SqlSessionTemplate中使用MySQL。 我知道SqlSessionTemplate在使用后会自动关闭连接,所以我们不需要对此做任何事情。

但是当我检查我的MySQL状态时,我发现Aborted_clients太高了。总连接数为26030,Aborted_clients为25861.所以我想我应该查看SqlSessionTemplate是否能够很好地关闭连接。

我该如何处理?我真诚地问那些比我更有能力的成员。

-------Here is the status of Mysql.(show status)---------------------

| Aborted_clients                               | 25861                                            |
| Aborted_connects                              | 17                                               |
| Binlog_cache_disk_use                         | 0                                                |
| Binlog_cache_use                              | 0                                                |
| Binlog_stmt_cache_disk_use                    | 0                                                |
| Binlog_stmt_cache_use                         | 0                                                |
| Bytes_received                                | 419                                              |
| Bytes_sent                                    | 839                                              |
| Compression                                   | OFF                                              |
| Connections                                   | 26030                                            |
| Innodb_buffer_pool_dump_status                | Dumping of buffer pool not started               |
| Innodb_buffer_pool_load_status                | Buffer pool(s) load completed at 180301  6:06:08 |
| Innodb_buffer_pool_resize_status              |                                                  |
| Innodb_buffer_pool_pages_data                 | 7251                                             |
| Innodb_buffer_pool_bytes_data                 | 118800384                                        |
| Innodb_buffer_pool_pages_dirty                | 0                                                |
| Innodb_buffer_pool_bytes_dirty                | 0                                                |
| Innodb_buffer_pool_pages_flushed              | 205767                                           |
| Innodb_buffer_pool_pages_free                 | 719                                              |
| Innodb_buffer_pool_pages_misc                 | 221                                              |
| Innodb_buffer_pool_pages_total                | 8191                                             |
| Innodb_buffer_pool_read_ahead_rnd             | 0                                                |
| Innodb_buffer_pool_read_ahead                 | 59873                                            |
| Innodb_buffer_pool_read_ahead_evicted         | 8173                                             |
| Innodb_buffer_pool_read_requests              | 1440265221                                       |
| Innodb_buffer_pool_reads                      | 774163                                           |
| Innodb_buffer_pool_wait_free                  | 320                                              |
| Innodb_buffer_pool_write_requests             | 2132490                                          |
| Innodb_data_fsyncs                            | 186887                                           |
| Innodb_data_pending_fsyncs                    | 0                                                |
| Innodb_data_pending_reads                     | 0                                                |
| Innodb_data_pending_writes                    | 0                                                |
| Innodb_data_read                              | 13672354304                                      |
| Innodb_data_reads                             | 834643                                           |
| Innodb_data_writes                            | 351504                                           |
| Innodb_data_written                           | 5460674560                                       |
| Innodb_dblwr_pages_written                    | 120165                                           |
| Innodb_dblwr_writes                           | 31004                                            |
| Innodb_log_waits                              | 0                                                |
| Innodb_log_write_requests                     | 116504                                           |
| Innodb_log_writes                             | 75883                                            |
| Innodb_os_log_fsyncs                          | 114047                                           |
| Innodb_os_log_pending_fsyncs                  | 0                                                |
| Innodb_os_log_pending_writes                  | 0                                                |
| Innodb_os_log_written                         | 99709440                                         |
| Innodb_page_size                              | 16384                                            |
| Innodb_pages_created                          | 1881                                             |
| Innodb_pages_read                             | 834489                                           |
| Innodb_pages_written                          | 205850                                           |
| Innodb_row_lock_current_waits                 | 0                                                |
| Innodb_row_lock_time                          | 0                                                |
| Innodb_row_lock_time_avg                      | 0                                                |
| Innodb_row_lock_time_max                      | 0                                                |
| Innodb_row_lock_waits                         | 0                                                |
| Innodb_rows_deleted                           | 176                                              |
| Innodb_rows_inserted                          | 316819                                           |
| Innodb_rows_read                              | 5737344217                                       |
| Innodb_rows_updated                           | 170644                                           |
| Innodb_num_open_files                         | 156                                              |
| Innodb_truncated_status_writes                | 0                                                |
| Innodb_available_undo_logs                    | 128                                              |
| Key_blocks_not_flushed                        | 0                                                |
| Key_blocks_unused                             | 13396                                            |
| Key_blocks_used                               | 9                                                |
| Key_read_requests                             | 328                                              |
| Key_reads                                     | 53                                               |
| Key_write_requests                            | 0                                                |
| Key_writes                                    | 0                                                |
| Last_query_cost                               | 0.000000                                         |
| Last_query_partial_plans                      | 0                                                |
| Locked_connects                               | 0                                                |
| Max_execution_time_exceeded                   | 0                                                |
| Max_execution_time_set                        | 0                                                |
| Max_execution_time_set_failed                 | 0                                                |
| Max_used_connections                          | 11                                               |
| Max_used_connections_time                     | 2018-03-09 15:40:45                              |
| Not_flushed_delayed_rows                      | 0                                                |
| Ongoing_anonymous_transaction_count           | 0                                                |
| Open_files                                    | 0                                                |
| Open_streams                                  | 0                                                |
| Open_table_definitions                        | 144                                              |
| Open_tables                                   | 448                                              |
| Opened_files                                  | 1427                                             |
| Opened_table_definitions                      | 0                                                |
| Opened_tables                                 | 0                                                |
| Performance_schema_accounts_lost              | 0                                                |
| Performance_schema_cond_classes_lost          | 0                                                |
| Performance_schema_cond_instances_lost        | 0                                                |
| Performance_schema_digest_lost                | 0                                                |
| Performance_schema_file_classes_lost          | 0                                                |
| Performance_schema_file_handles_lost          | 0                                                |
| Performance_schema_file_instances_lost        | 4                                                |
| Qcache_free_blocks                            | 1                                                |
| Qcache_free_memory                            | 16760152                                         |
| Qcache_hits                                   | 0                                                |
| Qcache_inserts                                | 0                                                |
| Qcache_lowmem_prunes                          | 0                                                |
| Qcache_not_cached                             | 5899390                                          |
| Qcache_queries_in_cache                       | 0                                                |
| Qcache_total_blocks                           | 1                                                |
| Queries                                       | 11838831                                         |
| Questions                                     | 5                                                |
| Table_locks_immediate                         | 317                                              |
| Threads_cached                                | 5                                                |
| Threads_connected                             | 4                                                |
| Threads_created                               | 13                                               |
| Threads_running                               | 1                                                |
| Uptime                                        | 1663540                                          |
| Uptime_since_flush_status                     | 1663540  

0 个答案:

没有答案