-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathNOTES.txt
75 lines (53 loc) · 2.78 KB
/
NOTES.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Notes
=====
Frequently asked questions
--------------------------
This section lists frequently asked questions.
#) How is Dobbin different from ZODB?
There are other object databases available for Python, most notably
`ZODB <http://www.zodb.org/>`_ from Zope Corporation.
Key differences:
- Dobbin is written 100% in Python. The persistence layer in ZODB
is written in C. ZODB also comes with support for B-Trees; this
is also written in C.
- Dobbin is available on Python 3 (but requires a POSIX-system).
- ZODB comes with support for B-Trees which allows processes to
load objects on demand (because of the implicit weak
reference). Dobbin currently loads all data at once and keeps it
in memory.
- Dobbin uses a persistence model that tries to share data in
active objects between threads, but relies on an explicit
operation to put an object in a mode that allows making changes
to it. ZODB shares only inactive object data.
- ZODB comes with ZEO, an enterprise-level network database layer
which allows processes on different machines to connect to the
same database.
- ZODB comes with a memory management system that evicts object
data from memory based on usage. Dobbin does not attempt to
manage memory consumption, but calls upon the virtual memory
manager to swap inactive object data to disk.
#) What is the database file format?
The default storage option writes transactions sequentially to a
single file.
Each transaction consists of a number of records which consist of a
Python pickle and sometimes an attached payload of data (in which
case the pickle contains control information). Finally, the
transaction ends with a transaction record object, also a Python
pickle.
#) Can I connect to a single database with multiple processes?
Yes.
The default storage option writes transactions to a single file,
which alone makes up the storage record. Multiple processes can
connect to the same file and share the same database,
concurrently. No further configuration is required; the database
uses POSIX file-locking to ensure exclusive write-access and
processes automatically stay synchronized.
#) How can I limit memory consumption?
To avoid memory thrashing, limit the physical memory allowance of
your Python processes and make sure there is enough virtual memory
available (at least the size of your database) [#]_.
You may want to compile Python with the ``--without-pymalloc`` flag to
use native memory allocation. This may improve performance in
applications that connect to large databases due to better paging.
.. [#] On UNIX the ``ulimit`` command can be used limit physical memory
usage; this prevents thrashing when working with large databases.