[ome-devel] bootstrap overhead?
Ilya Goldberg
igg at nih.gov
Fri May 19 17:19:31 BST 2006
Hi Mike
I'm sorry the OME::Session docs (pod) have gotten out of sync with
the implementation, which may be the cause for confusion.
To get a session, you need to call
my $session = OME::Session->instance($userState, $factory, $acl);
Right now the $factory parameter is optional, but it shouldn't be.
Its there so you can recycle your bootstrap factory (if you don't
provide it, it will allocate a new factory, and a new DB handle,
which it probably should not do in any case). The $acl parameter
should be removed, because SessionManager sets the access control for
the session after getting the session object and right before
returning. But that's another topic.
In terms of request latency, avoiding creating a new DB handle by
reconnecting to an existing session and recycling the bootstrap
factory when possible takes latency from ~100ms or so down to 20-25ms
(at least on 1 platform). So it does make a difference. If you make
a bootstrap Factory, then you should reuse it when making a session
if at all possible (i.e. don't throw away the bootstrap factory).
Let me know if this makes any sense. These chicken-egg issues are
pretty tricky.
-Ilya
On May 18, 2006, at 3:34 PM, McCaughey, Michael J wrote:
> Harry-
> I'm doing this in SessionManager, before the Session is formally
> created. I'm bootstrapping so I can read some configuration values
> before I attempt to authenticate a new user.
>
> Michael J. McCaughey, PhD
> Molecular Physiology and Biophysics
> U9203 MRBIII
> 6-6175
>
>
>
> -----Original Message-----
> From: ome-devel-bounces at lists.openmicroscopy.org.uk on behalf of
> Harry Hochheiser
> Sent: Thu 5/18/2006 1:37 PM
> To: McCaughey, Michael J
> Cc: ome-devel at lists.openmicroscopy.org.uk
> Subject: Re: [ome-devel] bootstrap overhead?
>
> Mike:
>
> Creation of a new Factory involves going through the database
> delegate to connect to the database. I don't know what the overhead
> of a database connection is per se, but since it probably requires a
> network round-trip, I'd probably avoid this if I could.
>
> What's the context? If you're working with anything under OME::Web,
> the Session always keeps the Factory and the Configuration around for
> easy access.
>
> harry
>
>
>
> On May 18, 2006, at 2:16 PM, McCaughey, Michael J wrote:
>
> > Anybody know the overhead involved in bootstrapping a new Factory?
> > i.e.:
> >
> > my $bootstrap_factory = OME::Factory->new($flags);
> > my $dbh = $bootstrap_factory->obtainDBH();
> > my $configuration = OME::Configuration->new
> > ($bootstrap_factory );
> >
> > Say I've done this already in a routine, and I'm calling a sub that
> > needs $configuration, is it smarter to pass $configuration, or
> > bootstrap again in the sub?
> >
> > Thanks,
> > Mike
> >
> > Michael J. McCaughey, PhD
> > Molecular Physiology and Biophysics
> > U9203 MRBIII
> > 6-6175
> >
> >
> > _______________________________________________
> > ome-devel mailing list
> > ome-devel at lists.openmicroscopy.org.uk
> > http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel
>
>
>
> _______________________________________________
> ome-devel mailing list
> ome-devel at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel
More information about the ome-devel
mailing list