Re: cgi to mod_perl question

2001-10-17 Thread Brice D Ruth




Perrin Harkins wrote:
001c01c156c1$d5d0eac0$553dfea9@charlotte">
  
Unfortunately, I've now noticed that my server is unbearably slow -setting 'ThreadsPerChild 1' in my httpd.conf made my server slow to asnails pace (and it really is a pretty quick server on a T1 linededicated to it, pretty much).

That's odd.  On Win32, mod_perl runs as a single blocking thread.  Iwouldn't expect changing that setting to affect anything.  Are you sureyou were running your script under Apache::Registry?  (Maybe someone whoactually uses Win32 could supply some help here?)

By making 'ThreadsPerChild 1' - the entire server runs as a single thread,
mod_perl and any other requests (e.g. images) that come in - this is why
the server slows to a snails pace. I've set up two instances now, one to
handle all incoming requests, the other to serve as a backend proxy pass-thru
for mod_perl requests. It seems to be working out fairly well.
001c01c156c1$d5d0eac0$553dfea9@charlotte">
  
Have I missed something here?  Certainlythis isn't the only way mod_perl can run if it needs to makeIO::Socket::INET connections???

I do my mod_perl development on Linux, so I'm just repeating what othershave posted before.  I've never heard of an actual solution for thisproblem, just the workaround.

I wonder if this is something that has been addressed in Apache 2.x/mod_perl
2.x ... it'd be nice if it were.
001c01c156c1$d5d0eac0$553dfea9@charlotte">
  
Please help me out here - I'm truly just a Linux/*BSD guy trying to

get

  a poor Win2K box w/ Apache to run the Perl scripts right ...
  
  You would certainly get better performance on Linux or BSD.  If you haveto use Win32 and need better performance, you may have to look at otheroptions like ActiveState's PerlEx.
  
Yes, I wish it were a Linux/BSD box ... but it isn't and at the moment its
not my place to say anything about it. As for ActiveState's PerlEx - I dunno,
doesn't seem like a good solution to me :)
  001c01c156c1$d5d0eac0$553dfea9@charlotte">
Thanks for the info, guys.-Brice-- 
WebProjkt, Inc.
VP, Director of Internet Technology
http://www.webprojkt.com/





Re: cgi to mod_perl question

2001-10-17 Thread Perrin Harkins

 By making 'ThreadsPerChild 1' - the entire server runs as a single
 thread, mod_perl and any other requests (e.g. images) that come in -
 this is why the server slows to a snails pace.  I've set up two
 instances now, one to handle all incoming requests, the other to serve
 as a backend proxy pass-thru for mod_perl requests.  It seems to be
 working out fairly well.

Ah, that makes sense.  Good idea.  People have reported that even with its
limitations on NT, mod_perl is still a lot faster than CGI or ASP with
PerlScript.

- Perrin




Re: cgi to mod_perl question

2001-10-17 Thread Brice D Ruth




Perrin Harkins wrote:
006101c1571b$7930a850$18020c0a@PerriHar">
  
By making 'ThreadsPerChild 1' - the entire server runs as a singlethread, mod_perl and any other requests (e.g. images) that come in -this is why the server slows to a snails pace.  I've set up twoinstances now, one to handle all incoming requests, the other to serveas a backend proxy pass-thru for mod_perl requests.  It seems to beworking out fairly well.

Ah, that makes sense.  Good idea.  People have reported that even with itslimitations on NT, mod_perl is still a lot faster than CGI or ASP withPerlScript.- Perrin

I won't take credit for the idea ... it was passed along from some other
posts I read. I'm glad that the 'workaround' is actually working acceptably
well. I'd like to actually figure out how to load-balance the proxy pass-thru
to five instances of Apache running in single-threaded mode w/ mod_perl ...
since the server that the Perl scripts are connecting to can handle five
simultaneous connections and I'd like to take advantage of that ... that's
my next project :)

-Brice
-- 
WebProjkt, Inc.
VP, Director of Internet Technology
http://www.webprojkt.com/





cgi to mod_perl question

2001-10-16 Thread Brice D Ruth

  I have a perl script that was running fine under IIS/5.0 with 
