Performance Tuning Hard Drives

PokerTracker 3 version 3.10
October 25, 2013
  • Introduction

    One of the things which can often cause slowdowns in PT3 usage is the amount of time to read from and write to the hard drive.

    As such, we've compiled a list of things you can do which may speed up hard drive access times based on tweaking a few settings with your hard drive.

    This guide will be split up by filesystem type. If you are running Microsoft Windows, you are almost certainly using the NTFS filesystem. PostgreSQL would complain when installing the Windows version on a non-NTFS filesystem, so if you had no problem installing PostgreSQL, you can safely assume you are using NTFS.

    Performance gains will vary from system to system, and as such cannot be easily calculated here. However, I can say that by following the ext3 (Linux) tips, I personally saw import performance increase by a little over 40%.

    --Kraada

  • NTFS (Windows)

    There are several different steps you can take to optimize NTFS. You can do some or all of the below, and if you do not like the result, you can always change it back if need be.

    Please note: You need to reboot after taking these steps before you can see any performance gains.

    • Defragment Your Hard Drive

      Defragmenting your hard drive takes files which may be written in severeal different physical locations on the hard drive and puts them together in one spot. This will increase performance when reading the hard drive as the head does not need to move as far in order to read the rest of the file. It is recommended to defragment your hard drive occasionally.
      Please note: if you write data to the hard drive during the defragment procedure, the progress may be lost and the program may need to begin again. Please make sure to leave a significant chunk of time for defragmentation in which you are not using your computer for anything else.

      You should also make sure that the PostgreSQL server is not running before attempting to defragment your hard drive. You can stop the PostgreSQL service by clicking Start --> Programs --> PostgreSQL --> Stop Services. After the defragment has finished, you can restart it by clicking Start --> Programs --> PostgreSQL --> Start Services.

      In Windows XP: Open My Computer, right click on the disk you would like to defragment and click "Properties". Click on the "Tools" tab and click "Defragment Now". Then click "Defragment" to begin defragmenting your hard drive.

      In Windows Vista: Click Start --> All Programs --> Accessories --> System Tools --> Disk Defragmenter. Click "Defragment Now" to begin defragmenting your hard drive.

    • Disable Last Access Time Support

      By default whenever you access a file in NTFS the filesystem writes to the drive the time at which you accessed the file. When accessing a large number of files, and writing small bits of data in lots of different places, updating all of the access times can be burdensome and slow down performance. Disabling this feature will cause NTFS to no longer write the time at which you access a file when you do.

      Please note: disabling this feature can cause problems for some automated backup systems. If you are using an automated backup system, please check to make sure it functions properly with this support disabled, as we assume no responsibility for lost data in the event of a failed backup as a result of changing this setting.

      To disable last access time support, click Start --> Run, type 'cmd' and hit enter. Then type:

      fsutil behavior set disablelastaccess 1

      To re-enable last access time support in the event of any issues, click Start --> Run, type 'cmd' and hit enter. Then type:

      fsutil behavior set disablelastaccess 0
    • Enlarge Write-Ahead Cache

      Windows gives the NTFS filesystem a default cache to use for information, but if you are opening and closing a lot of different files in rapid succession, this cache can be exhausted, causing reads and writes to take longer than necessary. There are two setting sizes: normal, and large. From the Microsoft Documentation:

      Increasing physical memory does not always increase the amount of paged pool memory available to NTFS. Setting memoryusage to 2 raises the limit of paged pool memory. This might improve performance if your system is opening and closing many files in the same file set and is not already using large amounts of system memory for other applications or for cache memory. If your computer is already using large amounts of system memory for other applications or for cache memory, increasing the limit of NTFS paged and non-paged pool memory reduces the available pool memory for other processes. This might reduce overall system performance.

      To set the cache to its larger size, click Start --> Run, type 'cmd' and hit enter. Then type:

      fsutil behavior set memoryusage 2

      In the event of any issue, or degradation of performance as a result of this change, you can set the cache back to its normal size. To revert to the default configuration, click Start --> Run, type 'cmd' and hit enter. Then type:

      fsutil behavior set memoryusage 1
    • Disable Legacy Filename Support

      Legacy filename support creates an alias for every long (> 8 characters) file you create with an 8.3 format (8 character name, 3 character extension). This will likely not bring large performance gains to PT3 and PostgreSQL, however if you have a large number of files in a single directory whose filenames all begin similarly you can run into performance issues because of this. Legacy filenames should only be used by old programs (programs created in the early Windows 98 era), so disabling legacy filename support should not cause problems either.

      To disable legacy filename support, click Start --> Run, type 'cmd' and hit enter. Then type:

      fsutil behavior set disable8dot3 1

      and press enter.

      To re-enable legacy filename support in the event of any issues, return to the command prompt as above and type:

      fsutil behavior set disable8dot3 0

      and press enter.

  • ext3 (Linux)

    These instructions are only for people using the ext3 filesystem in Linux. The following tips will not work in Windows.

    • Set Journal to Writeback Mode

      The ext3 journal defaults to writing in 'ordered' mode. From the ext3 FAQ:

      [Ordered mode o]nly journals metadata changes, but data updates are flushed to disk before any transactions commit. Data writes are not atomic but this mode still guarantees that after a crash, files will never contain stale data blocks from old files.

      Changing to 'writeback' mode can improve performance. Again from the ext3 FAQ:

      [Writeback mode o]nly journals metadata changes, and data updates are entirely left to the normal "sync" process. After a crash, files will may contain stale data blocks from old files: this mode is exactly equivalent to running ext2 with a very fast fsck on reboot.

      As a result, 'writeback' mode will perform better at a cost of potential data loss. If data integrity is critical, do not switch from ordered mode. However, if you have regular backups, and are willing to sacrifice the potential for getting stale data upon reboot after a crash, you can enable writeback mode for performance gains.

      Before attempting to enable writeback mode, please be advised performing these operations on a currently mounted hard drive can cause damage and data loss, if you need to perform these operations on the main system drive, you should use a live cd and perform the operations while booted to it (I prefer Knoppix, but you can use whichever you prefer.)

      To enable writeback mode type (as root):

      tune2fs -o journal_data_writeback /dev/X

      where X is the hard drive device and partition in question (hda1, sda1, etc.), then edit /etc/fstab (as root), and under the options section, add "data=writeback" and remount your drive. You can check to make sure that your drive has been mounted in writeback mode by typing:

      tune2fs -l /dev/X

      as root and looking at the Default Mount Options (it should say journal_data_writeback).

      To switch back to ordered mode type (as root):

      tune2fs -o journal_data_ordered /dev/X

      then remove the "data=writeback" from the appropriate /etc/fstab line.

    • Disable Last Access Time

      Like NTFS, ext3 also defaults to writing the time a file was last accessed at access time.

      The more files you access, and the less time between accessings, the more this can degrade performance.  If you for some reason need this information, or have scripts based on last access time, do not follow the below steps, as this information will no longer be available at that time.

      To disable last access time edit /etc/fstab as root and add:

      noatime,nodiratime

      to the options section of the hard drive in question.  Remount this device and last access time will be disabled.

      To reenable last access time, simply remove noatime and nodiratime where you added them and remount the drive.

    • Use Directory Indexing

      Directory indexing uses hashed binary trees to store directory information and is a recommended performance improvement.

      As root, type:

      tune2fs -O dir_index /dev/X

      where X is the hard drive device and partition in question (hda1, sda1, etc.). 

      Please note: this will only enable directory indexing for newly created directories.  To create an index for all previously generated directories, type:

      e2fsck -D -f /dev/X

      This may take some time to complete as it will have to go through your entire disk. Please be patient and allow it to finish.