<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: More on table_cache</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2009/11/26/more-on-table_cache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2009/11/26/more-on-table_cache/</link>
	<description>Percona&#039;s MySQL &#38; InnoDB performance and scalability blog</description>
	<lastBuildDate>Sat, 11 Feb 2012 16:45:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Shahryar Ghazi</title>
		<link>http://www.mysqlperformanceblog.com/2009/11/26/more-on-table_cache/comment-page-1/#comment-773523</link>
		<dc:creator>Shahryar Ghazi</dc:creator>
		<pubDate>Tue, 07 Sep 2010 19:36:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=1790#comment-773523</guid>
		<description>@Jay Pipes, I agree with you its only a MyISAM specific issue for the most part.

Another reason for using a smaller table_cache 
http://www.geeksww.com/tutorials/database_management_systems/mysql/installation/mysql_tablecache_informationschema_and_open_files_limit.php</description>
		<content:encoded><![CDATA[<p>@Jay Pipes, I agree with you its only a MyISAM specific issue for the most part.</p>
<p>Another reason for using a smaller table_cache<br />
<a href="http://www.geeksww.com/tutorials/database_management_systems/mysql/installation/mysql_tablecache_informationschema_and_open_files_limit.php" rel="nofollow">http://www.geeksww.com/tutorials/database_management_systems/mysql/installation/mysql_tablecache_informationschema_and_open_files_limit.php</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: benjamin</title>
		<link>http://www.mysqlperformanceblog.com/2009/11/26/more-on-table_cache/comment-page-1/#comment-694529</link>
		<dc:creator>benjamin</dc:creator>
		<pubDate>Fri, 11 Dec 2009 19:01:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=1790#comment-694529</guid>
		<description>After reading the table cache structure, it looks like we testing on 1000 tables and keep performing select will put instances of one table into the chain of table cache structure until there is no more cache available and then
mysql will delete those in unused_link. One thing I am not really understand is that every select you issue, will
create a table instance and put it into chain? ( in same session ) Should MySQL reuse these &#039;used&#039; table cache? It makes sense if we have large cache and chain up a lot of instances, traverse the long linked-list will introduce penalty if mysql doesn&#039;t reuse &#039;used&#039; instances in the linked-list.</description>
		<content:encoded><![CDATA[<p>After reading the table cache structure, it looks like we testing on 1000 tables and keep performing select will put instances of one table into the chain of table cache structure until there is no more cache available and then<br />
mysql will delete those in unused_link. One thing I am not really understand is that every select you issue, will<br />
create a table instance and put it into chain? ( in same session ) Should MySQL reuse these &#8216;used&#8217; table cache? It makes sense if we have large cache and chain up a lot of instances, traverse the long linked-list will introduce penalty if mysql doesn&#8217;t reuse &#8216;used&#8217; instances in the linked-list.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2009/11/26/more-on-table_cache/comment-page-1/#comment-692145</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Tue, 08 Dec 2009 02:32:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=1790#comment-692145</guid>
		<description>Apachez,

Yes this seems to be related to dynamic hash table code.  Yasufumi has taken a look into it and insert/delete code seems to be not overly optimal.  MySQL at this point does not have any tuning options.  Indeed for things like table_cache it should be possible just to allocate large enough  hash table so there is almost no collisions.</description>
		<content:encoded><![CDATA[<p>Apachez,</p>
<p>Yes this seems to be related to dynamic hash table code.  Yasufumi has taken a look into it and insert/delete code seems to be not overly optimal.  MySQL at this point does not have any tuning options.  Indeed for things like table_cache it should be possible just to allocate large enough  hash table so there is almost no collisions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Apachez</title>
		<link>http://www.mysqlperformanceblog.com/2009/11/26/more-on-table_cache/comment-page-1/#comment-691234</link>
		<dc:creator>Apachez</dc:creator>
		<pubDate>Sun, 06 Dec 2009 16:11:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=1790#comment-691234</guid>
		<description>So to sum it up:

1) 100.000 tables.
2) Table_Cache set to 2.000 brings 16400 selects/sec.
3) Table_Cache set to 20.000 brings 13500 selects/sec.
4) Table_Cache set to 5 brings 8000 selects/sec.

What if you set Table_Cache to 100.000 or more?

I would assume this strange behaviour is due to entry vs bucket options in the hashtable (of course depending on which hash is being used etc but as a theory).

Similar behaviour exists in the tcp/ip stack of the linux kernel where (from performance point of view) the best option is to set same number of buckets as you will have number of entries in the hash (each bucket will only contain max 1 entry). Its not the most optimal regarding memory usage (slightly more mem will be used) but its the best regarding performance. The difference is if you have 10 entries per bucket it will be somewhat fast but if you fill each bucket with 100 or more entries you will start to notice a penalty hit.

Regarding the tcp/ip stack of linux kernel the hint is to set &quot;ip_conntrack.hashsize=xxx&quot; (where xxx is same value you set as /proc/sys/net/ipv4/ip_conntrack_max) as bootoption for the kernel.</description>
		<content:encoded><![CDATA[<p>So to sum it up:</p>
<p>1) 100.000 tables.<br />
2) Table_Cache set to 2.000 brings 16400 selects/sec.<br />
3) Table_Cache set to 20.000 brings 13500 selects/sec.<br />
4) Table_Cache set to 5 brings 8000 selects/sec.</p>
<p>What if you set Table_Cache to 100.000 or more?</p>
<p>I would assume this strange behaviour is due to entry vs bucket options in the hashtable (of course depending on which hash is being used etc but as a theory).</p>
<p>Similar behaviour exists in the tcp/ip stack of the linux kernel where (from performance point of view) the best option is to set same number of buckets as you will have number of entries in the hash (each bucket will only contain max 1 entry). Its not the most optimal regarding memory usage (slightly more mem will be used) but its the best regarding performance. The difference is if you have 10 entries per bucket it will be somewhat fast but if you fill each bucket with 100 or more entries you will start to notice a penalty hit.</p>
<p>Regarding the tcp/ip stack of linux kernel the hint is to set &#8220;ip_conntrack.hashsize=xxx&#8221; (where xxx is same value you set as /proc/sys/net/ipv4/ip_conntrack_max) as bootoption for the kernel.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay Pipes</title>
		<link>http://www.mysqlperformanceblog.com/2009/11/26/more-on-table_cache/comment-page-1/#comment-688908</link>
		<dc:creator>Jay Pipes</dc:creator>
		<pubDate>Wed, 02 Dec 2009 15:27:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=1790#comment-688908</guid>
		<description>It&#039;s good to note that this issue is specific to MyISAM, and not InnoDB...</description>
		<content:encoded><![CDATA[<p>It&#8217;s good to note that this issue is specific to MyISAM, and not InnoDB&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2009/11/26/more-on-table_cache/comment-page-1/#comment-687316</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Mon, 30 Nov 2009 06:01:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=1790#comment-687316</guid>
		<description>Patrick,

I agree with you.  MySQL (well, as most software) is one big surprise in the sense.</description>
		<content:encoded><![CDATA[<p>Patrick,</p>
<p>I agree with you.  MySQL (well, as most software) is one big surprise in the sense.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Casey</title>
		<link>http://www.mysqlperformanceblog.com/2009/11/26/more-on-table_cache/comment-page-1/#comment-685739</link>
		<dc:creator>Patrick Casey</dc:creator>
		<pubDate>Fri, 27 Nov 2009 17:14:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=1790#comment-685739</guid>
		<description>Has anybody looks at the internals of the table_cache data structure? I&#039;d naively assume that you could get close to linear performance with something as simple as a hash table, its sort of weird that there&#039;d be any kind of dependency on number of entries (though good to know).</description>
		<content:encoded><![CDATA[<p>Has anybody looks at the internals of the table_cache data structure? I&#8217;d naively assume that you could get close to linear performance with something as simple as a hash table, its sort of weird that there&#8217;d be any kind of dependency on number of entries (though good to know).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

