Memory allocators: MySQL performance improvements in Percona Server 5.5.30-30.2

In addition to the problem with trx_list scan we discussed in Friday’s post, there is another issue in InnoDB transaction processing that notably affects MySQL performance – for every transaction InnoDB creates a read view and allocates memory for this structure from heap. The problem is that the heap for that allocation is destroyed on each commit and thus the read view memory is reallocated on the next transaction.

There are two aspects of this problem:

1) memory allocation is an costly operation and if memory allocator has scalability problems (like allocator from glibc) this will notably slowdown MySQL-transaction creation and many threads will get stuck on glibc/kernel syscalls, which will in turn result in contention on kernel_mutex (trx_sys->mutex in 5.6), as memory allocation occurs under that mutex. See an example of such an issue. Related bugs: BUG#54982, BUG#49169.

2) memory allocation for read-view structure is not a direct malloc() call, but rather goes through the InnoDB heap layer – so InnoDB allocates heap area and then creates requested block(s) there. That optimization helps to avoid fragmentation in case of many small allocations and allows to free all blocks from specific heap at once. But in the case when we need memory only for a single block this 2 layers approach is quite inefficient and in some cases can be the reason for notable MySQL performance drop.

Now in Percona Server, for each connection we use a preallocated read view structure, reuse that memory during the entire connection lifetime and free it at disconnect. If some transactions require a larger amount of memory – we just reallocate memory to fulfill it needs.

To demonstrate the difference we have run sysbench POINT_SELECT test for glibc and jemalloc allocators.



= MySQL 5.5.30
– throughput of MySQL 5.5.30 with glibc is limited first of all by inefficiency of transaction list handling (see our previous post) and also by bad scalability of glibc malloc itself
– jemalloc helps MySQL 5.5.30 to fix issues with malloc scalability but still scanning of the transaction list
causes performance drop

= MySQL 5.6.10
– in autocommit mode 5.6.10 has no problem with transaction list scanning (due to the read-only transactions optimization), but it still allocates/frees memory for read view structure and that causes drops at high threads with glibc. Jemalloc helps to solve that.

= Percona Server 5.5.30-30.2
– both issues are solved in our recent release and such we have almost no difference in results between runs either with glibc or jemalloc

The post Memory allocators: MySQL performance improvements in Percona Server 5.5.30-30.2 appeared first on MySQL Performance Blog.


Announcing Percona Server for MySQL 5.5.30-30.1

Percona Server for MySQL version 5.5.30-30.1

Percona Server for MySQL version 5.5.30-30.1

Percona is glad to announce the release of Percona Server for MySQL 5.5.30-30.1 on March 7, 2013 (Downloads are available here and from the Percona Software Repositories). Based on MySQL 5.5.30, including all the bug fixes in it, Percona Server 5.5.30-30.1 is now the current stable release in the 5.5 series. All of Percona‘s software is open-source and free, all the details of the release can be found in the 5.5.30-30.1 milestone at Launchpad.

Bugs Fixed:

  • Minor optimization cleanup by removing unnecessary current_thd calls. Bug fixed #1121794 (Alexey Kopytov).
  • Fixed the regression introduced with the fix for bug #1083058 which caused unnecessary mutex re-acquisitions in adaptive flushing. Bug fixed #1117067 (Laurynas Biveinis).
  • Percona Server would do unnecessary slow log stats accounting even with the slow log disabled. Bug fixed #1123915 (Alexey Kopytov).
  • Optimization cleanup to avoid calls related to extended slow query log stats when this feature is disabled. Bug fixed #1123921 (Alexey Kopytov).
  • The static srv_pass_corrupt_table variable could share CPU cache lines with InnoDB row counters, which resulted in high false sharing effect in high-concurrent workloads. Bug fixed #1125259 (Alexey Kopytov).
  • Fixed the regression introduced with fix for bug #791030 in Percona Server 5.5.13-20.4 by implementing an optimized version of the same function. Bug fixed #1130655 (Alexey Kopytov).
  • Bug fixed #1132350 (Alexey Kopytov).
  • Bug fixed #1132351 (Alexey Kopytov).

Other bug fixes in Percona Server for MySQL 5.5.30-30.1: bug fixed #1089265 (Laurynas Biveinis).

Release notes for Percona Server 5.5.30-30.1 are available in our online documentation. Bugs can be reported on the launchpad bug tracker.

The post Announcing Percona Server for MySQL 5.5.30-30.1 appeared first on MySQL Performance Blog.

Powered by WordPress | Theme: Aeros 2.0 by TheBuckmaker.com