Hi,
... just realized that the PAR problem practically applies to all POE programs
wrapping blocking Perl objects.
Especially POE::Component::Generic is affected here.
Philip: do you see a generic way to introduce my PAR support in your module?
Are there other POE places we might want to look at?
Maybe it makes sense to even provide a generalization for wheel executables
contained in the PAR archive.
Steffen and Roderich: could you please scrutinize my patch from a PAR
perspective?
I know that I have been a little bit more paranoid than necessary when trying
to detect whether
a) the script runs under PAR, and b) the "external Perl" version is wanted.
Regarding the calling via --reuse - is there an easier/faster way?
I also admit that a test suite is missing.
Best regards,
Markus
_____________________________________________
From: Markus Jansen
Sent: Wednesday, May 18, 2011 3:38 PM
To: Rocco Caputo
Cc: Markus Jansen
Subject: POE::Component::Resolver patch for PAR compatibility
Hi Rocco,
thanks for your fast answer on [email protected].
In the meantime, I have found a solution, which works both with "ordinary PAR"
(in this case resulting in forks), and "tuned PAR" (starting separate
processes).
>From the benchmarks at the end of this mail you can see why I clearly prefer
>the latter :-),
allthough it may not work under all circumstances, hence both solutions should
be supported.
Please consider applying my patch (excluding my version number fake but
eventually modifications/corrections to it).
Best regards,
Markus
===========
patch
===========
diff -c
/vobs/cc/CCA-perl01/perl5____________________sixtyfive_char_path/prod/lib/site_perl/5.10.1/POE/Component/Resolver.pm
perl5/POE/Component/Resolver.pm
Warning: missing newline at end of file
/vobs/cc/CCA-perl01/perl5____________________sixtyfive_char_path/prod/lib/site_perl/5.10.1/POE/Component/Resolver.pm
***
/vobs/cc/CCA-perl01/perl5____________________sixtyfive_char_path/prod/lib/site_perl/5.10.1/POE/Component/Resolver.pm
Wed May 4 04:39:59 2011
--- perl5/POE/Component/Resolver.pm Wed May 18 15:22:09 2011
***************
*** 1,6 ****
package POE::Component::Resolver;
BEGIN {
! $POE::Component::Resolver::VERSION = '0.912';
}
use warnings;
--- 1,6 ----
package POE::Component::Resolver;
BEGIN {
! $POE::Component::Resolver::VERSION = '0.912_001'; #
[email protected]
}
use warnings;
***************
*** 187,192 ****
--- 187,200 ----
return if $heap->{shutdown};
while (scalar(keys %{$heap->{sidecar}}) < $heap->{max_resolvers}) {
+ my $is_within_PAR;
+ {
+ no warnings;
+ $is_within_PAR = defined $ENV{PAR_PROGNAME}
+ && defined %PAR::LibCache
+ && defined
$PAR::LibCache{$ENV{PAR_PROGNAME}};
+ }
+
my $sidecar = POE::Wheel::Run->new(
StdioFilter => POE::Filter::Reference->new(),
StdoutEvent => 'sidecar_response',
***************
*** 195,200 ****
--- 203,224 ----
Program => (
($^O eq "MSWin32")
? \&POE::Component::Resolver::Sidecar::main
+ : ($is_within_PAR && defined $ENV{PAR_TEMP} &&
-x $ENV{PAR_PROGNAME}
+ && -f $ENV{PAR_TEMP} .
'/inc/POE_Component_Resolver_Sidecar_main.pl' )
+ ? [
+ $ENV{PAR_PROGNAME},
+ '--par-options',
+ '--reuse',
+ $ENV{PAR_TEMP} .
'/inc/POE_Component_Resolver_Sidecar_main.pl'
+ #
POE_Component_Resolver_Sidecar_main.pl script consisting of the 2 next lines,
added via pp option -a
+ # use POE::Component::Resolver::Sidecar;
+ #
POE::Component::Resolver::Sidecar->main();
+ ]
+ : $is_within_PAR
+ ? sub { # line breaks temporarily needed for
Module::ScanDeps
+ require
POE::Component::Resolver::Sidecar;
+
POE::Component::Resolver::Sidecar->main();
+ }
: [
$^X,
(map { "-I$_" } @INC),
***************
*** 674,677 ****
software; you may redistribute it and/or modify it under the same
terms as Perl itself.
! =cut
--- 698,701 ----
software; you may redistribute it and/or modify it under the same
terms as Perl itself.
! =cut
===========
benchmarks
===========
test results with PAR and external processes (via PAR --reuse):
-----
12966 user 1 59 0 79M 72M sleep 0:03 0.00% ccsecsrv_sp_mai
12984 user 1 59 0 24M 22M sleep 0:01 0.00% ccsecsrv_sp_mai
12976 user 1 59 0 24M 22M sleep 0:01 0.00% ccsecsrv_sp_mai
12977 user 1 59 0 24M 22M sleep 0:01 0.00% ccsecsrv_sp_mai
12983 user 1 59 0 24M 22M sleep 0:01 0.00% ccsecsrv_sp_mai
12978 user 1 59 0 24M 22M sleep 0:01 0.00% ccsecsrv_sp_mai
12974 user 1 59 0 24M 22M sleep 0:01 0.00% ccsecsrv_sp_mai
12973 user 1 59 0 24M 22M sleep 0:01 0.00% ccsecsrv_sp_mai
12975 user 1 59 0 24M 22M sleep 0:01 0.00% ccsecsrv_sp_mai
-----
12966 user 1 59 0 79M 72M sleep 0:03 0.00% ccsecsrv_sp_mai
-----
test results: with PAR and fork():
-----
4886 user 1 59 0 79M 72M sleep 0:04 0.00% ccsecsrv_sp_mai
4904 user 1 59 0 79M 68M sleep 0:00 0.00% ccsecsrv_sp_mai
4903 user 1 59 0 79M 67M sleep 0:00 0.00% ccsecsrv_sp_mai
4901 user 1 59 0 79M 67M sleep 0:00 0.00% ccsecsrv_sp_mai
4900 user 1 59 0 79M 67M sleep 0:00 0.00% ccsecsrv_sp_mai
4899 user 1 59 0 79M 67M sleep 0:00 0.00% ccsecsrv_sp_mai
4894 user 1 59 0 79M 67M sleep 0:00 0.00% ccsecsrv_sp_mai
4893 user 1 59 0 79M 67M sleep 0:00 0.00% ccsecsrv_sp_mai
-----
4886 user 1 59 0 79M 72M sleep 0:04 0.00% ccsecsrv_sp_mai
-----
<< OLE Object: Picture (Metafile) >>
Markus Jansen
Ericsson GmbH
Eurolab R&D
Ericsson Allee 1
52134 Herzogenrath, Germany
Phone +49 2407 575 5157
Fax +49 22407 575 150
Mobile +49 172 2742003
[email protected]
www.ericsson.com
<< OLE Object: Picture (Metafile) >>
Ericsson GmbH. Sitz: Düsseldorf. Registergericht: Amtsgericht Düsseldorf, HRB
33012. Geschäftsführer: Stefan Koetz (Vors.), Nils de Baar, Bernd Schmidt.
Aufsichtsratsvorsitzender: Anders Runevad.
This Communication is confidential. We only send and receive email on the basis
of the terms set out at
www.ericsson.com/email_disclaimer<http://www.ericsson.com/email_disclaimer>.