Object Databases
Ng Pheng Siong
ngps at post1.com
Thu Mar 2 11:08:11 EST 2000
In article <3dk8jnd5un.fsf_-_ at amarok.cnri.reston.va.us>,
akuchlin at mems-exchange.org (Andrew M. Kuchling) wrote:
> 2) ZODB. Pro: very natural for Python users; very flexible.
> Downsides: only one database at a time; doubtful scalability once you
> start pushing lots of 5Mb images into it.
Not necessarily one database at a time:
import ZODB
import ZODB.FileStorage
def new_odb(fs):
conn = ZODB.DB(ZODB.FileStorage.FileStorage(fs)).open()
get_transaction().commit()
return conn
def commit():
get_transaction().setUser('ngps')
get_transaction().commit()
def put2():
c1 = new_odb('c1.fs')
c2 = new_odb('c2.fs')
r1 = c1.root()
r2 = c2.root()
r1['A'] = 'AAA'
commit()
r2['a'] = 'aaa'
commit()
r1['B'] = 'BBB'
commit()
r2['b'] = 'bbb'
commit()
c1.close()
c2.close()
Tranalyzer reports thusly:
/usr/local/home/ngps/zope:$ ./tranalyzer.py c1.fs
TID: 332C81A7229C777 obs 1 len 139 By [Zope]
"initial database creation"
OID: 0 len 57
TID: 332C81A7234B3AA obs 1 len 140 By / ngps
""
OID: 0 len 77
TID: 332C81A7234B3AB obs 1 len 151 By / ngps
""
OID: 0 len 88
****** TRUNCATED TRANSACTION at 315:
TID: 332C81A7234B3AB obs 1 len 151 By / ngps
""
OID: 0 len 88
I'm too lazy to cook up a multi-threading test program for the
above. Perhaps you may wish to try...?
(I envisage a Zope product that writes to local ZODB, instead of
var/Data.fs. We shall see if that is feasible...)
As noted by Jim Fulton on the Zope list, cross-referencing and
some other issues exist. If your object space partitions nicely,
this might not be that big a problem.
High transaction rates involving 5Mb images will likely cause
difficulties for RDBMS's, too. (The usual tricks involve storing
the raw data out of the DB.) I have insufficient experience
to offer anything beyond that opinion. ;-)
Cheers.
--
Ng Pheng Siong <ngps at post1.com> * http://www.post1.com/home/ngps
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list