<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Developer Day &#187; Linux</title>
	<atom:link href="http://www.thedeveloperday.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thedeveloperday.com</link>
	<description>Staying Curious</description>
	<lastBuildDate>Fri, 03 Feb 2012 12:03:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Optimizing MySQL on Ubuntu 10.10 Maverick</title>
		<link>http://www.thedeveloperday.com/optimizing-mysql-on-ubuntu-10-10-maverick/</link>
		<comments>http://www.thedeveloperday.com/optimizing-mysql-on-ubuntu-10-10-maverick/#comments</comments>
		<pubDate>Thu, 25 Nov 2010 02:06:37 +0000</pubDate>
		<dc:creator>Žilvinas Šaltys</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[innodb]]></category>
		<category><![CDATA[MyISAM]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[Tuning]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.thedeveloperday.com/?p=722</guid>
		<description><![CDATA[Since Ubuntu 9.04 Jaunty Jackalope Ubuntu ships with EXT4 as the default file system. Surprisingly it makes MySQL writes extremely slow. This post is targeted to developers who work on Linux using MySQL and who would like to optimize MySQL performance. Disk Performance Tuning First start by tuning your disk performance. To do that you&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p>Since <strong>Ubuntu 9.04 Jaunty Jackalope</strong> Ubuntu ships with EXT4 as the default file system. Surprisingly it makes <strong>MySQL</strong> writes extremely slow. This post is targeted to developers who work on <strong>Linux</strong> using MySQL and who would like to optimize MySQL performance.</p>
<h2>Disk Performance Tuning</h2>
<p>First start by tuning your <strong>disk performance</strong>. To do that you&#8217;ll have to sacrifice <strong>data consistency</strong> over data write speed. First start by enabling <strong>journal_data_writeback</strong> on your partition. This will allow to write to disk before updating the EXT4 journal. If your box crashes before updating the journal you might loose new data or some deleted data might reappear.</p>
<blockquote style="background: #444; color: #fff; padding-left: 2px;"><p>
sudo tune2fs -o journal_data_writeback /dev/sda1 (use the right partition)
</p></blockquote>
<p>Next step is editing your <strong>/etc/fstab</strong> to change ext4 mounting options. My fstab file looks something like this:</p>
<blockquote style="background: #444; color: #fff; padding-left: 2px;"><p>
UUID=irrelevant / ext4 errors=remount-ro,noatime,nodiratime,data=writeback,barrier=0,nobh,commit=100,nouser_xattr 0 1
</p></blockquote>
<p>There&#8217;s a few non default options added to improve write performance over consistency. Journal data writeback is enabled by <strong>data=writeback</strong>. The main option which is slowing down MySQL is <strong>barrier=0</strong>. You could actually change this single option and MySQL write performance would increase dramatically. Disabling this option makes your <strong>new</strong> data less safe when a system crash happens. Option <strong>nobh</strong> tries to avoid associating buffer heads and offers a minor performance improvement. Another option <strong>commit=100</strong> says that all your updates are written to disk every 100 seconds. The default is 5 seconds. If your machine crashes you&#8217;re likely to loose 100 seconds of updates. Large commit values like 100 provide big performance improvements. And the last option <strong>nouser_xattr</strong> disables extended options on your filesystem and provides a minor <strong>performance boost</strong>.</p>
<p>Double check your /etc/fstab syntax and reboot.</p>
<h2>Tuning MySQL configuration</h2>
<p>MySQL configuration settings depend on what database engines you&#8217;re using. The most common ones are <strong>MyISAM</strong> and <strong>InnoDB</strong>. I will assume that you use both.</p>
<p><strong>Warning!</strong> Some of the configuration changes will or might make your database inaccessible. Therefore backup all your databases by dumping them to SQL to a safe location. Make sure to include triggers and stored procedures. Double check that you will be able to reimport your backups and only then proceed further. Some options will make your InnoDB database stop working. I&#8217;ll mark those. Also backup your MySQL configuration. Just in case.</p>
<p>MySQL settings depend on how much memory you have. I will assume a normal working station will have 4GB of RAM. Open your MySQL configuration file which on Ubuntu is located at /etc/mysql/my.cnf and set the following options.</p>
<p><em>transaction-isolation = READ-COMMITTED</em></p>
<p>As a developer you will probably not have transactions running in parallel. If you don&#8217;t care about transactions and still use InnoDB set the isolation level to READ-COMMITED. This will make your transactions only see committed data but won&#8217;t prevent phantom rows. Setting it to READ-COMMITED will also improve performance.</p>
<p><em>key_buffer = 512M</em></p>
<p>By far the most important option for MyISAM. MyISAM indexes are cached using in the key buffer. It&#8217;s usually a good bet to set it from 25% to 40% of memory available. As a developer you might not need that much but do not leave it at a default.</p>
<p><em>query_cache_size  = 256M</em></p>
<p>Caches query results. Especially useful if your applications don&#8217;t have caching.</p>
<p><em>innodb_buffer_pool_size = 1024M</em> (<strong>requires a backup and an import</strong>)</p>
<p>InnoDB buffer pool size is the most important option for InnoDB. If your whole database is InnoDB you can try and fit your whole database in memory. If you don&#8217;t have that much memory you can generally set 70% &#8211; 80% of memory available. On a development box you will probably want to have extra RAM for things like Gnome or your IDE.</p>
<p><em>innodb_additional_mem_pool_size = 32M</em><br />
<em>innodb_log_buffer_size = 4M</em><br />
<em>innodb_log_file_size = 128M</em></p>
<p><em>innodb_flush_log_at_trx_commit	= 2</em></p>
<p>This option tells InnoDB to only flush log data every two seconds. On development machines you can set this even higher because the only risk is losing transactions during a system crash. If your development machine crashes you probably won&#8217;t care about lost transactions. Experiment!</p>
<p><em>innodb_flush_method	= O_DIRECT</em></p>
<p>This options tells InnoDB to skip filesystem cache and write straight to disk since InnoDB already has it&#8217;s own cache &#8211; the buffer pool. You save yourself some RAM.</p>
<p><em>table_cache  = 1024</em></p>
<p>Caches open tables. Might not be very useful on a single dev box but useful in general on any database server.</p>
<p><em>myisam_use_mmap = 1</em></p>
<p><a href="http://www.mysqlperformanceblog.com/2006/05/26/myisam-mmap-feature-51/">Mmap is a new MyISAM feature</a> available with MySQL 5.1. Should improve MyISAM write/read performance ~6%.</p>
<p>To sum up all the settings on a 4GB work environment:</p>
<blockquote style="background: #444; color: #fff; padding-left: 2px;"><p>
<em>transaction-isolation = READ-COMMITTED</em><br />
<em>key_buffer = 512M</em><br />
<em>query_cache_size  = 256M</em><br />
<em>innodb_buffer_pool_size = 1024M</em><br />
<em>innodb_additional_mem_pool_size = 32M</em><br />
<em>innodb_log_buffer_size = 4M</em><br />
<em>innodb_log_file_size = 128M</em><br />
<em>innodb_flush_log_at_trx_commit	= 2</em><br />
<em>innodb_flush_method	= O_DIRECT</em><br />
<em>table_cache  = 1024</em><br />
<em>myisam_use_mmap = 1</em>
</p></blockquote>
<h2>Buy an SSD disk</h2>
<p>This is by far the best upgrade you can do. <strong>SSD</strong> does not have any moving mechanical parts therefore doing a random read or write is as fast as doing a sequential read or write. My work laptop <strong>Lenovo T400</strong> can push 3.5 MB with <strong>random writes</strong>, 35 MB with <strong>sequential writes</strong>, 2.6MB with <strong>random reads</strong> and 38MB with <strong>sequential reads</strong> per second. The same test with an SSD disk can push 220MB <strong>random writes</strong> and 330MB <strong>random reads</strong> with similar numbers for sequential reads and writes. So for IO access you can expect 10 &#8211; 100 times performance difference.</p>
<h2>Summary</h2>
<p>It&#8217;s easy to squeeze some extra performance out of your development environment by sacrificing data safety. In my case these changes made our database integration test suites run a lot quicker. So far I haven&#8217;t experienced any downsides from the above settings though you have to accept that one day it most likely will. Most of the database settings I&#8217;ve mentioned are those considered most when tuning production database servers. My final advice is take everything you read here with a pinch of salt as I am by far not an expert in these matters and everything listed here is gathered from various resources online.</p>
<h2>Resources</h2>
<p><a href="http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/">InnoDB performance optimization basics</a><br />
<a href="http://www.mysqlperformanceblog.com/2006/09/29/what-to-tune-in-mysql-server-after-installation/">Tunning MySQL server after installation</a><br />
<a href="http://www.mysqlperformanceblog.com/2006/05/26/myisam-mmap-feature-51/">MyISAM MMAP feature</a><br />
<a href="http://dev.mysql.com/doc/refman/5.1/en/set-transaction.html">MySQL transaction isolation levels</a><br />
<a href="http://www.mysqlperformanceblog.com/2010/02/28/why-you-should-ignore-mysqls-key-cache-hit-ratio/">Why you should ignore key cache hit ratio</a><br />
<a href="http://pclinuxos2007.blogspot.com/2009/06/tweaks-to-boot-ext4-filesystem.html">Tweaks to boost EXT4 performance</a><br />
|<a href="http://www.tomshardware.com/reviews/samsung-470-sandforce-best-ssd,2783-14.html">SSD Benchmarks</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloperday.com/optimizing-mysql-on-ubuntu-10-10-maverick/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Starting services in a clean environment</title>
		<link>http://www.thedeveloperday.com/starting-services-in-a-clean-environment/</link>
		<comments>http://www.thedeveloperday.com/starting-services-in-a-clean-environment/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 22:35:50 +0000</pubDate>
		<dc:creator>Žilvinas Šaltys</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[services]]></category>

		<guid isPermaLink="false">http://www.thedeveloperday.com/?p=482</guid>
		<description><![CDATA[I was working on a small web application that creates Subversion branches and tags. In short it just executes SVN commands on the repository. Whenever a user executes an SVN command the SVN client tries to check user&#8217;s local home folder for the .subversion configuration directory. The issue that I was running into was that [...]]]></description>
			<content:encoded><![CDATA[<p>I was working on a small web application that creates Subversion branches and tags. In short it just executes SVN commands on the repository. Whenever a user executes an SVN command the SVN client tries to check user&#8217;s local home folder for the <strong>.subversion</strong> configuration directory. The issue that I was running into was that for some reason apache&#8217;s home folder was pointing to our system&#8217;s administrator <strong>home folder</strong> which in turn would result in a <strong>permission denied</strong> error when apache would try to access the .subversion folder.</p>
<p>It just didn&#8217;t make any sense. Turns out if you start a service through <strong>/etc/init.d/</strong> it starts that service with environment variables belonging to the user that started the service. In this case our system&#8217;s administrator started the service using his own user.</p>
<p>To start services in a clean environment a special utility called <strong>service</strong> should be used. It usually resides in the <strong>/sbin</strong> directory. So for example instead of starting apache like this:</p>
<blockquote style="background: #444; color: #fff; padding-left: 2px;"><p><em>$ sudo /etc/init.d/httpd start</em></p></blockquote>
<p>It should be started like this:</p>
<blockquote style="background: #444; color: #fff; padding-left: 2px;"><p><em>$ sudo /sbin/service httpd start</em></p></blockquote>
<p>Which will result in <strong>$HOME</strong> <strong>environment variable</strong> being empty and the SVN client not getting a <strong>permission denied</strong> error.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloperday.com/starting-services-in-a-clean-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migrating Development from Windows to Linux</title>
		<link>http://www.thedeveloperday.com/migrating-development-from-windows-to-linux/</link>
		<comments>http://www.thedeveloperday.com/migrating-development-from-windows-to-linux/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 01:28:06 +0000</pubDate>
		<dc:creator>Žilvinas Šaltys</dc:creator>
				<category><![CDATA[Rant]]></category>
		<category><![CDATA[cons]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[migrating]]></category>
		<category><![CDATA[pros]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.thedeveloperday.com/?p=135</guid>
		<description><![CDATA[I&#8217;ve been using Windows as a development platform for more than three years now. Couldn&#8217;t say I find it always productive, but I also wouldn&#8217;t say that it is very troublesome. I have been a Linux user for a few years quite a while ago. Tried debian, redhat, slackware and gentoo. Went through the pleasures [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Windows as a development platform for more than three years now. Couldn&#8217;t say I find it always productive, but I also wouldn&#8217;t say that it is very troublesome.</p>
<p>I have been a Linux user for a few years quite a while ago. Tried debian, redhat, slackware and gentoo. Went through the pleasures of compiling kernels, trying to enable the right audio drivers, not being able to make my ATI video card work, experimenting with Wine, going through a guide to setup hibernation, trying to set the right opacity for my terminal screen. I would dare to say Linux systems were still in dark ages. It was challenging to get everything right and have all the shizzle that Windows users had by default. At some point I just couldn&#8217;t be bothered anymore and started using Windows again.. <strong>Next, Next, Finish.</strong></p>
<p>And Windows is <strong>great</strong>. Up to a point. First you get all the default stuff taken care of like for example enabling a printer over network, plugging in a new USB device, setting up hardware drivers, sharing files. Setting up a development environment is as easy as downloading Xampp, an editor of your choice and you can start whipping some source code. And Cygwing helps a lot by delivering a lot of every day use tools to a Windows based platform.</p>
<p>Until you hit the rocks. For example a famous Xdebug PHP extension has problems working with Windows Vista and will often crash PHP processes. Extensions like ffmpeg-php are not maintained on Windows and are only available on Linux and it makes matters worse when you for some reason can&#8217;t do without them. Or for example good luck developing Drizzle on windows and building it using Cygwin, when some networking library just won&#8217;t compile. Suddenly you realize that your whole career is built on top of opensource tools which most of them were built and are maintained on Linux systems.</p>
<p>That is why I&#8217;ve decided to give Linux another go. I have selected Ubuntu Jaunty 9.04 to carry on my experiments. Here follows my list of pros and cons of using Ubuntu as a development platform.</p>
<p>I&#8217;ll start with <strong>cons</strong>:</p>
<ol>
<li>The latest version of PHP is 5.3.0. Ubuntu package management system offers 5.2.6. I found this a bit dissapointing. I really don&#8217;t want to be bothered to compile PHP or to search for 3rd party packages. I understand the philosophy behind this, but it still saddens me as a developer. Especially when PHP 5.3.0 builds are available on Windows as next, next, finish packages.</li>
<li>Same goes for Eclipse IDE. Not only there were no packages for Eclipse 3.5 but I had to download Eclipse myself, find out which other dependent packages are required (like Java runtime) and then follow someone&#8217;s guide to make it work by passing <em>magic</em> parameters to the launcher.</li>
<li>My favorite broswer Chrome is not available on Linux. There is ofcourse Chromium which still has problems with Flash and Printers.</li>
<li>Trying to set up dual screens was a bit troublesome. Ubuntu couldn&#8217;t identify the best native resolution for my external display and I had to find out how to add the resolution myself. Not to mention about setting which display is primary and what is the location of the other display compared to primary one. It&#8217;s still a complete mistery to me.</li>
<li>Configuring apache. Don&#8217;t get me started. How to start apache? Where&#8217;s the main config file? Oh it&#8217;s different from Windows! How to enable mod rewrite? How to add a virtual host? Had to learn about the a2* utilities familly to solve my problems. It&#8217;s easy when you know how they work and that they exists, but if you don&#8217;t &#8230;</li>
<li>When my laptop suspends and recovers it has problems accessing samba network shares. Still not solved.</li>
<li>What is the shortcut to go to Desktop? What is the shortcut to logout? Was hoping it would be the same as on Windows. It&#8217;s not. Though it&#8217;s not a big issue.</li>
<li>Ubuntu has no nice default screensavers (joking)</li>
</ol>
<p>Enough with the bashing. The <strong>pros</strong>:</p>
<ol>
<li>Superior speed. Starts a lot faster that Windows. Especially if compared to my Lenovo laptop which comes with a lot of preinstalled crap applications which I didn&#8217;t want in the first place.</li>
<li>Lot&#8217;s of problems solved. Audio, USB, printers, network sharing, video playing <strong>just works</strong>.</li>
<li>Amazing package management solution. Whatever you need, just search and install. And you are sure the packages are clean from viruses (hopefuly)</li>
<li>All opensource tools are available. When a package is not available it&#8217;s possible to find a 3rd party build or build it yourself. Helps a lot when you need that one magic extension.</li>
<li>A lot more easy to set up a development environment than it was before. I have never installed phpmyadmin that easy.</li>
<li>Virtualization is easier than ever. You can even have windows applications running along with Linux ones.</li>
<li>Some applications are more well built. Like Skype for example allows me to disable contact request spam notifications. Which is a huge problem on Windows nowdays.</li>
<li>Completely FREE.</li>
<li>Looks nice! Has lovely eye-candies! <strong>The Cube</strong>!</li>
</ol>
<p>So far that&#8217;s my experience. I&#8217;ll keep using Ubuntu at work seeing how it goes. My main wish for Ubuntu is for it to be 3 times more faster than it already is. Just like Chrome.. All in all I must say Linux desktop has advanced a lot further than expected by me. I would highly recommend it for schools, universities and home users who don&#8217;t play games.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloperday.com/migrating-development-from-windows-to-linux/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Linux like terminal on Windows!</title>
		<link>http://www.thedeveloperday.com/linux-like-terminal-windows/</link>
		<comments>http://www.thedeveloperday.com/linux-like-terminal-windows/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 18:30:26 +0000</pubDate>
		<dc:creator>Žilvinas Šaltys</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.thedeveloperday.com/linux-like-terminal-windows/</guid>
		<description><![CDATA[Have you ever wanted to make your CMD window fullscreen? You did? And it didn&#8217;t work? Too bad. Have you ever wanted to search something in your files using grep, awk, less, sort? Have you ever tried to mass rename your files ? You did? And it didn&#8217;t work? Too bad.Be worried no more! First you [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left">Have you ever wanted to make your CMD window fullscreen? You did? And it didn&#8217;t work? Too bad. Have you ever wanted to search something in your files using grep, awk, less, sort? Have you ever tried to mass rename your files ? You did? And it didn&#8217;t work? Too bad.Be worried no more! First you need <a href="http://www.cygwin.com/" title="Cygwin homepage">Cygwin</a>. Cygwin is a Linux-like environment for Windows. It also provides you a lot of tools which provide linux look and feel. Install cygwin while changing none of the default settings. Now you can do something like this:</p>
<p><a href="http://www.thedeveloperday.com/wp-content/uploads/2008/09/cygwin_terminal.jpg" title="Cygwin Terminal"><img src="http://www.thedeveloperday.com/wp-content/uploads/2008/09/cygwin_terminal.thumbnail.jpg" alt="Cygwin Terminal" title="Cygwin Terminal" /></a> 
<p style="text-align: left">Notice that this is a simple CMD like window but it now has some nice colors and new shiny tools.Now in order to make it even more cool you need a tool named <a href="http://code.google.com/p/puttycyg/" title="putty cygwin terminal">PuTTYcyg</a>. PuTTYcyg is a patched version of PuTTY that, in addition to telnet, rlogin, ssh, and serial connections, can also be used as a local Cygwin terminal instead of the Windows console. Download the package and unzip it somwhere. I put it in C:\Program Files\puttycyg. Now double click on a file named putty.exe. Now fill everything as in the image bellow and press save.</p>
<p> <a href="http://www.thedeveloperday.com/wp-content/uploads/2008/09/local.jpg" title="cygwin putty configuration"><img src="http://www.thedeveloperday.com/wp-content/uploads/2008/09/local.thumbnail.jpg" alt="cygwin putty configuration" /></a> 
<p style="text-align: left">Now make a shortcut of this putty.exe on your Desktop. And change it&#8217;s properties like this:</p>
<p><a href="http://www.thedeveloperday.com/wp-content/uploads/2008/09/terminal.jpg" title="cygwin putty terminal shortcut"><img src="http://www.thedeveloperday.com/wp-content/uploads/2008/09/terminal.thumbnail.jpg" alt="cygwin putty terminal shortcut" /></a>  
<p style="text-align: left">Click apply and you are ready to go myfriend! Double click on the shortcut and you should be able to do thins like this including full screen resize yay!</p>
<p><a href="http://www.thedeveloperday.com/wp-content/uploads/2008/09/terminal2.jpg" title="putty cygwin terminal"><img src="http://www.thedeveloperday.com/wp-content/uploads/2008/09/terminal2.thumbnail.jpg" alt="putty cygwin terminal" /></a> 
<p style="text-align: left">Now .. Begone CMD!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloperday.com/linux-like-terminal-windows/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

