[MDEV-3730] LP:992983 - Aborted_clients metric is growing up even though formal connection close Created: 2012-05-02 Updated: 2014-06-20 Resolved: 2012-10-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Matt (Inactive) | Assignee: | Vladislav Vaintroub |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
I tested MariaDB 5.5.23 with sysbench. But, After I applied MariaDB to production database, So, I tested same code with MySQL 5.5.23 community version. But it's okay. And, MariaDB(with ThreadPool)'s memory usage is really stable under 2GB(Buffer pool is not including) Thanks. after test status----------------------------------------------------------------------------------
----------------
---------------- mysql> show global status like 'Aborted_clients';
----------------
---------------- test code -------------------------------------------------------------------------------------------- for(int idx=0; idx<100; idx++) { conns[idx] = getConnection(); }Thread.sleep(1000*10); for(int idx=0; idx<100; idx++) { conns[idx].close(); }} protected static Connection getConnection() throws Exception { String driver = "com.mysql.jdbc.Driver"; String url = "jdbc:mysql://127.0.0.1:3306/sysbench"; String uid = "sysbench"; String pwd = "sysbench"; Class.forName(driver).newInstance(); Connection conn = DriverManager.getConnection(url, uid, pwd); return conn; }} |
| Comments |
| Comment by Elena Stepanova [ 2012-05-02 ] |
|
Re: Aborted_clients metric is growing up even though formal connection close Could you please provide the cnf file which you are using in production (where you observe the excessive memory consumption? Thank you. |
| Comment by Elena Stepanova [ 2012-05-02 ] |
|
Re: Aborted_clients metric is growing up even though formal connection close We are yet to see whether the reported memory consumption is related to pseudo-aborted clients, I didn't see the memory issue on my machine yet. |
| Comment by Matt (Inactive) [ 2012-05-03 ] |
|
Re: Aborted_clients metric is growing up even though formal connection close Actually, the memory allocated by innodb engine is just 26GB. Our production server only have 2~3 tables and 1000 connections. It seems like that 400 is small for our production service. What do you think about ? |
| Comment by Matt (Inactive) [ 2012-05-03 ] |
|
Hi I attached MariaDB's configuration file and MySQL Server status related to memory. Actually, the memory allocated by innodb engine is just 26GB. Our production server only have 2~3 tables and 1000 connections. It seems like that 400 is small for our production service. What do you think about ? |
| Comment by Vladislav Vaintroub [ 2012-05-03 ] |
|
Re: Aborted_clients metric is growing up even though formal connection close On the memory usage side, it seems that all connections use 1GB memory overall, which seems ok for 1K connections (some buffers are per-connection, so it does not seem too high overall). 400 for table cache might be small, dependent on how many connections are active at the same time. Sysbench gives best results with table cache == number_of_client*number_of_tables , so you might increase the value to ~3000 or about it. Regarding OS memory usage : to prevent OS buffercache to compete with database buffers, it could be good to use innodb_flush_method=O_DIRECT, which prevents caching log files. It could be even better to use innodb_flush_method=ALL_O_DIRECT which prevents filesystem caching for the data files. With bufferpool that big avoiding OS caching can be relevant. |
| Comment by Matt (Inactive) [ 2012-05-03 ] |
|
Re: Aborted_clients metric is growing up even though formal connection close I tested table_open_cache parameter with sysbench (one table with 1000 partitions, 4000 connections). Just a few hours, MariaDB took 6 GB except Innodb buffer pool on table_open_cache=4000 benchmark. So, MariaDB use only 15GB memory as buffer pool even though the machine has 32GB physical memory. I also reported this message to MySQL Community bug reporting site. So, I'm wondering is there any to free the memory for table cache without blocking other sessions query. I think a lot of people use mysql server with over 4000 connections and over 1000 tables. Thanks. |
| Comment by Matt (Inactive) [ 2012-05-03 ] |
|
Hi Vladislav Vaintroub. I tested table_open_cache parameter with sysbench (one table with 1000 partitions, 4000 connections). Just a few hours, MariaDB took 6 GB except Innodb buffer pool on table_open_cache=4000 benchmark. So, MariaDB use only 15GB memory as buffer pool even though the machine has 32GB physical memory. I also reported this message to MySQL Community bug reporting site. So, I'm wondering is there any to free the memory for table cache without blocking other sessions query. I think a lot of people use mysql server with over 4000 connections and over 1000 tables. Thanks. table_cache_benchmarking.zip |
| Comment by Vladislav Vaintroub [ 2012-05-03 ] |
|
Re: Aborted_clients metric is growing up even though formal connection close There seems also to be misunderstanding about size of innodb buffer pool seen on the graphs. As you have seen the rss(resident set size) is not automatically >= innodb buffer pool size just when you start the database, because it is virtual memory that gets allocated and it is not the same as physical memory. so when innodb uses or touches pages first, virtual memory becomes physical memory used and resident size will grow until it reaches a plateau. Pre-populating of Innodb buffer pool was done in a Twitter's MySQL branch : https://github.com/twitter/mysql/wiki/InnoDB-Startup-Options-and-System-Variables (innodb_buffer_pool_populate ), we might look to port it if there is enough interest in this patch |
| Comment by Vladislav Vaintroub [ 2012-05-03 ] |
|
Re: Aborted_clients metric is growing up even though formal connection close |
| Comment by Matt (Inactive) [ 2012-05-03 ] |
|
Re: Aborted_clients metric is growing up even though formal connection close I'm wondering how to decrease mysql server's memory usage for table cache. Thanks. |
| Comment by Vladislav Vaintroub [ 2012-05-03 ] |
|
Re: Aborted_clients metric is growing up even though formal connection close PS. I'm not a support person, the above is mostly based on my intuition and on the fact that ALL_O_DIRECT prevents cache not only for the redo log files, but also for the innodb data files (hence "ALL" in ALL_O_DIRECT). PPS. Currently, we do not measure the exact amount of memory used by different caches, so there are no hard facts. That table_cache structure would be responsible for consuming lots of memory is a bit counter-intuitive, I do not see what in it would take gigs of memory, it probably requires some more investigation in the future. |
| Comment by Rasmus Johansson (Inactive) [ 2012-05-03 ] |
|
Launchpad bug id: 992983 |