You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Vladislav Safronov <vl...@comptek.ru> on 2000/09/14 11:43:32 UTC
How to close connect and continue processing?
Hi,
After user request my script should say that the request is accepted and
continue processing user data (it takes a time) so I want to tell the
browser
that all data is sent. I searched mod_perl guide but I didn't find such code
snippet.
Could you send me such example?
==
Vlad.
RE: How to close connect and continue processing?
Posted by Vladislav Safronov <vl...@comptek.ru>.
> On Thu, 14 Sep 2000, Vladislav Safronov wrote:
>
> > I read the guide and I think the best is just add "&" :)
> > (how could I forget it!)
> > ..
> > system("myprog la la &");
> > print "</html>";
> > # end
>
> True, but what happens if your program tries to print
> something. You've
> all in/out/err streams inherited, where in/out are tied to a
> socket. You
> must close them at the beginning of the external script.
hm.. it's true. I should back to the guide ...
Thanx for the help!
Vlad.
>
> Anyway, it might be neater to use &, but performance wise is
> not, since
> you spawn a shell. Of course for the heavily loaded systems. Fork is
> faster.
>
> >
> >
> > > On Thu, 14 Sep 2000, Matt Sergeant wrote:
> > >
> > > > On Thu, 14 Sep 2000, Matt Sergeant wrote:
> > > >
> > > > > On Thu, 14 Sep 2000, Vladislav Safronov wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > After user request my script should say that the
> > > request is accepted and
> > > > > > continue processing user data (it takes a time) so I
> > > want to tell the
> > > > > > browser
> > > > > > that all data is sent. I searched mod_perl guide but I
> > > didn't find such code
> > > > > > snippet.
> > > > > > Could you send me such example?
> > > > >
> > > > > $r->register_cleanup(\&do_big_work);
> > > >
> > > > I should have mentioned that this is far from a perfect
> > > solution (cue
> > > > Stas) as it ties up a mod_perl process. See the guide
> for alternate
> > > > solutions.
> > >
> > > Like Matt has said, this used mostly for light things
> like logging or
> > > process killing (Apache::{SizeLimit|GTopLimit}). See the
> performance
> > > chapter for forking techniques for heavy jobs:
> > > http://perl.apache.org/guide/performance.html#Forking_and_Exec
> > > uting_Subprocess
> > >
> > >
> > > >
> > > > --
> > > > <Matt/>
> > > >
> > > > Fastnet Software Ltd. High Performance Web Specialists
> > > > Providing mod_perl, XML, Sybase and Oracle solutions
> > > > Email for training and consultancy availability.
> > > > http://sergeant.org | AxKit: http://axkit.org
> > > >
> > > >
> > >
> > >
> > >
> > >
> _____________________________________________________________________
> > > Stas Bekman JAm_pH -- Just Another
> mod_perl Hacker
> > > http://stason.org/ mod_perl Guide
http://perl.apache.org/guide
> > mailto:stas@stason.org http://apachetoday.com http://jazzvalley.com
> > http://singlesheaven.com http://perlmonth.com perl.org apache.org
> >
> >
>
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://apachetoday.com http://jazzvalley.com
http://singlesheaven.com http://perlmonth.com perl.org apache.org
RE: How to close connect and continue processing?
Posted by Stas Bekman <st...@stason.org>.
On Thu, 14 Sep 2000, Vladislav Safronov wrote:
> I read the guide and I think the best is just add "&" :)
> (how could I forget it!)
> ..
> system("myprog la la &");
> print "</html>";
> # end
True, but what happens if your program tries to print something. You've
all in/out/err streams inherited, where in/out are tied to a socket. You
must close them at the beginning of the external script.
Anyway, it might be neater to use &, but performance wise is not, since
you spawn a shell. Of course for the heavily loaded systems. Fork is
faster.
>
>
> > On Thu, 14 Sep 2000, Matt Sergeant wrote:
> >
> > > On Thu, 14 Sep 2000, Matt Sergeant wrote:
> > >
> > > > On Thu, 14 Sep 2000, Vladislav Safronov wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > After user request my script should say that the
> > request is accepted and
> > > > > continue processing user data (it takes a time) so I
> > want to tell the
> > > > > browser
> > > > > that all data is sent. I searched mod_perl guide but I
> > didn't find such code
> > > > > snippet.
> > > > > Could you send me such example?
> > > >
> > > > $r->register_cleanup(\&do_big_work);
> > >
> > > I should have mentioned that this is far from a perfect
> > solution (cue
> > > Stas) as it ties up a mod_perl process. See the guide for alternate
> > > solutions.
> >
> > Like Matt has said, this used mostly for light things like logging or
> > process killing (Apache::{SizeLimit|GTopLimit}). See the performance
> > chapter for forking techniques for heavy jobs:
> > http://perl.apache.org/guide/performance.html#Forking_and_Exec
> > uting_Subprocess
> >
> >
> > >
> > > --
> > > <Matt/>
> > >
> > > Fastnet Software Ltd. High Performance Web Specialists
> > > Providing mod_perl, XML, Sybase and Oracle solutions
> > > Email for training and consultancy availability.
> > > http://sergeant.org | AxKit: http://axkit.org
> > >
> > >
> >
> >
> >
> > _____________________________________________________________________
> > Stas Bekman JAm_pH -- Just Another mod_perl Hacker
> > http://stason.org/ mod_perl Guide http://perl.apache.org/guide
> > mailto:stas@stason.org http://apachetoday.com http://jazzvalley.com
> > http://singlesheaven.com http://perlmonth.com perl.org apache.org
> >
> >
>
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://apachetoday.com http://jazzvalley.com
http://singlesheaven.com http://perlmonth.com perl.org apache.org
RE: How to close connect and continue processing?
Posted by Vladislav Safronov <vl...@comptek.ru>.
I read the guide and I think the best is just add "&" :)
(how could I forget it!)
..
system("myprog la la &");
print "</html>";
# end
> On Thu, 14 Sep 2000, Matt Sergeant wrote:
>
> > On Thu, 14 Sep 2000, Matt Sergeant wrote:
> >
> > > On Thu, 14 Sep 2000, Vladislav Safronov wrote:
> > >
> > > > Hi,
> > > >
> > > > After user request my script should say that the
> request is accepted and
> > > > continue processing user data (it takes a time) so I
> want to tell the
> > > > browser
> > > > that all data is sent. I searched mod_perl guide but I
> didn't find such code
> > > > snippet.
> > > > Could you send me such example?
> > >
> > > $r->register_cleanup(\&do_big_work);
> >
> > I should have mentioned that this is far from a perfect
> solution (cue
> > Stas) as it ties up a mod_perl process. See the guide for alternate
> > solutions.
>
> Like Matt has said, this used mostly for light things like logging or
> process killing (Apache::{SizeLimit|GTopLimit}). See the performance
> chapter for forking techniques for heavy jobs:
> http://perl.apache.org/guide/performance.html#Forking_and_Exec
> uting_Subprocess
>
>
> >
> > --
> > <Matt/>
> >
> > Fastnet Software Ltd. High Performance Web Specialists
> > Providing mod_perl, XML, Sybase and Oracle solutions
> > Email for training and consultancy availability.
> > http://sergeant.org | AxKit: http://axkit.org
> >
> >
>
>
>
> _____________________________________________________________________
> Stas Bekman JAm_pH -- Just Another mod_perl Hacker
> http://stason.org/ mod_perl Guide http://perl.apache.org/guide
> mailto:stas@stason.org http://apachetoday.com http://jazzvalley.com
> http://singlesheaven.com http://perlmonth.com perl.org apache.org
>
>
Re: How to close connect and continue processing?
Posted by Stas Bekman <st...@stason.org>.
On Thu, 14 Sep 2000, Matt Sergeant wrote:
> On Thu, 14 Sep 2000, Matt Sergeant wrote:
>
> > On Thu, 14 Sep 2000, Vladislav Safronov wrote:
> >
> > > Hi,
> > >
> > > After user request my script should say that the request is accepted and
> > > continue processing user data (it takes a time) so I want to tell the
> > > browser
> > > that all data is sent. I searched mod_perl guide but I didn't find such code
> > > snippet.
> > > Could you send me such example?
> >
> > $r->register_cleanup(\&do_big_work);
>
> I should have mentioned that this is far from a perfect solution (cue
> Stas) as it ties up a mod_perl process. See the guide for alternate
> solutions.
Like Matt has said, this used mostly for light things like logging or
process killing (Apache::{SizeLimit|GTopLimit}). See the performance
chapter for forking techniques for heavy jobs:
http://perl.apache.org/guide/performance.html#Forking_and_Executing_Subprocess
>
> --
> <Matt/>
>
> Fastnet Software Ltd. High Performance Web Specialists
> Providing mod_perl, XML, Sybase and Oracle solutions
> Email for training and consultancy availability.
> http://sergeant.org | AxKit: http://axkit.org
>
>
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://apachetoday.com http://jazzvalley.com
http://singlesheaven.com http://perlmonth.com perl.org apache.org
Re: How to close connect and continue processing?
Posted by Matt Sergeant <ma...@sergeant.org>.
On Thu, 14 Sep 2000, Matt Sergeant wrote:
> On Thu, 14 Sep 2000, Vladislav Safronov wrote:
>
> > Hi,
> >
> > After user request my script should say that the request is accepted and
> > continue processing user data (it takes a time) so I want to tell the
> > browser
> > that all data is sent. I searched mod_perl guide but I didn't find such code
> > snippet.
> > Could you send me such example?
>
> $r->register_cleanup(\&do_big_work);
I should have mentioned that this is far from a perfect solution (cue
Stas) as it ties up a mod_perl process. See the guide for alternate
solutions.
--
<Matt/>
Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org
Re: How to close connect and continue processing?
Posted by Matt Sergeant <ma...@sergeant.org>.
On Thu, 14 Sep 2000, Vladislav Safronov wrote:
> Hi,
>
> After user request my script should say that the request is accepted and
> continue processing user data (it takes a time) so I want to tell the
> browser
> that all data is sent. I searched mod_perl guide but I didn't find such code
> snippet.
> Could you send me such example?
$r->register_cleanup(\&do_big_work);
--
<Matt/>
Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org