openzfsonwindows / ZFSin

OpenZFS on Windows port
https://openzfsonwindows.org
1.2k stars 69 forks source link

Periodically calling 'vmem_update' function to dynamically update vmem->vm_hash_table size #327

Closed arun-kv closed 3 years ago

arun-kv commented 3 years ago

Currently 'vmp->vm_hash_table' size is 16, due to which the lookup time is too high when the number of objects are more. We have seen ZFSin uninstallation taking more than (~30 min) when the arc usage is ~40GB. During the analysis we saw the while loop inside 'vmem_hash_delete' taking most of the time. prev_vspp = VMEM_HASH(vmp, addr); while ((vsp = prev_vspp) != NULL) { if (vsp->vs_start == addr) { prev_vspp = vsp->vs_knext; break; } vmp->vm_kstat.vk_lookup.value.ui64++; prev_vspp = &vsp->vs_knext; }

So enabled 'vmem_update' function to periodically call 'vmem_hash_rescale' to update the hash_table size every 60 sec. After the fix, vm_hash_table size is much bigger and the lookup time has been reduced considerably, also the uninstallation process is very fast.

imtiazdc commented 3 years ago

@lundman Could you merge this change please?

lundman commented 3 years ago

Ah so sorry for the delay