Optimise NTFS performance in Windows servers
Published: 04 Mar 2003 14:40 GMT
At the heart of your Windows NT or Windows 2000 server's file system is NTFS, short for the NT file system, the default file system for Microsoft Windows NT and 2000. NTFS controls where Windows NT/2000 locates files on the server's hard drive. It also controls security and access privileges for those files.
To get the most out of your server's hard drives, you must take NTFS into consideration. I'm going to show you how to wring the last drop of performance out of NTFS. I'll consider the importance of defragmentation, compression, naming schemes, and folder structure.
Optimising and improving NTFS
NTFS includes several features that can increase the performance of your system's hard disks:
- Cluster sizes -- This is the size of units of allocation on a hard disk.
- Standard defragmentation -- This rewrites the contents of noncontiguous data into contiguous sectors on the disk to increase read/write performance.
- MFT defragmentation -- The Master File Table (MFT) contains information about all the files and data stored on disk.
- Compression -- NTFS can compress files and folders stored on disk to an optimal size, maximising the available storage space.
- Naming configurations -- This represents the naming conventions you use when naming files and folders on your server.
- Folder structure -- This is the number of folders and subfolders and the number of files within those folders.
In the following sections, I'll show you how to use these features to tweak the performance of your server's hard disks and improve the overall performance of your network.
Cluster size does matter
Clusters are chunks of disk space used to organise data on a disk. The default cluster size is the smallest block of disk space that can hold a file. Versions of Windows NT later than version 3.5, including Windows 2000, won't use cluster sizes larger than 4KB for hard drives smaller than 16Terabyte (TB). This helps minimise the amount of overhead used to contain the file.
When a file is stored on a disk, it's written into clusters. If the file being stored exceeds the cluster size allocated to it, the file system uses additional clusters to store the file, consuming clusters until the file is stored. Naturally, files almost never fall neatly into multiples of 4KB. So when the file system uses additional clusters, the unused portion of the last cluster is lost to overhead.
For example, suppose that you have a 35KB file on your hard disk. The largest cluster size available is 4KB. Therefore, the file will use a total of nine clusters. Eight of those clusters will be a full 4KB in size. The ninth cluster will contain only 3KB of data, leaving 1KB completely wasted. If you had to store a thousand 35KB files, you'd lose 1MB of drive space.
Microsoft has developed an algorithm to estimate cluster size overhead. On the typical disk partition, the overhead algorithm looks like this:
(cluster size)/2 * (number of files)
So in the previous example, (4KB)/2 * 1,000, the equation would estimate that you'd lose 2 MB of disk space when you've only actually lost 1MB. The equation is wrong in this case because all of the last clusters are three-quarters full. The equation assumes that the average cluster will be half full.
Using smaller cluster sizes reduces the amount of space needed to store files. If you have an application that doesn't consume a lot of disk space but uses very small data files, you can more efficiently store data on a drive with smaller cluster sizes.
It is possible to set the cluster size when the drive is formatted (type Format /? from a command prompt for details), but Microsoft recommends that the cluster size is chosen to work with the partition size of the drive, and has set a default cluster sizes for any given partition size. A way to get a given cluster size, and still use the default cluster size is to choose the partition size which makes NTFS default to that cluster size. NTFS default cluster sizes are described in detail here but in summary are broken down as follows:
- 512 bytes: 0 MB to 512 MB
- 1KB: 513 MB to 1 GB
- 2KB: 1 GB to 2 GB
- 4KB: 2 GB+
So if your application uses small data files, but the total of those data files won't exceed 1 GB, you can more efficiently use your server's drives by placing the data on a drive with a 1 GB partition.
Full Talkback thread
1 comment






