Hi. I have a read heavy API that uses datalevin to cache data and encountered the MDB_READERS_FULL error. We're not using pmap but there can be hundreds of simultaneous requests. Based on this https://web.archive.org/web/20200112155415/https://twitter.com/armon/status/534867803426533376 it seems setting :max-readers to some high value like 4000 might be ok. Is there a heuristic that's worked out well? Given that the KV DBIs are independent of one another in my use case and this is a cache, is starting datalevin with the :nolock flag an option if I want to really press on read performance? I assume writes would still require a lock, but this would help avoid the MDB_READERS_FULL error. Also is the write lock database wide or per DBI?
Appreciate the suggestions and thanks for making and sharing datalevin!
I am glad that it is useful for you 😊
It is ok to set a higher max-reader. Since this is a per db file parameter, if it is possible, I would open multiple db files instead of multiple DBIs for multiple independent caches.
:nolock parameter is about the write lock. I wouldn’t touch it
Write lock is per DB file
Setting :temp? to true or adding :nosync flag is what increasing writing speed. Btw