8 Aug 23:17
Re: fleeing sql
From: David McNab <rebirth <at> orcon.net.nz>
Subject: Re: fleeing sql
Newsgroups: gmane.comp.db.metakit
Date: 2007-08-08 21:17:49 GMT
Subject: Re: fleeing sql
Newsgroups: gmane.comp.db.metakit
Date: 2007-08-08 21:17:49 GMT
On Wed, 2007-08-08 at 12:34 -0700, abused by speech recognition wrote:
> If I remember correctly, metakit is multi-reader single writer right?
> since I need multi-writer, guess I'm best solving that with embedding
> metakit in a server using internal access locks? does metakit work in
> a python multi threaded environment either as multi thread access or a
> single thread fed by multiple request threads/
>
> thanks for any feedback
In a python single-process multi-threading environment, I'm sure that
metakit could be made to work well, even if you have to surround the
access statements in each thread with .acquire() and .release() of a
threading.Lock object.
I'm also interested in a multi-process scenario, such as CGI-based web
server. This could be made to work well by tuning the http
request/response cycle:
- create a metakit.storage() object at start of the http response
cycle, with the database open in read mode
- for a very small part of the http response cycle:
- acquire a file lock on the metakit database file
- create another metakit.storage() object on the file, this one
with the database open in read/write mode
- perform all needed write operations
- commit() the the read-write storage object
- del the read-write storage object
- release the file lock
- continue with the rest of the http response cycle, using the
read-only instance of the storage object
The smaller the 'write window', the less the performance impact in a
busy server environment.
My questions on this scenario:
- would it work?
- would there be any problems with having two different metakit.storage
objects open at the same time in the same process, one with readonly
access and one with read/write access?
- how would it compare, performance-wise, to a DB built for concurrency
such as MySQL?
Cautions with this approach:
- all View and row objects acquired from the read-write storage object
would have to be freed (ie, not stored in any object instances or
globals or closure-locals spaces) prior to doing the commit
Metakit can offer significant speed and simplification over *SQL
databases. Mk4Py allows a friendly object interface to views and rows,
where to get the same for *SQL databases, one needs to load in something
like SQLObject, which is hugely expensive.
I would be interested in people's thoughts on all this.
Cheers
David
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "metakit" group.
To post to this group, send email to metakit <at> googlegroups.com
To unsubscribe from this group, send email to metakit-unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/metakit?hl=en
-~----------~----~----~----~------~----~------~--~---
RSS Feed