Archive for September, 2010

Linux Optimizations. Performance Boosting.

September 30th, 2010 10 comments

Last week, I came across a tutorial about tweaking a specific parameter in the Linux virtual memory subsystem. So I figured that I would share all of the optimizations that I usually go through in a new installation of Linux.

Adjusting swap parameters
As the tutorial highlighted, minimizing the vm.swappiness value is a good start. Realistically I do not understand why it defaults to 60. The lesser the value, the more memory is used before swapping processes to disk begins. That is, 0 will use all memory before swapping begins. Nowadays, most PCs come with more than enough memory, so why the need to swap so early. Setting a value such as 10 on a system that contains 1GB or more of RAM, should be fairly reasonable. I can only imagine the performance hit of write operations to SSDs. Just the amount of time to modify each block of each page with the read-modify-erase-rewrite mechanism SSDs utilize when writing data to NAND cells. Swapping can really bring down the performance of such a high-speed technology while also hurting the limited cell life, despite modern algorithms for wear-leveling.

While the highlighted article will pretty much state the same thing, you just need to modify the /etc/sysctl.conf file and append vm.swappiness=10. On reboot it will take affect when sysctl is launched during init; but you can quickly apply it by typing the following at the command line:

$ sudo sysctl -q -p

Disabling atime
Another thing I usually do for personal computing PCs is that I mount all file systems (that support it), with atime disabled. Atime is a file’s last accessed time. In most cases this is an unnecessary update to the metadata associated with a recently accessed file. Again, this is a benefit to SSD accessibility as it is less data that needs to be written to the storage device. Here is a good example of how my /etc/fstab file looks like (I do apologize for the misalignment):

UUID=5bc12928-9e8f-4413-9f20-6d5bcd107881 / ext4 errors=remount-ro,noatime 0 1
/dev/sda1 /boot ext4 noatime 0 2
UUID=50f38470-810a-4145-ab0a-5e3152ced335 /usr ext4 noatime 0 2

Under options I know that I do not care about access time, so there is never a need to constantly update that metadata for each file touched which would normal result in increased hard drive usage or SSD cell wear.

Caching applications to RAM
One last optimization I like to configure is caching what I can to RAM. A great example can be seen with Firefox. I use tmpfs for this.

$ sudo mkdir /mnt/rdsk
$ sudo mount -t tmpfs -o size=96m tmpfs /mnt/rdsk/

This command creates a directory named /mnt/rdsk and in turn use 96 MBytes of RAM for volatile disk space. The reason why I say volatile is that as soon as the file system is unmounted or the PC is rebooted or powered down, all contents disappear. The data will remain intact as long as the file system is active. Although who is to stop you from routinely backing the data up with either rsync or some or archiving mechanism and in turn restore it when the system is back up and running?

Now why would you want to use something like this? Faster performance as you do not have to rely on slower disk device. Also in some cases there is added security. For instance, if Firefox caches its data to this RAM based file system and I shut down the PC, all of that cache which may include confidential or private information will disappear. To set something like this up you will need to modify your /etc/fstab file and append the following line:

tmpfs /mnt/rdsk tmpfs size=96m,nr_inodes=10k,mode=777 0 0

Please reference the man page for the mount command to know what these options mean for tmpfs. With this, everytime you reboot the PC, a 96 MBytes of tmpfs space will be mounted to /mnt/rdsk.

If you want to cache Firefox to this tmpfs space, then open up the web browser at type about:config in the URL (BE CAREFUL HERE) and add a new string type of browser.cache.disk.parent_directory with a value of /mnt/rdsk. Restart the browser and you will notice a performance boost.

Note that using tmpfs and ramfs does not have to be limited to Firefox caching. There are numerous applications which can take advantage of this. It is just up to you to identify and decide.

One way to think of all these optimization is that they can also reduce power consumption. With less power spent to routinely spin up/down magnetic disk drives, it would make sense limit access to these devices.

Is VirtualBox on the same path as other Sun software?

September 9th, 2010 3 comments

Amazing. Oracle acquires all of Sun’s intellectual property including their open source projects. They kill off OpenSolaris while still leaving other projects in a state of limbo. One possibly being VirtualBox. Sure, there have been updated releases since Oracle took over, but it has been over a month now and these updates are just less frequent.

OK, truth be told, Sun didn’t always commit to a consistent release cycle either. What frustrates me though is that the latest version of 3.2.8 has brought with it numerous bugs for Linux. One of which involves the corruption of saved states and the other involves general usability in the main application window. None of which I had seen when Sun directed the application’s development.

In a past posting, I had stated my opinions of the quality that should be expected now that Oracle is running the show with what was once regarded as quality or just good software. I guess the question boils down to: Does Oracle even care about virtualization? Is it part even part of the business model and in turn, revenue stream? What fate does VirtualBox have?

Categories: Linux, Red Hat, Ubuntu, virtualization Tags:

New Tool: DrvAdm 10.09

September 5th, 2010 Comments off

I would like to announce a new disk management utility for Linux platforms. Specifically for the 2.6. 32+ kernels. It is called DrvAdm and is currently supported on Ubuntu Desktop/Server 10.04 and Red Hat ES 6 (to be released by end of 2010). Validation for Red Hat ES 6 was done on the second beta release.

You can read more about it on its wiki page or download it directly from its hosted project page. For the most part, DrvAdm supports the following features:

  • Dynamically add / remove / update devices in the SCSI subsystem
  • Reset the SCSI host, target, bus or all.
  • Retrieve a list of all SCSI devices with detailed information
  • Retrieve a list of all SCSI hosts with detailed information
  • View the device’s partition table
  • Retrieve the device’s geometry / size
  • Modify device parametets (i.e. queue_depth, timeout, etc.)
  • Send Loop Initialization Primitives (LIPs) to the Fibre Channel hosts

A good trivia question: What technology has Microsoft been the first to market?

September 1st, 2010 8 comments

I am currently employed with a large global company, working in a division that strictly focuses on embedded Linux development. Earlier this week, during our lunch hour, as one would expect with a predominantly Linux crowd, we had engaged in a conversation on the following question: What technology has Microsoft been the first to market? And of those technologies, which was developed by Microsoft? The only thing that came to mind was the family of FAT file systems. Early on, they dabbled with UNIX (i.e. XENIX – which was sold to SCO), then acquiring a company for their implementation of DOS. The graphical desktop predates Windows. Their Microsoft Office suite was far from original. None of their hardware technologies were unique (Xbox, Zune, etc.). C# and the .Net framework is just their (re-)implementation of Java (after the whole Sun Microsystems and J++/Visual Studio 6 incident). So I ask the reader: What technology has Microsoft invented to be the first to market?

If their only real product-based contribution to the technology world is FAT, then their is something to be said about the company: they have a damn good marketing team. Who would have thought that a permission-less, fragmentation-prone, non-journaling and pretty much featureless of a file system has been used for the better part of the past 2-3 decades. And the signs of it disappearing are nowhere in site.

Categories: Microsoft, Misc Tags: