i didn't pay attention to the full initial description, but have you tried tweaking with gdbm_setopt? you can change cache sizes and other flags that might impact your performance. i had a similar situation and changing the cachesize option made all the difference.