Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-16-2010, 02:31 AM
|
#1
|
Member
Registered: Nov 2009
Posts: 109
Rep:
|
mysql optimization -- Copying to tmp table on disk
Dear all,
we had a CENTOS 5.5 x86_64 machine with 8GB RAM, powered with MySQL 5.0.91-community.
Currently we had a very high number of Created_tmp_disk_tables (31k in 4,5 hours!!!).
I've read suggestion that we need to increase tmp_table_size, and we've set tmp_table_size to 64M, but this drupal modul's query still cause mysql create tmp table on disk
Code:
SELECT DISTINCT node.nid AS nid,
comments.subject AS comments_subject,
comments.cid AS comment"
Finally, I desperately increase tmp_table_size to 512M, but mysql still create disk tmp tables instead of memory temporary table. (But currently we switched it back to 64M because 512M was insane).
This thing become a problem because several times when high request occurs, tmp usage increased to several Gigs, and caused mysql crashed.
does anyone has any suggestion(s)?
any help appreciated.
regards,
yoachan
|
|
|
11-16-2010, 03:14 PM
|
#2
|
Senior Member
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278
|
My first suggestion is to make a filesystem of type tmp_fs and mount it. Then point mysql at it, to make its tmp tables there.
tmp_fs is a ramdrive, and so is made of ram. Therefore, mysql will still be writing tmp-tables out to ram, even though it thinks it is writing to disk.
http://www.thegeekstuff.com/2008/11/...tmpfs-on-linux
Last edited by szboardstretcher; 11-16-2010 at 03:17 PM.
|
|
|
11-17-2010, 02:51 AM
|
#3
|
Member
Registered: Nov 2009
Posts: 109
Original Poster
Rep:
|
Quote:
Originally Posted by szboardstretcher
My first suggestion is to make a filesystem of type tmp_fs and mount it. Then point mysql at it, to make its tmp tables there.
tmp_fs is a ramdrive, and so is made of ram. Therefore, mysql will still be writing tmp-tables out to ram, even though it thinks it is writing to disk.
http://www.thegeekstuff.com/2008/11/...tmpfs-on-linux
|
It doesn't answer the real question,
but it sure is a good alternate solution to speedup the swap process.
thanks for sharing
|
|
|
11-18-2010, 01:36 PM
|
#4
|
Senior Member
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278
|
Quote:
Originally Posted by yoachan
It doesn't answer the real question,
but it sure is a good alternate solution to speedup the swap process.
thanks for sharing
|
You are creating many TMP tables, that are eventually swapping to physical disk. Therefore, if you create a ramdisk, and lower the max size of tmp tables, they will be written to memory/ramdisk - thus staying in ram. This is one solution directly related to your problem.
Also, to figure out what your configuration values should be, take a look at this:
http://www.sitebuddy.com/Mysql/tmp_t...ad_buffer_size
|
|
|
11-23-2010, 09:24 AM
|
#5
|
Member
Registered: Nov 2009
Posts: 109
Original Poster
Rep:
|
Quote:
Originally Posted by szboardstretcher
You are creating many TMP tables, that are eventually swapping to physical disk. Therefore, if you create a ramdisk, and lower the max size of tmp tables, they will be written to memory/ramdisk - thus staying in ram. This is one solution directly related to your problem.
Also, to figure out what your configuration values should be, take a look at this:
http://www.sitebuddy.com/Mysql/tmp_t...ad_buffer_size
|
Yes, it's in deed related
But my main question is why it dump the table to disk, instead of memory.
The link that you gave was so helpful.
Instead of only increasing tmp_table_size, I need to increase MAX_HEAP_TABLE_SIZE too. And currently everything is working as I expected.
Thanks.
-- case closed --
|
|
|
All times are GMT -5. The time now is 10:27 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|