[MDEV-7899] 10.1 is 3% slower than 10.0 in OLTP RO Created: 2015-04-02  Updated: 2015-04-09  Resolved: 2015-04-07

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.1
Fix Version/s: 10.1.4

Type: Bug Priority: Major
Reporter: Sergey Vojtovich Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: analyze-stmt

Attachments: File psergey-mdev7899-remove-timings.diff    
Epic Link: Performance: micro optimizations

 Description   

Even though 10.1 has quite a few generic optimizations it still shows slightly worse performance compared to 10.0. This trend can be reproduced quite reliably on different platforms (10.0 -> 10.1):

1 thread avg TPS: 805.91 -> 780.83 (3.11%)
1 thread max TPS: 810.60 -> 788.50 (2.73%)
64 threads avg TPS: 23026.92 -> 22346.58 (2.95%)
64 threads max TPS: 23245.01 -> 22666.61 (2.49%)

One of the biggest contributors to this slowdown (~2%) seem to be Exec_time_tracker. I get the following numbers if it is commented out (10.0 -> 10.1):

1 thread avg TPS: 805.91 -> 796.44 (1.18%)
1 thread max TPS: 810.60 -> 806.29 (0.53%)



 Comments   
Comment by Sergei Petrunia [ 2015-04-03 ]

Following the IRC discussion, I've made a patch that make ANALYZE timing hooks not to be invoked for non-ANALYZE statements.

However, it made no difference in execution on my system. svoj, could you please check if the patch fixes the problem?

Comment by Sergei Petrunia [ 2015-04-03 ]

(Note to self: before this patch is pushed, sort out how it works with UNIONs)

Comment by Sergey Vojtovich [ 2015-04-04 ]

The patch seem to be incomplete: ANALYZE_START_TRACKING /ANALYZE_STOP_TRACKING in sql_delete.cc and sql_update.cc were not updated. I'll call those with do_tracking= 1.

Comment by Sergey Vojtovich [ 2015-04-04 ]

I can see little improvement, almost as good as if it was when I commented it out.

perf proof (event: cycles):

ha_index_next() 0.38% -> 0.25%
my_timer_cycles() - 0.36% -> out of radar

So we freed up 0.49% CPU cycles.

When tracker functionality is removed from TABLE_IO_WAIT perf says:

ha_index_next() 0.38% -> 0.18%
my_timer_cycles() - 0.36% -> out of radar

That is 0.56%.

Ideally we should have different method with out-of-loop condition check. But that may be complex. Reducing number of conditions from 2 to 1 is trivial and should be worthy:

#define TABLE_IO_WAIT(TRACKER, PSI, OP, INDEX, FLAGS, PAYLOAD) \
  { \
    if (unlikely(tracker)) \
    { \
      tracker->start_tracking(); \
      MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD); \
      tracker->stop_tracking(); \
    } \
    else \
      MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD); \      
  }

Generated at Thu Feb 08 07:23:07 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.