I have also seen situations where I'm iterating (cursor) through an LMDB database, apparently slow at first. Then magically, if I wait a while, it keeps getting faster and faster. It's almost as if the OS can predict I have intentions of reading more from this database and decides to go ahead and memory map more ahead of time. Have you seen this happen? Do OSes really tend to do these things?

Regards,
Sam

Oct 24, 2022, 22:47 by hyc@symas.com:
Sam Dave wrote:
Hi,

If my program reads through an LMDB database apparently slow at first run, but suddenly runs much quicker at the second run (which does exactly the same thing),
can't I already say with confidence that my choice of LMDB - in this case its builtin memory mapping functionality - is already paying off in terms of read speeds?

I mean, that alone (exact same thing runs much faster the second time) already PROVES that the bottleneck was reading from disk as opposed to memory, right? I'm
looking for excuses for patting myself on the back for investing in LMDB.

Yes, the OS has cached the data in memory.

Regards,
Sam


--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/