Where did you see this?  It's inaccurate, and if I can, I'll remove it.  If
you want to use a proper asynchronous statement execution which wraps your
statement[s] in a transaction, you want to use this:
https://developer.mozilla.org/En/Storage#Asynchronously

Cheers,

Shawn Wilsher
Mozilla Developer

On Thu, Dec 31, 2009 at 8:53 AM, Bert Nelsen <bert.nel...@googlemail.com>wrote:

> Hello,
>
> I would like to make writes to my SQLite db faster.
>
> I was thinking about the Async method, but I think I remember reading
> somewhere that it may cause database corruption.
>
> Now I read something on the Mozilla pages, and I don't understand what
> exactely they are doing.
>
> Do they bundle everything in transactions only or do they in fact use the
> Async method?
> It is not clear to me by reading through their articles.
>
> It would be nice if somebody could clear me up on this issue.
>
> Here is the article:
>
> Lazy writing
>
> Mozilla has relaxed the ACID requirements in order to speed up commits. In
> particular, we have dropped durability. This means that when a commit
> returns, you are not guaranteed that the commit has gone through. If the
> power goes out right away, that commit may (or may not) be lost. However,
> we
> still support the other (ACI) requirements. This means that the database
> will not get corrupted. If the power goes out immediately after a commit,
> the transaction will be like it was rolled back: the database will still be
> in a consistent state.
>
> Higher commit performance is achieved by writing to the database from a
> separate thread (see
> storage/src/mozStorageAsyncIO.cpp<
> http://mxr.mozilla.org/mozilla-central/source/storage/src/mozStorageAsyncIO.cpp
> >
> which
> is associated with the storage service in
> storage/src/mozStorageService.cpp<
> http://mxr.mozilla.org/mozilla-central/source/storage/src/mozStorageService.cpp
> >
> ).
> The main database thread does everything exactly as it did before. However,
> we have overridden the file operations and everything comes through the
> AsnycIO module. This file is based on
> test_async.c<http://www.sqlite.org/cvstrac/rlog?f=sqlite/src/test_async.c
> >from
> the sqlite distribution.
>
> The AsyncIO module packages writes up in messages and puts them on the
> write
> thread's message queue. This write thread waits for messages and processes
> them as fast as it can. This means that writes, locking, and most
> importantly, disk syncs, only block the AsyncIO thread. Reads are done
> synchronously, taking into account unwritten data still in the buffer.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to