The Ts2ki Global Server Data Defragmentation Utility
(Ts2ki Unfrag)
 
What is Ts2ki Data Fragmentation and why do I need to be concerned with it?
If you know the answer to this question just skip to the next section but if you don't know the answer please read on.  When a database becomes slow it is usually assumed to be due to having more data than it previously had.  This may be true but the real reason for degraded performance may be data fragmentation.  A database is similar to a deck of cards except with a lot more cards.  For instance, for every gigabyte of Ts2ki data there are about a million "cards" or blocks of data.  Each of these data blocks contains certain amounts of data about a certain symbol.  When playing cards, you usually organize your "hand" by card suit and card sequence.  When you get a lot of cards in your hand arranging the cards becomes more of a problem so you can imagine what trying to keep track of millions of "cards" would be like.  For this reason databases use Index files which are basically "cheat sheets" which tell where a record is located in the database.  This makes data management much easier because the Index file only takes up about 5% of the total size of the data.  So, instead of physically moving data around, the data pointers are just changed in the Index file.  This is fine from a file management standpoint but one data block my be near the start of the file and the next logical data block may be near the end of the file so the disk head has to go to the start of the file to obtain the first block of data and then to the end of the file to obtain the second block of data .  Not only does this add an unnecessary amount of work to the disk but it increases the amount of time it takes to obtain the data.  The Ts2ki Data Defragmentaion Utility (Unfrag) re-writes the Ts2ki data files so that the data is stored in a logical order which minimizes disk workload and speeds up data access. 
 
If I perform Ts2ki Data Defragmentation do I need to be concerned with disk fragmentation?
In short, the answer is yes.  The Ts2ki Unfrag utility sequences the blocks of data optimally within the data file but that file consists of multiple disk data clusters each containing multiple file data blocks and as in the prior case, the first disk cluster for the file may be near the start of the disk and the next cluster located near the end of the disk.  The keywords here are File for Ts2ki Unfrag and Disk for the Disk Defragmenter - two different programs for two different requirements.  The bottom line is that both the Ts2ki Unfrag utility and a Disk Defragmenter should be used with the Ts2ki Unfrag utility run first and the the Disk Defragmenter afterwords.
 
The Ts2ki Unfrag Utility
The Ts2ki Unfrag utility must be installed in a folder which can both be read from and written to and can only be run with the Global Server shut down.  The Ts2ki Data Defragmentation Utility (Unfrag) provides the user with a full evaluation of the amount of data file fragmentation in his system (for free) and when registered, provides the user the capability to unfragment all data files. 
 
The Ts2ki Unfrag program is a "try-before-you-buy" utility but more than an adequate amount of functionality is retained in the unregistered version for the user to evaluate his system and the value the utility could provide. The only difference between the unregistered and registered versions is that the user is prevented from selecting to write all new unfragmented files. 
 
The Ts2ki Unfrag start up screen is shown below prior to registration (license purchase) on the left and after registration on the right. 
 
 
 
Always Backup your Global Server data before running Ts2ki Unfrag because you could lose power or many unimaginable things could happen during the Unfrag process and your Global Server data might not be recoverable.  The best way to backup is to copy the entire Server folder and paste it to another disk drive.  You could rename the pasted Server folder to better identify it as shown.    Using this backup method or any other method which uses another drive for backup minimizes the need for disk free space requirements on the Global Server drive during the Unfrag operation.  There still will be a disk free space requirement of the size of the largest single Global Server data file.  If you have more disk free space on your Global Server drive than the total size of all the Global Server data files then you can use the Local Data Backup option.    Placing a check mark in the selection box will save all the current Global Server files as backup files on the Global Server drive.  It must be noted that only the latest set of Global Server files will be saved so if you run Unfrag multiple times only the latest set of files will be saved.
 
The program was used to unfragment a 20 GB data base and I was extremely surprised to see the huge amount of fragmentation involved.  The Ts2ki Unfrag program uses a calculated value called "Fragment Factor" to indicate amount of data fragmentation.  The value is calculated by adding the distances the disk head must travel to obtain each data block.  For instance, if the first data block were near the start of the file, the second were near the end of the file and the third again near the start of the file, the disk head would have to move from the start of the file to the end of the file and back to the start again.  This would be approximately three times the total disk head travel required for an unfragmented file.  With data files running in the millions of data blocks, it is easy to see why data fragmentation gets so large.  The following shows actual data which to me is shocking with respect to "Fragment Factors".
 
                                                                      
                                         
It should be noted here that the initial fragmented file was 2,557.5 MB in size and the re-written unfragmented file was only 1,469.1 MB in size indicating that there was slightly over 1 GB of unused space in the file.  A fact to be noted here is that Ts2ki files only grow larger, they never get smaller unless a program like Ts2ki Unfrag is used. 
 
The extremely interesting fact is that the disk head for the fragmented file had to travel 25,745 times as far as the disk head on the equivalent unfragmented file.  This means that if all the data in the file were requested in a logical order, the disk head for the fragmented file would have to move over 25,000 times as far as the disk head for the unfragmented file.  It is no wonder the disk appeared "slow". 
 
