Amazing! Would be nice to see this merged into 1.19 final. All the best, Harald
> -----Urspr=FCngliche Nachricht----- > Von: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Im Auftrag von [EMAIL PROTECTED] > Gesendet: Mittwoch, 5. Mai 2004 12:58 > An: [EMAIL PROTECTED] > Betreff: [xmail] Embeded perl filters for XMail >=20 >=20 > Hi - >=20 > 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. >=20 > It works! I have been running it on my personal XMail server > for several days and have yet to encounter problems. >=20 > I must warn you that this is an independent project started > as a lark and is highly experimental. >=20 > Here's how it works: >=20 > 1) Of course, only filters written in perl can be embedded. >=20 > 2) The heavy-duty perl interpreter interface is done in my > library, 'bempl', so the direct modifications to Xmail are > minimized. >=20 > 3) A new 'bempl.tab' table controls the various embedding options. >=20 > 4) Upon startup, XMail initializes a pool of perl interpreters > (the size of which is customizable in bempl.tab). >=20 > 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. >=20 > 6) ABSOLUTELY NO CHANGES ARE REQUIRED TO YOUR PERL CODE. >=20 > 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. >=20 > 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. >=20 > 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: >=20 > $VAR1 =3D { > 'archive.pl' =3D> { > 'embedded' =3D> { > 'count' =3D> 1000, > 'cpu' =3D> '1.87000', > 'wall' =3D> '1.94900', > 'average_cpu' =3D> '0.00187', > 'average_wall' =3D> '0.00195' > }, > 'forked' =3D> { > 'count' =3D> 1000, > 'cpu' =3D> '63.94000', > 'wall' =3D> '1220.02010', > 'average_cpu' =3D> '0.06394', > 'average_wall' =3D> '1.22002' > } > } > }; >=20 > Wow - look at the speed improvement! >=20 > I plan to publish my 'bempl' library and a patch to the=20 > 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. >=20 > Comments, please. >=20 > Aloha =3D> 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] >=20 - 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]
