Revenue Source

Welcome to the Revenue Source affiliate marketing forums.

You are viewing our internet marketing and SEO forums as a guest which gives you limited access to most of our discussions.  By joining our free community, you will have access to post affiliate marketing topics, communicate privately with other members (PM), exchange SEO strategies, and access many other special features.  Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems, please don't hesitate to contact us.

Go Back   Revenue Source > Site Design & Development > Databases
Reload this Page Read Buffers, mmap, malloc and MySQL Performance
Tags: , , , ,

Reply
 
LinkBack Thread Tools Search this Thread
Old
  (#1 (permalink))
Affiliate Blogs is Offline
Revenue Source Veteran
Affiliate Blogs has a brilliant future here!
 
Affiliate Blogs's Avatar
 
Join Date: Oct 2005
Posts: 9,077
Jack of All Trades
CyberSpace United States
   
Read Buffers, mmap, malloc and MySQL Performance - 09-12-2007

Monty Taylor posted interesting investigation of the fact read_buffer_size variable affects connection speed.
This is not something you would expect right ? me too. Not only global user data is expected to be cached on startup but even if it is not why would you do full table scan to fetch single user information ? Something is fishy here and perhaps bug needs to be filed either resulting in fixes or docummentation updates.
The great thing you see from this post is - o_profile (often together with strace) are great tools for MySQL Performance analyses. Too many people end tuning on plans and indexes while there well could be some internal gotchas.
The next Monty comes up with 2 posts on mmap allocation.
Indeed allocating with mmap is much slower than allocating from memory memory pool which process already “owns” and in real life it can get much slower than Monty results show.
Mmap allocation process can be split to two parts - first is finding the free region of required size, which can get expensive if virtual memory gets fragmented. A while ago I measured over 10 times slow down over time as memory becomes fragmented with 50.000+ of memory areas mapped.
As the gap in the process address space is found kernel has to setup the page tables. The larger the buffer is allocated the more pages needs to be set up so the slower it gets. This part is indeed proportional to number of pages being allocated.
On anonimous mmap (which is used for allocations) physical pages are typically not allocated - this only happens first time you access the page and can be responsible for further penalty - especially if you use the buffer only once.
What can be done to speed things up here ?
Of course you can tune you malloc settings so more buffers are allocated from the pools rather than mmap. This though will at least increase memory consumptions as deallocating of these large buffers will not instantly return data to the OS. Plus I’m not sure how much luck you will have with malloc algorithms if they are forced to deal with very large blocks.
The second possibility is to use large pages. These already can be used for Innodb Buffer Pool and Key Buffer but could be used for other large allocations.
Finally this is yet another reasons internal resource allocation manager makes sense. If you would keep say 20*2MB read buffers in the pool you could just grab one having allocation very quick.
Also MySQL should get smarter in terms of which buffer size should be used, even for sake of speeding up the reads and more optimal resource allocation - if you have small table or LIMIT 10 in full table scan query you well may not need large buffer.


Read Buffers, mmap, malloc and MySQL Performance - Read More...
  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads for: Read Buffers, mmap, malloc and MySQL Performance
Thread Thread Starter Forum Replies Last Post
Looking for High Performance MySQL Interns Affiliate Blogs Databases 0 09-02-2007 05:03 PM
Working on ?High Performance MySQL, Second Edition?, how you can help? Affiliate Blogs Databases 0 08-31-2007 02:02 PM
MySQL VIEW as performance troublemaker Affiliate Blogs Databases 0 08-12-2007 06:23 PM
Can Innodb Read-Ahead reduce read performance ? Affiliate Blogs Databases 0 06-26-2007 01:54 PM
MySQL 4 to MySQL 5 Upgrade performance regressions Affiliate Blogs Databases 0 06-06-2007 12:55 PM



© 2004-6 RevenueSource.com.  All rights reserved.  Do not duplicate or redistribute in any form.
This website and its logos/design are property of RevenueSource.com.  All rights reserved. vBSEO 3.2.0 RC7


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34