[MDEV-2310] LP:955776 - 5.2 vs 5.3 CPU usage. Is it normal? Created: 2012-03-15 Updated: 2015-02-02 Resolved: 2012-10-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Anton Khalikov (Inactive) | Assignee: | Axel Schwenke |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
Hello there Yesterday we tried to migrate from MariaDB 5.2 to 5.3 on one of our servers. We have noticed very huge growth of CPU usage by mysqld processes. The following are 2 pictures showing what happened. Upgrade has been done at about 22:00, used default optimizer_switch settings. http://clip2net.com/clip/m115425/1331798690-dbprousercpu1-22kb.png After changing optimizer_switch to index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off (similar to 5.2 values) in some cases CPU usage decreases but not always. |
| Comments |
| Comment by Anton Khalikov (Inactive) [ 2012-03-15 ] |
|
Re: 5.2 vs 5.3 CPU usage. Is it normal? |
| Comment by Anton Khalikov (Inactive) [ 2012-03-15 ] |
|
dbprousercpu1.png |
| Comment by Elena Stepanova [ 2012-03-15 ] |
|
Re: 5.2 vs 5.3 CPU usage. Is it normal? Did you observe MariaDB performance drop or increase along with the CPU usage growth? If it is not the case, could you please provide more information on what is happening on your MariaDB server: how high the load is, in terms of connections, requests etc.; what kind of load it is – is it read-only mostly, or is there a lot of modification; how much data your database contains; which engines you use; hardware configuration and MariaDB cnf file; and so on. Even better, if you could identify exact queries or sequences of events that cause the increased CPU load. Please also check the slow query log to see if it contains more queries with 5.3 than it used to with 5.2. Any specifics on the problem you are experiencing would be greatly appreciated. Thank you. |
| Comment by Anton Khalikov (Inactive) [ 2012-03-15 ] |
|
Re: 5.2 vs 5.3 CPU usage. Is it normal? The server we tried this upgrade at, is not used in a 'normal' way. Instead of single mysqld, we run several hundred of mysqld processes on it to provide 'separate mysql server' feature to our customers. So I can't say if performance improved or not. What we noticed is that the total Load Average on this server increased very high and the whole service went down few times. Disk IO was not the case but we saw 100% CPU usage frequently while it never happened before upgrade. Then I tried different optimizer_switch combinations until we decided to downgrade back to 5.2. For the most of these mysqld instances we use the same configuration with innodb, pbxt, blackhole, archive and federated engines disabled (so only MyISAM is used in fact) and key-buffer-size/aria_pagecache_buffer_size set to 8m. Taking some random mysqld instances into account I can say that slow-query-log was normally empty before upgrade but started to grow up after. But I am not sure if this is because of MariaDB itself or because of high Load Average and system slow down it caused. At the moment we run on 5.2 with path for bug 909635 applied. The attached picture shows what happened on the server. |
| Comment by Anton Khalikov (Inactive) [ 2012-03-15 ] |
|
Hi Elena The server we tried this upgrade at, is not used in a 'normal' way. Instead of single mysqld, we run several hundred of mysqld processes on it to provide 'separate mysql server' feature to our customers. So I can't say if performance improved or not. What we noticed is that the total Load Average on this server increased very high and the whole service went down few times. Disk IO was not the case but we saw 100% CPU usage frequently while it never happened before upgrade. Then I tried different optimizer_switch combinations until we decided to downgrade back to 5.2. For the most of these mysqld instances we use the same configuration with innodb, pbxt, blackhole, archive and federated engines disabled (so only MyISAM is used in fact) and key-buffer-size/aria_pagecache_buffer_size set to 8m. Taking some random mysqld instances into account I can say that slow-query-log was normally empty before upgrade but started to grow up after. But I am not sure if this is because of MariaDB itself or because of high Load Average and system slow down it caused. At the moment we run on 5.2 with path for bug 909635 applied. The attached picture shows what happened on the server. la.png |
| Comment by Anton Khalikov (Inactive) [ 2012-03-15 ] |
|
Re: 5.2 vs 5.3 CPU usage. Is it normal? |
| Comment by Anton Khalikov (Inactive) [ 2012-03-15 ] |
|
And just to compare, the same server's LA picture 2 days ago. Nothing changed, same amount of customer's processes, about the same load etc. |
| Comment by Elena Stepanova [ 2012-03-16 ] |
|
Re: 5.2 vs 5.3 CPU usage. Is it normal? Did you observe unusually high memory usage at the same time when CPU spiked? |
| Comment by Anton Khalikov (Inactive) [ 2012-03-16 ] |
|
Re: 5.2 vs 5.3 CPU usage. Is it normal? ATOP - db5 2012/03/15 12:15:05 600 seconds elapsed And this is the total activity of mysqld processes at the same moment: NPROCS SYSCPU USRCPU VSIZE RSIZE RDDSK WRDSK RNET SNET MEM CMD 1/9 Now, the following is the same stats for today, same time, MariaDB 5.2 ATOP - db5 2012/03/16 12:20:41 10 seconds elapsed NPROCS SYSCPU USRCPU VSIZE RSIZE RDDSK WRDSK RNET SNET MEM CMD 1/10 So, memory usage is about the same. |
| Comment by Anton Khalikov (Inactive) [ 2012-03-16 ] |
|
Re: 5.2 vs 5.3 CPU usage. Is it normal? |
| Comment by Elena Stepanova [ 2012-03-16 ] |
|
Re: 5.2 vs 5.3 CPU usage. Is it normal? We have at least one confirmed problem which makes a class of queries cause OOM and burn quite a few CPU cycles on the way: https://bugs.launchpad.net/maria/+bug/954262 . As you have several hundred mysqld processes running at once, chances are that at any moment one of them attempts to execute the "evil" query. If you think this is something you might be experiencing, I suggest to wait till the fix is released, the bug is being actively worked upon now. Meanwhile, I will re-address your request to Axel who runs performance benchmarks, in case he has any ideas or has seen similar patterns in his tests. |
| Comment by Axel Schwenke [ 2012-03-20 ] |
|
Re: 5.2 vs 5.3 CPU usage. Is it normal? my educated guess is that MariaDB-5.3 introduces some optimizer feature that adds a penalty for at least some queries that you (or your customers) are running. By looking at the optimizer_switch, it seems the only change between your "good" settings and the MariaDB 5.3 defaults is engine_condition_pushdown. Default is "on", you set it to "off". While we know of some workload where ICP leads to performance loss, it has always been in the range of few percent, never as much as your cpu graph suggests. The only other optimizer features that you have turned on are for the index merge algorithms. Those are quite mature and as far as I know there was no changes to those between MariaDB 5.2 and 5.3. Since you mention the slow log - do you happen to have examples of slow queries? What we would need are example queries and table structure/data where turning ICP on shows a significant performance loss. You also mention that the new optimizer flags don't always work. So you might have queries in the slow log with 5.3 that were never slow with 5.2? Such examples would be very helpful too. |
| Comment by Anton Khalikov (Inactive) [ 2012-03-20 ] |
|
Re: 5.2 vs 5.3 CPU usage. Is it normal? The optimizer_switch options shown above are the options we turned on/off after we found the problem with CPU usage. These are not the options we used to run with from the beginning. At first we used default set of options (no tuning via my.cnf at all). Then I tried to find a way to reduce CPU usage and the shown options are what I came to. But after reading this bug tracker I found that some switches may affect not only performance, but may produce wrong result sets as well. That's why we decided to downgrade back to 5.2. I will try to find some examples of difference in slow queries and if succeed I will post examples here. |
| Comment by Axel Schwenke [ 2012-03-21 ] |
|
Re: 5.2 vs 5.3 CPU usage. Is it normal? > The optimizer_switch options shown above are the options we turned on/off Yes, I'm aware of that. And as I said, those options differ from the default in just one point: engine_condition_pushdown > I will try to find some examples of difference in slow queries and if succeed Excellent. Please don't forget to also show us the structure of the underlying tables (SHOW CREATE TABLE ...). If you have any data that you want to keep private, then use our write-only FTP server: http://kb.askmonty.org/en/ftp |
| Comment by Rasmus Johansson (Inactive) [ 2012-03-22 ] |
|
Launchpad bug id: 955776 |
| Comment by Anton Khalikov (Inactive) [ 2012-03-22 ] |
|
Re: 5.2 vs 5.3 CPU usage. Is it normal? After examining our slow query logs I found that normally only about 10-15 customers have something in a daily slow log. During the day we tried 5.3, amount of customers with something in a slow log grew from 10-15 to over 100. I subtracted from the list those who has slow logs daily and finally I've got 103 log files for those whom slow logs were created with 5.3 and never with 5.2. Then, I've got top 50 most frequent queries using mysqldumpslow and this list is uploaded to your ftp server as ticket-955776-top50-slows.log. Please take a look at it and let me know which queries are interesting for you and for which of them you want to see CREATE TABLE statements and sample data. |