Bug #41301 Collection of optimization for mt-NDB
Submitted: 8 Dec 2008 14:34 Modified: 18 Dec 2008 9:34
Reporter: Ole John Aske
Status: Closed
Category:Server: Cluster Severity:S3 (Non-critical)
Version: OS:Sun Solaris
Assigned to: Ole John Aske Target Version:
Tags: performance

[8 Dec 2008 14:34] Ole John Aske
Description:
Several minor optimization has been identified by using running ndbmtd under the control
of profiling tools (SunStudio collect(analyzer). This has been done as part of an project
of optimizing mySQL Cluster for the SPARC Niagara platform. Even though the aim has been
to optimize for SunStudio / Niagara CMT, an improvement should also expected for other
architectures.

Improvements contained in this commit:

- Hot-spots has been identified in the inter-thread signaling buffers.
  As these hot-spots was scattered across a large array, effectively the
  whole L1 cache was reloaded / garbled each time these structures was
  scanned: Altered structures to place hot-spots into a more compact 
  structure.

- Introduced explicit no-branch hinting for common error handlers
  (#pragma rarelly_called(<func>)

- Reduce #condition signals be keeping track of sleep/running state 
  of each thread. Only signaling a sleeping thread.

- read_jbb_state() & read_jba_state() changed to return a bool 'is_empty'
  if the buffers are known to be empty. This is later used by execute_signal()
  to avoid executing signals on buffers known to be empty.

- Introduced a simplified version of flush_write_state(): 
  flush_write_state_self() which flush the write buffers being signaled to
  itself. This can be simplifed wo/ memory barriers and mutex/ condition
  handling

- Restructured code to do less work inside loops.

- A few 'inline' added to function declarations.

How to repeat:
Not relevant as this is not a real 'bug' - only performance improvements.
[8 Dec 2008 15:16] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/60935

3163 Ole John Aske	2008-12-08
      Bug#41301, collection of optimization improvements
[8 Dec 2008 15:57] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/60951

3163 Ole John Aske	2008-12-08
      Bug#41301, collection of optimization improvements, fixed some coding style issues
[11 Dec 2008 11:40] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/61323

3167 Ole John Aske	2008-12-11
      Commit for Bug#41301 after Jonas first review.
[11 Dec 2008 13:36] Jonas Oreland
nice and clean
ok to push
[11 Dec 2008 15:22] Bugs System
Pushed into 5.1.30-ndb-6.4.0 
(revid:ole.john.aske@sun.com-20081211104024-c6bm8n3ha3321y8d) (version source
revid:ole.john.aske@sun.com-20081211104024-c6bm8n3ha3321y8d) (pib:5)
[18 Dec 2008 9:34] Jonas Oreland
no need to document as 6.4 is not released