ActivePerl 6xx - I'll put the salient parts here:

use IO::Socket;
use CGI;

$in = new CGI;

$server = IO::Socket::INET-new( PeerAddr= ...,PeerPort= 
...,Proto=tcp,Type= SOCK_STREAM) or die Error message ... $@;

$server-autoflush(1);

... (information is gotten from $server via $server)
... (information is sent to $server via 'print $server ...')

... (server's response is read via $server and printed to browser via 
'print')

close ($server);

That's it - a very simple Perl script that basically takes information 
from the GET or POST strings, sends it to a server process and reads its 
response, printing it out to the browser.

I've now moved the script to Apache 1.3.20 w/ mod_perl 1.25 (I think its 
1.25, but it may be 1.26 - the server's not running at the moment, else 
I'd find out for sure).  It *seems* that the script can run once, but 
that the next time it is accessed, it cannot connect to the $server 
anylonger, it dies with a 'connection timed out' message ... What 
'gotcha' is causing this?

Any help on this would be greatly appreciated!!

Sincerely,
Brice D Ruth

-- 
WebProjkt, Inc.
VP, Director of Internet Technology
http://www.webprojkt.com/





Re: cgi to mod_perl question

2001-10-16 Thread Brice D Ruth

  What is the difference between doing the following:

close( $server );
#
$server-close();
#
$server-shutdown();

??

Sincerely,
Brice Ruth

Brice D Ruth wrote:

  I have a perl script that was running fine under IIS/5.0 with 
 ActivePerl 6xx - I'll put the salient parts here:

 use IO::Socket;
 use CGI;

 $in = new CGI;

 $server = IO::Socket::INET-new( PeerAddr= ...,PeerPort= 
 ...,Proto=tcp,Type= SOCK_STREAM) or die Error message ... $@;

 $server-autoflush(1);

 ... (information is gotten from $server via $server)
 ... (information is sent to $server via 'print $server ...')

 ... (server's response is read via $server and printed to browser 
 via 'print')

 close ($server);

 That's it - a very simple Perl script that basically takes information 
 from the GET or POST strings, sends it to a server process and reads 
 its response, printing it out to the browser.

 I've now moved the script to Apache 1.3.20 w/ mod_perl 1.25 (I think 
 its 1.25, but it may be 1.26 - the server's not running at the moment, 
 else I'd find out for sure).  It *seems* that the script can run once, 
 but that the next time it is accessed, it cannot connect to the 
 $server anylonger, it dies with a 'connection timed out' message ... 
 What 'gotcha' is causing this?

 Any help on this would be greatly appreciated!!

 Sincerely,
 Brice D Ruth


-- 
WebProjkt, Inc.
VP, Director of Internet Technology
http://www.webprojkt.com/






OT: Re: cgi to mod_perl question

2001-10-16 Thread ___cliff rayman___

Brice D Ruth wrote:

   What is the difference between doing the following:

 close( $server );

functional interface.  flush and close the file handle for this instance
of the program.


 #
 $server-close();

object interface - same as above.


 #
 $server-shutdown();

object interface.  cause the connection to close at the tcp/ip level.
any other application instance also using this socket will no longer
be able to read/write from it.


--
___cliff [EMAIL PROTECTED]http://www.genwax.com/





Re: cgi to mod_perl question

2001-10-16 Thread Brice D Ruth




Why OT? I have a script that works under IIS/5 using CGI Perl that doesn't
work under Apache with mod_perl - I'd say that's on-topic for this list!

-Brice

___cliff rayman___ wrote:
[EMAIL PROTECTED]">
  Brice D Ruth wrote:
  
  What is the difference between doing the following:close( $server );

functional interface.  flush and close the file handle for this instanceof the program.

  #$server-close();
  
  object interface - same as above.
  
#$server-shutdown();

object interface.  cause the connection to close at the tcp/ip level.any other application instance also using this socket will no longerbe able to read/write from it.--___cliff [EMAIL PROTECTED]://www.genwax.com/


-- 
WebProjkt, Inc.
VP, Director of Internet Technology
http://www.webprojkt.com/





OT: Re: cgi to mod_perl question

2001-10-16 Thread ___cliff rayman___

