Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| dirhashdynamicmemory [2008/10/07 19:51] – NickBarkas | dirhashdynamicmemory [2009/07/07 10:17] (current) – NickBarkas | ||
|---|---|---|---|
| Line 11: | Line 11: | ||
| ===== Plan ===== | ===== Plan ===== | ||
| - | * Either change dirhash memory allocation to use buffer cache, or keep existing memory allocation model but register new callback function to free older dirhashes when vm_lowmem events occur. | + | * Either change dirhash memory allocation to use buffer cache, or keep existing memory allocation model but register new callback function to free older dirhashes when vm_lowmem events occur. |
| - | * Once code works reasonably well in my own tests, call for testing from the community to shake out more bugs if possible. | + | * Once code works reasonably well in my own tests, call for testing from the community to shake out more bugs if possible. |
| - | * Test for performance differences with dynamic dirhash vs. static under different work loads (e.g. huge maildirs, subversion fsfs repositories with a great many revisions, different amounts of memory in machine, etc.) | + | * Test for performance differences with dynamic dirhash vs. static under different work loads (e.g. huge maildirs, subversion fsfs repositories with a great many revisions, different amounts of memory in machine, etc.). **Done** |
| - | * Get code in a state suitable for being committed to -CURRENT | + | * Get code in a state suitable for being committed to -CURRENT. **Done** |
| - | * (Time permitting) Begin work on on-disk directory indexing in UFS2. | + | * (Time permitting) Begin work on on-disk directory indexing in UFS2. **Not done** |
| ===== Status ===== | ===== Status ===== | ||
| - | I blog about this project [[http:// | + | I blogged |
| (2008-6-19) I am working on implementing a function to be registered with EVENTHANDLER_REGISTER() for vm_lowmem events that will free dirhashes. I am trying to determine how to decide which hashes to free, and will need to find how many should be freed each time this event occurs. Determining the latter might be easiest through trial and error, watching how often vm_lowmem events pop up when the system is low on memory. | (2008-6-19) I am working on implementing a function to be registered with EVENTHANDLER_REGISTER() for vm_lowmem events that will free dirhashes. I am trying to determine how to decide which hashes to free, and will need to find how many should be freed each time this event occurs. Determining the latter might be easiest through trial and error, watching how often vm_lowmem events pop up when the system is low on memory. | ||
| Line 29: | Line 29: | ||
| (2008-8-14) Updated patches again. Now there are two: one against HEAD {{dirhashdynamicmemory/ | (2008-8-14) Updated patches again. Now there are two: one against HEAD {{dirhashdynamicmemory/ | ||
| - | ===== Benchmarks ===== | + | (2008-10-8) Results about a whole bunch of new benchmarks are added below. Also, the dirhash code for 8-CURRENT has been updated in perforce to work with some new changes made to the dirhash code in SVN. New patch: {{dirhashdynamicmemory/ |
| - | ==== With and without vm_lowmem handler ==== | + | (2008-11-19) My [[http:// |
| - | Here is a comparison of the speed running a number of different tasks that are fairly filesystem intensive with and without my dirhash | + | (2009-7-7) I committed |
| + | |||
| + | ===== Benchmarks ===== | ||
| - | | | mean run time - no vm_lowmem handler | std. deviation - no vm_lowmem handler | mean run time - with vm_lowmem handler | + | I measured the performance of the changes I made to the dirhash code using a Python script that does a number of different operations on large directories, |
| - | | postmark | 2378s | 16s | 2327s | 77s | | + | |
| - | | portsnap extract | 312s | 55s | 315s | 57s | | + | |
| - | | tar extract | 505s | 1,8s | 498s | 5,5s | | + | |
| - | | svn checkout | 1084s | 131s | 1023s | 16,7s | | + | |
| - | | rm -rf ports | 76s | 3,7s | 78s | 1,5s | | + | |
| - | | make buildworld | 4373s | 2,3s | 4382s | 23s | | + | |
| - | | rm -rf src | 115s | 6,5s | 115s | 9,1s | | + | |
| - | | rm -rf svnroot | + | |
| - | postmark was run with 1 000 000 files, 500 subdirectories, | + | I ran the tests on both %%FreeBSD%% |
| - | The difference in run times was not significantly different with the two versions of code. During the postmark and portsnap | + | The hardware used for all tests has a 1.8GHz Intel Core 2 Duo, 1GB memory, and a 3.5" 80GB 7200 RPM IDE hard drive. The maildirs are extracted, have messages added, |
| - | ==== Different vfs.ufs.dirhash_reclaimage values | + | Each battery of tests is run 5 times for a number of different dirhash settings. Using a kernel without my patch, tests are run with the maximum dirhash memory usage at the default 2MB and 64MB. With the kernel containing the vm_lowmem handler patch, 64MB is used across the board but the dirhash_reclaimage |
| - | On the same system I also ran a series of tests with various different values for the length of time a dirhash can be unused before a vm_lowmem event will result in it always being deleted. All times are in seconds: | + | ==== FreeBSD 7.0 Results ==== |
| - | | reclaim age: | 0 seconds | 1 second | 2 seconds | 5 seconds | 10 seconds | 30 seconds | 60 seconds | | + | {{dirhashdynamicmemory/ |
| - | | tar extract mean time | 863,13 | 835,40 | 901,71 | 860,43 | 878,11 | 897,49 | 901,84 | | + | {{dirhashdynamicmemory/ |
| - | | tar extract std. deviation | 24,4 | 3,67 | 10,32 | 8,11 | 11,80 | 4,50 | 6,84 | | + | {{dirhashdynamicmemory/ |
| - | | svn log mean time | 107,95 | 108,08 | 107,75 | 106,76 | 107,50 | 106,63 | 107,19 | | + | {{dirhashdynamicmemory/ |
| - | | svn log std. deviation | 0,94 | 0,98 | 1,98 | 1,79 | 0,71 | 1,09 | 1,30 | | + | {{dirhashdynamicmemory/ |
| - | | rm mean time | 14,83 | 14,39 | 14,87 | 16,56 | 17,41 | 23,84 | 26,24 | | + | {{dirhashdynamicmemory/ |
| - | | rm std. deviation | 1,09 | 0,56 | 0,48 | 3,51 | 2,55 | 3,01 | 2,19 | | + | {{dirhashdynamicmemory/ |
| - | | bonnie++ mean time | 682,04 | 639,01 | 761,93 | 721,40 | 779,59 | 801,76 | 807,29 | | + | {{dirhashdynamicmemory/ |
| - | | bonnie++ std. deviation | 60,86 | 59,27 | 33,77 | 30,37 | 32,60 | 22,81 | 18,14 | | + | |
| - | While running these tests I ran a second program that continuously allocated and freed memory at random intervals, in 100MB chunks. This forced vm_lowmem events to be raised rather frequently. The bonnie++ tests ran four at a time. Each bonnie++ was run with arguments "-n 500:0:0:500 -s 0 -r 2048" to do only file creation tests, and use ~500 000 files in 500 sub directories. The tar, svn, and rm tests ran one at a time, but they were started as soon as the four bonnie++ runs were kicked off in the background. The tar extraction test is the same as above using the %%FreeBSD%% subversion repository copy. svn log is the time to run svn log on the extracted repository. The rm time is just the time to rm -rf the extracted svnroot directory. This suite of tests was run four times for each of the different reclaim age values. | + | ==== FreeBSD |
| - | I was surprised to find that having the reclaim age very low led to the best performance. Reducing it all the way down to 0 was not optimal, though. I plan to next run a different series of tests using a range of reclaim age values again, but this time I'll try to simulate a more realistic work load. Instead of running a background process that randomly allocates and frees up huge chunks of memory, which probably isn't very realistic, I will run a series of tests that should stress dirhash usage while also using enough memory to raise vm_lowmem events on their own in a hopefully more natural way. I also plan to test different values for the minimum amount of memory to free on each vm_lowmem event (currently 10% is hard coded in). | + | {{dirhashdynamicmemory/ |
| + | {{dirhashdynamicmemory/ | ||
| + | {{dirhashdynamicmemory/ | ||
| + | {{dirhashdynamicmemory/ | ||
| + | {{dirhashdynamicmemory/ | ||
| + | {{dirhashdynamicmemory/ | ||
| + | {{dirhashdynamicmemory/ | ||
| + | {{dirhashdynamicmemory/ | ||