> On May 7, 2015, at 7:29 AM, Ken Courville <[email protected]> wrote:
> 
> So far, it looks like using Singleton for Manager and just always calling 
> "getDatabase()" works.  I suspect that Database expects to have one instance 
> per thread, and the Manager takes care of that.

Not exactly; each Manager will create one and only one Database instance for a 
physical database. In other words, getDatabase is idempotent (returns the same 
object every time you call it.) But if you created multiple Managers, each one 
would return a different Database object for the same database.

Under the hood there is only limited performance benefit to creating multiple 
Managers or Databases. You’ll get more parallelism for CPU-bound activity, but 
the SQLite database file has its own locks and (on iOS and Android at least) a 
write transaction blocks all other transactions, including reads, until it 
completes. (Part of the benefit of ForestDB is that it supports simultaneous 
reads and writes.)

—Jens

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/4BE3EA0F-547C-4F9A-9AC2-AA7F52716158%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to