"Giambattista Bloisi" <DONT (AT) SPAM (DOT) ME> wrote
Quote:
I have an application that has an HASH db where I make a lot of data
update for each record. Performance seems to be pretty good, but all
the update seems to be reported just in memory. When I use the sync
method after each update to synchronize them to the file, the db
became very slow (twice than gdbm). |
The sync method has to flush one, and possibly more database
pages, to disk. That means it's going to be slow.
I'm guessing your reason to flush the database to disk is to
ensure data durability (that is, to ensure that you don't lose
data when the application or system fails)? If durability is
what you want, you're only shrinking the window of possible data
loss by calling the sync method, you can still lose data if you
crash at the wrong time.
If you want durability, you should write a transactional
application, one that uses transactions to ensure durability,
not repeated calls to the sync method. In addition, a
transactional program will run much faster than calling sync
repeatedly.
Regards,
--keith
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Keith Bostic bostic (AT) sleepycat (DOT) com
Sleepycat Software Inc. keithbosticim (ymsgid)
118 Tower Rd. +1-781-259-3139
Lincoln, MA 01773 http://www.sleepycat.com