hi brice,
because this particular question is one of basic perl,
and not mod_perl.  this just alerts all mod_perl readers
that they can safely skip this particular question/answer
and not miss any relevant mod_perl content.

u sound upset - no reason to be - u got the answer u were
looking for.
cliff

Brice D Ruth wrote:

 Why OT?  I have a script that works under IIS/5 using CGI Perl that doesn't work 
under Apache with mod_perl - I'd say that's on-topic for this list!

 -Brice

 ___cliff rayman___ wrote:

 Brice D Ruth wrote:


What is the difference between doing the following:
 
  close( $server );
 
 functional interface.  flush and close the file handle for this instance
 of the program.


  #
  $server-close();
 
 object interface - same as above.


  #
  $server-shutdown();
 
 object interface.  cause the connection to close at the tcp/ip level.
 any other application instance also using this socket will no longer
 be able to read/write from it.


 --
 ___cliff [EMAIL PROTECTED]http://www.genwax.com/



 --
 WebProjkt, Inc.
 VP, Director of Internet Technology
 http://www.webprojkt.com/



--
___cliff [EMAIL PROTECTED]http://www.genwax.com/





Re: cgi to mod_perl question

2001-10-16 Thread Perrin Harkins

 It *seems* that the script can run once, but
 that the next time it is accessed, it cannot connect to the $server
 anylonger, it dies with a 'connection timed out' message ... What
 'gotcha' is causing this?

It sounds like this problem:
http://mathforum.org/epigone/modperl/joidwendsmeld/3B30E553.AD3A7DB8@chamas.
com

In the message, Joshua suggests a workaround of running mod_perl
single-threaded (which shouldn't make any difference, since mod_perl on
Win32 is already single-threaded).

- Perrin




Re: cgi to mod_perl question

2001-10-16 Thread Brice D Ruth




Yeah, I thought about that earlier today ... I did that and the script is
still crappin' out ... basically, the first time through, it works. The
next time, it doesn't seem to be able to build the connection, but it doesn't
'die' at that line, either.

I'll go check out the links you sent me (again :)) and see if anything else
catches my eye. If you have any other clues, please let me know!

-Brice

Edward Moon wrote:

  You're problem is pretty basic. You should read up on issues on movingfrom CGI to mod_perl (http://perl.apache.org/dist/cgi_to_mod_perl.html)and the mod_perl guide (http://perl.apache.org/guide/).You need to declare your variables with 'my' in order to avoid the problemyou are encountering.'use strict' will help catch many issues that can trip you up undermod_perl.On Tue, 16 Oct 2001, Brice D Ruth wrote:
  
  I have a perl script that was running fine under IIS/5.0 withActivePerl 6xx - I'll put the salient parts here:use IO::Socket;use CGI;$in = new CGI;$server = IO::Socket::INET-new( PeerAddr= "...",PeerPort=...,Proto="tcp",Type= SOCK_STREAM) or die "Error message ... $@";$server-autoflush(1);... (information is gotten from $server via $server)... (information is sent to $server via 'print $server ...')... (server's response is read via $server and printed to browser via'print')close ($server);That's it - a very simple Perl script that basically takes informationfrom the GET or POST strings, sends it to a server process and reads itsresponse, printing it out to the browser.I've now moved the script to Apache 1.3.20 w/ mod_perl 1.25 (I think its1.25, but it may be 1.26 - the server's not running at the moment, elseI'd find out for sure).  It *seems* that the script can run once, butthat the next time it is accessed, it cannot connect to the $serveranylonger, it dies with a 'connection timed out' message ... What'gotcha' is causing this?Any help on this would be greatly appreciated!!Sincerely,Brice D Ruth--WebProjkt, Inc.VP, Director of Internet Technologyhttp://www.webprojkt.com/




-- 
WebProjkt, Inc.
VP, Director of Internet Technology
http://www.webprojkt.com/





Re: cgi to mod_perl question

2001-10-16 Thread Brice D Ruth




Perrin Harkins wrote:
00a601c1568c$224f0a20$18020c0a@PerriHar">
  
It *seems* that the script can run once, butthat the next time it is accessed, it cannot connect to the $serveranylonger, it dies with a 'connection timed out' message ... What'gotcha' is causing this?

