Hi -

Last year I developed a library of c functions to embed the
perl interpreter into c/c++ applications. After several successful
deployments, I decided to try to 'embed' perl in the XMail server.

It works! I have been running it on my personal XMail server
for several days and have yet to encounter problems.

I must warn you that this is an independent project started
as a lark and is highly experimental.

Here's how it works:

1) Of course, only filters written in perl can be embedded.

2) The heavy-duty perl interpreter interface is done in my
library, 'bempl', so the direct modifications to Xmail are
minimized.

3) A new 'bempl.tab' table controls the various embedding options.

4) Upon startup, XMail initializes a pool of perl interpreters
(the size of which is customizable in bempl.tab).

5) When a filter is about to execute, a lookup in bempl.tab is
done to see if the filter should be run embedded or run using the
normal fork method. This means you can pick and choose which
filters you want to embed.

6) ABSOLUTELY NO CHANGES ARE REQUIRED TO YOUR PERL CODE.

7) When running embedded, the filter is loaded and compiled in
one of the perl interpreters in the pool. Subsequent execution
of the filter in the same interpreter will not have to be
compiled - saving lots of overhead.

8) You may instruct 'bempl' to delete all compiled filters after
serving a given number of requests (ala Apache) to prevent creepy-
crawly memory leaks.

9) 'bempl' has functions to calculate elapsed (wall clock) and
cpu time for a filter execution. The dump below shows the results
of my 'archive' filter. This filter saves all incoming messages
to disk and updates an index. The test below was run on 1000
test 12k messages in fork and then embed mode:

$VAR1 = {
  'archive.pl' => {
    'embedded' => {
      'count' => 1000,
      'cpu' => '1.87000',
      'wall' => '1.94900',
      'average_cpu' => '0.00187',
      'average_wall' => '0.00195'
    },
    'forked' => {
      'count' => 1000,
      'cpu' => '63.94000',
      'wall' => '1220.02010',
      'average_cpu' => '0.06394',
      'average_wall' => '1.22002'
    }
  }
};

Wow - look at the speed improvement!

I plan to publish my 'bempl' library and a patch to the 
XMail-1.19-pre03 source early next week if any of you are interested
in trying it. Currently, it has been tested only on Linux. The Windoze
code has been done, but not yet tested. I have no way to develop
for BSD or Solaris, but I have tried to code using the SysDep routines
already provided by Davide, so maybe it won't be too hard to
get those versions up.

Comments, please.

Aloha => Beau;
-
To unsubscribe from this list: send the line "unsubscribe xmail" in
the body of a message to [EMAIL PROTECTED]
For general help: send the line "help" in the body of a message to
[EMAIL PROTECTED]

Reply via email to