[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: commit: ldap/servers/slapd/back-perl SampleLDAP.pm

Am 22.06.2007 um 16:21 schrieb Hallvard B Furuseth:
Dagobert Michelsen writes:
There is exactly one interpreter in use for each active connection
and each configured back-perl database because allocation is done
on connection_init.

Hmm. That sounds like adding a perl database can have a noticeable impact on performance (and memory use?) even if it is rarely queried.

Yes, currently this is the case. For my applications this was no problem as the Perl backend was the only one active.

In particular if it calls a user-defined connection_init Perl method.
Ought to test and see, I guess...

It is possible to defer Perl interpreter allocation and calling connection_init to the first time an operation is issued. This should be fairly easy to implement. Thanks for the inspiration!

The disadvange is that there is no data sharing between connections.
Implementing data sharing with this model is quite complex and
involves attaching (Perl-)magic to shared variables which implements
mutex'ed access between interpreters.

Perl has "use threads::shared", but maybe that only works for threads created by Perl.

I haven't checked that in detail. If done improperly this can lead to hard-to-detect memory leaks of scalars between interpreters. The code from threads::shared was the origin of mod_perl which more resembles the structure of back_perl. Again: This is not an easy task and can be added later if needed.

As the method usually does something with the parameters the data
is needed anyway, so savings here should be minimal if not negative.

Depends on the API and which data we are talking about, I guess.

I'll prepare some documentation for discussion. BTW: Should the documentation for back-perl go to doc/guide/admin/backends.sdf ?

If you have a usecase for an application without connection_init
I would like to hear it.

Possibly you could eliminate the need for it by using a blessed
connection type instead, and assign a perl interpreter to a connection
only at the first operation which has need for one. Easy to say when I
haven't seen the code, of course...

Good idea for connection_init! See above...

Not really, but I'll see if I can dig something up.

I'm looking forward to that.

Best regards

  -- Dagobert