mvBase files use a hash-encoding scheme to allow fairly direct access to any item in a file without searching through the entire file. The success of the hash-encoding, and thus the speed of access to any item, depends on a number of related factors, including the type of item in the file, the size of the average item and of the largest and smallest items, and the structure of the file.
mvBase allows you to improve access speed by adjusting the file modulo. The modulo determines the number of groups in which items will be stored. It affects speed of access in two ways.
First, the modulo is used directly in the hashing algorithm which transforms the keys. The modulo should be a prime number to ensure an even distribution of items.
Second, because it specifies the number of groups, the modulo determines the number of items that are typically stored in each group (the group depth). The group depth is a function of the total number of items divided by the modulo. For example, if the number of items is 808 and the modulo is 101, the group depth is estimated to be 8. The modulo should be sufficiently large such that the expected number of items in a group fits in the frame allocated for the group.
Designers of mvBase files should try to estimate the total number and size of items that the file will contain when they are creating the file. However, files have a tendency to grow beyond their designers’ expectations, and therefore you should check the size and efficiency of important files and reallocate space for them when necessary.
The following topics are presented in this section:
Tools for Checking File Efficiency
Examining Groups in Closer Detail
See Also