<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Mysql on vnykmshr</title><link>https://blog.vnykmshr.com/writing/tags/mysql/</link><description>Recent content in Mysql on vnykmshr</description><generator>Hugo</generator><language>en</language><lastBuildDate>Thu, 11 Apr 2013 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.vnykmshr.com/writing/tags/mysql/index.xml" rel="self" type="application/rss+xml"/><item><title>MySQL on XFS</title><link>https://blog.vnykmshr.com/writing/mysql-xfs/</link><pubDate>Thu, 11 Apr 2013 00:00:00 +0000</pubDate><guid>https://blog.vnykmshr.com/writing/mysql-xfs/</guid><description>&lt;p&gt;XFS handles database workloads better than ext4 &amp;ndash; better concurrent I/O, more efficient metadata operations for tables-heavy schemas, and delayed allocation that improves write throughput. The obvious approach is to change MySQL&amp;rsquo;s &lt;code&gt;datadir&lt;/code&gt; in the config. The less obvious approach is bind mounts, which keep every path where the system expects it.&lt;/p&gt;
&lt;h2 id="setup"&gt;Setup&lt;/h2&gt;
&lt;p&gt;Install XFS utilities alongside MySQL:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get install -y xfsprogs mysql-server
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Create the filesystem on the dedicated volume:&lt;/p&gt;</description></item><item><title>Connection pooling</title><link>https://blog.vnykmshr.com/writing/connection-pooling-nodejs-mysql/</link><pubDate>Fri, 20 Jul 2012 00:00:00 +0000</pubDate><guid>https://blog.vnykmshr.com/writing/connection-pooling-nodejs-mysql/</guid><description>&lt;p&gt;The &lt;code&gt;mysql&lt;/code&gt; npm module creates one connection per client instance. Every database call opens a connection, runs the query, and you&amp;rsquo;re responsible for closing it. Under concurrent requests, connections pile up. MySQL has a &lt;code&gt;max_connections&lt;/code&gt; setting &amp;ndash; default 151 &amp;ndash; and when you hit it, new queries fail.&lt;/p&gt;
&lt;p&gt;I hit this in production. The app was handling maybe forty concurrent requests and MySQL started refusing connections. The error is &lt;code&gt;Too many connections&lt;/code&gt; and there&amp;rsquo;s no graceful fallback. Queries fail.&lt;/p&gt;</description></item></channel></rss>