It sounds like this problem:http://mathforum.org/epigone/modperl/joidwendsmeld/3B30E553.AD3A7DB8@chamas.comIn the message, Joshua suggests a workaround of running mod_perlsingle-threaded (which shouldn't make any difference, since mod_perl onWin32 is already single-threaded).- Perrin

It certainly seems that this is part of the problem. Making mod_perl single-threaded
fixed my problem *partially* - now at least I can renew the socket connection
on subsequent requests. But, the connection still isn't being taken down
properly ... when the page finishes being served, and after 'close( $server
);' has been called, the socket on the server side (what the mod_perl script
is connecting to) show 'TIME_WAIT' - the server runs five threads to accept
connections, once all of them have been connected to once, I can no longer
connect to them - what's going on? Why is the connection not being dismantled
properly??

Sincerely (and frustrated),
Brice Ruth
-- 
WebProjkt, Inc.
VP, Director of Internet Technology
http://www.webprojkt.com/





Re: cgi to mod_perl question

2001-10-16 Thread Brice D Ruth




Brice D Ruth wrote:
[EMAIL PROTECTED]">
  
   Perrin Harkins wrote:
  00a601c1568c$224f0a20$18020c0a@PerriHar">

  It *seems* that the script can run once, butthat the next time it is accessed, it cannot connect to the $serveranylonger, it dies with a 'connection timed out' message ... What'gotcha' is causing this?
  
  It sounds like this problem:http://mathforum.org/epigone/modperl/joidwendsmeld/3B30E553.AD3A7DB8@chamas.comIn the message, Joshua suggests a workaround of running mod_perlsingle-threaded (which shouldn't make any difference, since mod_perl onWin32 is already single-threaded).- Perrin
  
 It certainly seems that this is part of the problem. Making mod_perl single-threaded 
fixed my problem *partially* - now at least I can renew the socket connection 
on subsequent requests. But, the connection still isn't being taken down 
properly ... when the page finishes being served, and after 'close( $server 
);' has been called, the socket on the server side (what the mod_perl script 
is connecting to) show 'TIME_WAIT' - the server runs five threads to accept 
connections, once all of them have been connected to once, I can no longer 
connect to them - what's going on? Why is the connection not being dismantled 
properly??
  
 Sincerely (and frustrated),
 Brice Ruth
  
  
Unfortunately, I've now noticed that my server is unbearably slow - setting 
'ThreadsPerChild 1' in my httpd.conf made my server slow to a snails pace 
(and it really is a pretty quick server on a T1 line dedicated to it, pretty 
much). Have I missed something here? Certainly this isn't the only way mod_perl
can run if it needs to make IO::Socket::INET connections???
  
 Please help me out here - I'm truly just a Linux/*BSD guy trying to get
a poor Win2K box w/ Apache to run the Perl scripts right ... 
  
 -Brice
  -- 
WebProjkt, Inc.
VP, Director of Internet Technology
http://www.webprojkt.com/
  
  
  


Re: cgi to mod_perl question

2001-10-16 Thread Perrin Harkins

 Unfortunately, I've now noticed that my server is unbearably slow -
 setting 'ThreadsPerChild 1' in my httpd.conf made my server slow to a
 snails pace (and it really is a pretty quick server on a T1 line
 dedicated to it, pretty much).

That's odd.  On Win32, mod_perl runs as a single blocking thread.  I
wouldn't expect changing that setting to affect anything.  Are you sure
you were running your script under Apache::Registry?  (Maybe someone who
actually uses Win32 could supply some help here?)

 Have I missed something here?  Certainly
 this isn't the only way mod_perl can run if it needs to make
 IO::Socket::INET connections???

I do my mod_perl development on Linux, so I'm just repeating what others
have posted before.  I've never heard of an actual solution for this
problem, just the workaround.

 Please help me out here - I'm truly just a Linux/*BSD guy trying to
get
 a poor Win2K box w/ Apache to run the Perl scripts right ...

You would certainly get better performance on Linux or BSD.  If you have
to use Win32 and need better performance, you may have to look at other
options like ActiveState's PerlEx.

- Perrin