low-end persistence strategies?

Jamey Cribbs jcribbs at twmi.rr.com
Wed Feb 16 22:47:13 EST 2005


Paul Rubin wrote:
> Jamey Cribbs <jcribbs at twmi.rr.com> writes:
> 
>>Either of these server scripts would have to be running as a process
>>either on your web server or on another server on your network in
>>order for them to work.  I don't know if that would be an issue for you.
> 
> 
> Yes, that's the whole point.  I don't want to run a server process 24/7
> just to look up two or three numbers a few times a day.

Ok, I see your point now.  Well, this is off the top of my head, I 
haven't tried it, but I think you could just use KirbyBase embedded in 
your cgi script and it should work fine.  I'm kind of thinking out loud 
about this, but, let's see, if you had two user's simultaneously 
accessing your web site at the same time, that would be two instances of 
your cgi script.  If they are just looking up data, that would be two 
reads that KirbyBase would be doing against the same physical file.  It 
just opens files in read mode for that so that should work even 
concurrently.

The only time there might be trouble is if two clients try to write to 
the same table (physical file) at the same time.  When it writes to a 
file, KirbyBase opens it in append mode (r+, I think).  My guess would 
be, whichever client got there first would open the file.  The second 
client, arriving a split second later, would attempt to open the file in 
  append mode also and KirbyBase would return an exception.  If your cgi 
script caught and handled the exception, you would be fine.

Again this is off the top of my head after a long day, so I can't be 
held responsible for my ramblings.  :)

Jamey



More information about the Python-list mailing list