MythTV III: The Final Chapter

My final post on MythTV revolves around tweaking MythTV and Ubuntu. I’ve picked up a number of ideas from a variety of sites and compiled the tricks, tips, hacks, and configurations that work best for my setup. You can read my first MythTV post on hardware and my second post on Ubuntu and MythTV installation and setup for background on the particulars of my setup.

This post covers specific hacks that increase performance of Ubuntu and MythTV, but I wont go into all the basic configuration of MythTV and Ubuntu. For general ubuntu configuration I recommend checking out Ubuntu Guide, which has configuration tips for each release. For MythTV check out the MythTV wiki.

Swapiness

Swapiness defines how much the system will utilize the swap space over memory. The range is 0 to 100, 0 being no swap usage. The default for Ubuntu is 60. For desktop machines with more than 512MB of RAM you will probably want to adjust this. I set it to 10 for my system. Servers, or machines that are acting as a backend only may want this to be higher than the default.

You can use this command to temporarily change the swapiness:
sudo sysctl vm.swappiness=10

To make the change perminent add the line vm.swappiness=10 to sysctl.conf:
sudo gedit /etc/sysctl.conf

Preload

This program preloads the most common libs and programs and helps with application startup.

sudo apt-get install preload

Disable IPv6

I don’t need IPv6, yet, and disabling it has given me some improvements to my networking

sudo gedit /etc/modprobe.d/aliases

Change the line:
alias net-pf-10 ipv6
to:
alias net-pf-10 off

Now comment out all the lines that has to do with Ipv6 in your hosts file.
sudo gedit /etc/hosts

Grub and fstab

If youre using ext3 as your files system, adding noatime and data=writeback flags will help with system performance. Make the following change:

sudo gedit /etc/fstab

# /dev/md0
UUID=f4d4d73d-4141-4701-a7e2-ec41664483a7 / ext3 defaults,errors=remount-ro 0 1

into this:

# /dev/md0
UUID=f4d4d73d-4141-4701-a7e2-ec41664483a7 / ext3 defaults,errors=remount-ro,noatime,data=writeback* 0 1

Add writeback to the grub defaults.

sudo gedit /boot/grub/menu.lst

And add rootflags=data=writeback to defoptions and altoptions:

# defoptions=quiet splash rootflags=data=writeback
# altoptions=(recovery mode) single rootflags=data=writeback

Save and close, and type the following command in the console:
sudo update-grub

Next time the system boots the changes will take effect. You can also enable writeback without rebooting, but to make the changes permanent you’ll need to make the changes to fstab and grub.

sudo tune2fs -o journal_data_writeback /dev/md0

XvMC NVIDIA

The biggest performance enhancement for MythTV is enabling the XvMC nVidia library.

sudo gedit /etc/X11/XvMCConfig
change the line to libXvMCNVIDIA_dynamic.so.1

In the mythfrontend setup choose Standard XvMC and BOB or linear blend for deinterlacing.

Nvidia Settings

Lastly, a few nvidia options. This often helps with buffering and screen-splitting

sudo nvidia-settigns
disable “Sync to VBlank” in three locations.