By default, multi threading for file system testing does not mean that multiple threads will be concurrently using the same file. All individual file operations are done single threaded. Other threads however can be active with different files.
This behavior can be overridden when specifying 'fileio=(random,shared)'.
默认情况下,文件系统测试的多线程并不意味着多个线程会同时使用同一个文件。所有单个文件操作都是单线程执行的。然而,其他线程可以使用不同的文件并行执行。
当指定'fileio=(random,shared)'时,可以覆盖这种行为。
Considering the complexity allowing directory creates, file creates, file reads and file writes against the same directory structure happening concurrently there are some pretty interesting scenarios that Vdbench has to deal with. Some of them:
-
Creating a file before its parent directory or directories exist.
-
Reading or writing a file that does not exist yet.
-
Reading a file that has not been written yet.
-
Deleting a file that is currently being read or written.
-
Reading a file that does not exist while there are no new files being created.
考虑到允许同时发生目录创建、文件创建、文件读取和文件写入对同一目录结构的情况,Vdbench必须处理一些非常有趣的情况。其中包括:
- 在其父目录或目录不存在时创建文件。
- 读取或写入尚不存在的文件。
- 读取尚未写入的文件。
- 删除当前正在被读取或写入的文件。
- 在没有新文件被创建的情况下读取不存在的文件。
When these things happen Vdbench will analyze the situation. For instance, if he wants to write to a file that does not exist, the code will check to see if any new files will be created during this run. If so, the current thread goes to sleep for a few microseconds, selects the next directory or file and tries again. If there are no file creates pending Vdbench will abort.
At the end of each run numerous statistics related to these issues will be reported in logfile.html and on stdout, with a brief explanation and with a count.
To identify deadlocks (which is an error situation and should be reported to me) Vdbench will abort after 10000 consecutive sleeps without a successful operation.
Note: there currently is a known deadlock situation where there are more threads than files. If you for instance specify 12 threads but only 8 files, 4 of the threads will continually be in the ‘try and sleep’ loop, ultimately when the run is long enough hitting the 10000 count.
Miscellaneous statistics example:
当发生这些情况时,Vdbench会进行分析。例如,如果它要写入一个不存在的文件,代码将检查此运行期间是否将创建任何新文件。如果是这样,当前线程将休眠几微秒,选择下一个目录或文件,然后重试。如果没有挂起的文件创建操作,Vdbench将中止。
在每次运行结束时,与这些问题相关的大量统计信息将在logfile.html和stdout中报告,并附有简要说明和计数。
为了识别死锁(这是一个错误情况,应该报告给我),Vdbench将在连续休眠10000次而没有成功操作时中止。
注意:目前存在一个已知的死锁情况,即线程数多于文件数。例如,如果指定了12个线程但只有8个文件,则其中4个线程将不断处于“尝试并休眠”循环中,在运行时间足够长时最终达到10000次计数。
各项统计示例:
13:28:35.183 Miscellaneous statistics:
13:28:35.183 DIRECTORY_CREATES Directories creates: 7810
13:28:35.183 FILE_CREATES File creates: 625000
13:28:35.183 WRITE_OPENS Files opened for write activity: 625000
13:28:35.184 DIR_EXISTS Directory may not exist (yet): 33874
13:28:35.184 FILE_MAY_NOT_EXIST File may not exist (yet): 94
13:28:35.184 MISSING_PARENT Parent directory does not exist (yet): 758
13:28:35.184 PARENT_DIR_BUSY Parent directory busy, waiting: 25510