I would not be too concerned about "Fragment Factors" of 100 or even several hundred because the disk buffer tends to mitigate these factors to some extent.  However, any "Fragment Factors" over 1,000 should be considered excessive and should be corrected.  
 
It should also be noted that it took 1 minute and 15 seconds to read the file, 7 seconds to sort the file data into the proper unfragmented sequence and determine the Fragment Factor.  However, the big time consumer was re-writing the unfragmented file which took a little over 42 minutes.  Future Ts2ki Unfrag times should be considerably less due to less initial fragmentation which the following full Ts2ki Unfrag report summary dramatically points out.
 
A summary of the first Ts2ki Unfrag Run on the complete 20 GB Data-set is as follows:
    Initial Size: 20,853 MB
    Unused Space: 6,308.8 MB
    Total Ts2ki Unfrag Process Time = 230.2 minutes (3 hours and 50 minutes)
    An additional 90 minutes was required for the Global Server to re-build the Index files
 
After Re-booting the PC, another Ts2ki Unfrag Run was made on the Unfragmented Data-set to show the effects of data fragmentation
    Initial Size: 14,545 MB
    Unused Space: 0.0 MB
    Total Ts2ki Unfrag Process Time = 23.5 minutes (almost a 10:1 decrease)
    Again, an additional 90 minutes was required for the Global Server to re-build the Index files
 
Note that the Global Server re-index time is the same for both cases above.  The way the Global Server works is if any files are changed, all files are re-indexed.  Depending on the size of your data-set, the 90 minutes will be different but if even one file is unfragmented all index files will be re-built by the Global Server and you need to know approximately how long that re-index is and take that time into account.
 
The initial Ts2ki Unfrag runs will take as little as 10 minutes to possibly 5 or 6 hours or more depending on the size of the GS data and the amount of Fragmentation.  The Ts2ki Unfrag program has been designed to perform partial defragmentations as time permits.  As shown below, if the approximate amount of time the Global Server will require to re-build Index files is known, an "Exit Time" may be selected which could stop the Unfrag process and if so enabled, auto start the Global Server for re-building the Index files.  This could be set up prior to going home and the Global Server would be collecting data when you arrive the next morning.  Using this method, as many files as time permits could be unfragmented during one session, a few more the next until all have been unfragmented.  Since Ts2ki Unfrag works on a file by file basis, aborting the program will only result in losing unfragmented data for the file currently being processed.  Aborting the Ts2ki Unfrag program will not lose any of the original data.  In fact, if the "Local Data Backup" is checked all of the the original data is saved as a backup until the user elects to delete it or starts another "Unfrag" session - note the "Restore Backups" and "Delete Backups" buttons on the Ts2ki Unfrag screen.  
 
                                                                     
 
It is recommended that the Ts2ki Unfrag utility be run periodically with the "Write Unfragmented Files" unchecked which will show the amount of data file fragmentation with a minimum amount of Global Server "down time".  Once the amount of fragmentation is deemed excessive, the systems can be scheduled for a complete unfragmented file re-write.
 
Each time an unfragment process is performed either to determine the amount of file fragmentation or to actually re-write the files a log of all activities plus the system configuration is saved in a log file ("Unfrag-Log.txt" and also as "Unfrag-Log mm-dd-yyyy hh.mm.ss.txt").  This Unfrag-Log will always be the first entry when the "View Unfrag Report" menu item is selected.  The Unfrag Logs will be listed chronologically with the most recent shown first as is shown in the following:
 
                                          
 
The most recent 15 Logs are retained and older Logs are deleted unless the file attribute has been changed to "Read Only".
 
The Unfrag utility must be run when it can be the only application which is using the Global Server files.  The utility keeps all Global Server files open during most of the process time so that the files are for the exclusive use of the utility and other applications are unable to interfere.  If any applications do interfere with the Unfrag process one of the following images should be displayed.  If any of these images are displayed or any interference noted, the Unfragment process should be considered compromised and backup data should be restored. 
                                                       
             
 
Registering the Utility
If you decide that the Ts2ki Unfrag utility would be a valuable addition to your system, just send an e-mail to  Support@BobScottSystems.com or Bob_Scott_Systems@Yahoo.com  and either attach a copy of the Unfrag-Log to the e-mail or select all and copy and paste the contents of the log into the e-mail.  Each copy of Ts2ki Unfrag is registered to a specific computer (actually motherboard) so if you decide to register we will need the computer information which is contained in the log.
 
License Pricing has been apportioned to the size of the Global Server data so that users with lesser amounts of data can benefit from the using the utility at a reasonable price. 
 
                                         
 
When registered, you will receive an activation Key Code and this can be copied and pasted into the Registration screen.  The "PC Description" may contain any desired information as the only intended use is to allow the user to more easily differentiate between registration files.                
 
                             
 
                             
                                               
The Ts2ki Unfrag Utility is well matched to the needs of the user and should make a very valuable addition to the Ts2ki tools.
 
If you find any problems or have any questions please contact:   Support@BobScottSystems.com or Bob_Scott_Systems@Yahoo.com
 
Last Updated: 6/30/2010