From: jonathan <jricketson@ne...> - 2002-07-30 13:26:49
Hi, I have just started using webware and middlekit, and am essentially
experimenting and seeing whether I should convert an in development site to
use it instead of my home grown middleware. So I have a couple of questions
about how to use it.
1. To execute sql queries that don't fall into the object schema I am
Is this the recommended way??
2. Should I have global access to 'store', or should each module where it is
used create it's own store?? I noticed in the source for SQLObjectStore,
that new connections are created all over the place anyway. So would this be
much of a performance hit? how does everyone else do this??
3. In the experimental project that I am playing around with, it requires
initially about 1.5m transactions on the database to set up the data. For
some reason that I am not clear on the app starts to really slow down about
halfway into this, it looks like it is having trouble with the amount of
memory it is using, because it really starts to flail away at the disk
cache. I tried doing store.clear() to make sure that it wasn't storing to
many objects locally, but that didn't help at all. I also thought it might
be a problem with the number of connections that it was creating and
Thanks for your help.
From: Jason Hildebrand <jason@pe...> - 2002-07-31 03:39:35
On Tue, 2002-07-30 at 08:26, jonathan wrote
> 2. Should I have global access to 'store', or should each module where it is
> used create it's own store?? I noticed in the source for SQLObjectStore,
> that new connections are created all over the place anyway. So would this be
> much of a performance hit? how does everyone else do this??
This was a question on my mind when I started using MiddleKit, too.
Originally I had one store per servlet which used the store, but soon
realized that this is not how MiddleKit was designed to be used -- at
least not in that version, which was 0.6, since the store aggressively
cached objects, and changes made to objects in one store wouldn't be
noticed by other stores. I've noticed that a lot of this has changed in
0.7, so trying something like this might work now.
As I understand it, though, MiddleKit was designed to be instantiated as
a global instance (once per application). You can achieve this by
putting the init code in a module at file-level -- whichever module
imports it first will cause it to be instantiated.
The only question on my mind is whether there are concurrency issues if
multiple threads call store.saveChanges() simultaneously; from the code
it looks like this could be a problem. I haven't run into any problems
yet, but since I've done mostly single-user testing so far, it's likely
that this just hasn't come up. This could be solved by using a
semaphore or other lock -- but before I do that I'd be interested to
hear if anyone has thought about this possibility or experienced any
Jason D. Hildebrand