Re: Excellent article on Apache/mod_perl at eToys

2001-10-27 Thread Joe Schaefer

Rob Nagler [EMAIL PROTECTED] writes:

 Gunther wrote:
  If you do not have a strongly typed system, then when you break
  apart and rebuild another part of the system, Perl may very well not
  complain when a subtle bug comes up because of the fact that it is
  not strongly typed. Whereas Java will complain quite often and
  usually early with compile time checking.
 
 I don't think there's an objective view about this.  I also think
 the it compiles, so it works attitude is dangerous.  You don't know
 it works until your unit and acceptance tests pass.  I've been in too
 many shops where the nightly build was the extent of the quality
 assurance program.

Exactly- the statically typed languages I am familiar with have a casting 
mechanism to utterly subvert compile-time type checks. While static typing
allows better compile-time optimization, it's value as a debugging 
mechanism is near the bottom of the list of advantages for engineering
a large project.  If interface guarantees are important between Perl 
objects, I'd have a look at Class::Contract.

  Compile time checking can definitely be a friend of yours especially
  when dealing with large systems. But it's also a friend that's
  judgemental (strongly typed) so he's a pain to drag along to a party
 
 To me, strongly vs weakly typed is less descriptive than statically vs
 dynamically typed.  

To me, it is utterly nondescriptive in a PHB buzzwordy way, whereas 
static vs. dynamic typing is meaningful (and what I think most people
really mean by the former).

[...]

 Here's a strong statement: Threads have no place in information
 systems.  The NYSE is run on Tandem boxes.  Tandem's OS does not have
 threads.  The NYSE can process over a billion stock transactions a
 day.  The EJB spec says you can't fire off threads in a bean.  I think
 there's a reason for the way these systems have been architected.
 
 Threads are a false economy for systems which have to scale.  As some
 people have joked, Java is Sun's way of moving E10K servers.  SMP
 doesn't scale.  As soon as you outgrow your box, you are hosed.  A
 shared memory cache doesn't work well over the wire.  In my
 experience, the only way to build large scale systems is with
 stateless, single-threaded servers.
  ^^

Could you say some more about what you mean by this?  Do you mean 
something like

  use a functional language (like Haskell or Scheme), rather 
   than an imperative language (like C, Java, Perl ...),

or are you talking more about the application's platform and design
(e.g. http://www.kegel.com/c10k.html )?

-- 
Joe Schaefer




Re: Excellent article on Apache/mod_perl at eToys

2001-10-27 Thread Steven Lembark




 Exactly- the statically typed languages I am familiar with have a casting
 mechanism to utterly subvert compile-time type checks. While static typing
 allows better compile-time optimization, it's value as a debugging
 mechanism is near the bottom of the list of advantages for engineering
 a large project.  If interface guarantees are important between Perl
 objects, I'd have a look at Class::Contract.

One nice thing about which is that the contract portion can be
essentially turned off in production. Gives you the best of both
worlds: strong checking during development w/ good speed in productin.


  Compile time checking can definitely be a friend of yours especially
  when dealing with large systems. But it's also a friend that's
  judgemental (strongly typed) so he's a pain to drag along to a
  party

 To me, strongly vs weakly typed is less descriptive than statically vs
 dynamically typed.

 To me, it is utterly nondescriptive in a PHB buzzwordy way, whereas
 static vs. dynamic typing is meaningful (and what I think most people
 really mean by the former).

Comparing Perl to other OO languages runs into the fact that
only Perl uses a fairly high-level object as its basic storage
unit (scalar). The first thing most people write/buy for the
strongly typed languages is a library of contaner classes: things
that subvert the strong checking of low-level types. The second
thing that usually happens is that the low-level types get their
base operations overloaded via container objects.

Net result is minimal -- at best -- type checking.

The problem isn't really that scalars are weakly typed, since
all you can deal with are scalars. If programmers bothered to
write checks in their code (e.g., $foo =~ /^\d$/ or croak NAN)
then Perl will do as well or better than most languages. Coders
are too used to having the low-level type checking around as
a crutch, so they don't. Implementing code that uses Class::Contract
forces you to declare [perhaps even analyze?] not only data types
but expectations, and ends up causing people to do a much better
job of checking then most other languages even allow.



--
Steven Lembark   2930 W. Palmer
Workhorse Computing   Chicago, IL 60647
+1 800 762 1582



PerlSetVar string value - no \n translation?

2001-10-27 Thread Louis LeBlanc

Hey all.  I don't know how many people are lurking here, since the
list seems to be very light traffic (the lightest of 8 I sub to), but
I have a question regarding PerlSetVar and strings.

Here is what I'm trying to do:
In httpd.conf:
Location /MyHandler
  . . .
PerlSetVar MailMsg Access Report \
This is a mail message spanning several \
lines that I would like to mail to a \
particular address when the handler is \
invoked.  \
Unfortunately, it all winds up on one line and \
any \n included do not get translated.
/Location

And in my module, I am successfully sending this message to the email
address, but it arrives looking like this:

Access Report This is a mail message spanning several lines that I 
would like to mail to a particular address when the handler is 
invoked.  Unfortunately, it all winds up on one line and any \n 
included do not get translated.

And the darn thing is all on one line.  '\n' is not translated, etc.
It looks like the string is proveded as if enclosed in single quotes.
Which is bad.

Any ideas?

TIA  HAND
Lou
-- 
Louis LeBlanc   [EMAIL PROTECTED]
Fully Funded Hobbyist, KeySlapper Extrordinaire :)
http://www.keyslapper.org ԿԬ

Cohen's Law:
  There is no bottom to worse.




Re: PerlSetVar string value - no \n translation?

2001-10-27 Thread Steven Lembark



-- Louis LeBlanc [EMAIL PROTECTED]

 Hey all.  I don't know how many people are lurking here, since the
 list seems to be very light traffic (the lightest of 8 I sub to), but
 I have a question regarding PerlSetVar and strings.

 Here is what I'm trying to do:
 In httpd.conf:
 Location /MyHandler
   . . .
 PerlSetVar MailMsg Access Report \
 This is a mail message spanning several \
 lines that I would like to mail to a \
 particular address when the handler is \
 invoked.  \
 Unfortunately, it all winds up on one line and \
 any \n included do not get translated.
 /Location

 And in my module, I am successfully sending this message to the email
 address, but it arrives looking like this:

 Access Report This is a mail message spanning several
 lines that I would like to mail to a particular address when the
 handler is invoked.  Unfortunately, it all winds up on
 one line and any \n included do not get translated.

 And the darn thing is all on one line.  '\n' is not translated, etc.
 It looks like the string is proveded as if enclosed in single quotes.
 Which is bad.

Quick hack for the moment:

PerlSetVar Blah A long line withbrHTMLbrBreaks In It;

that or set the thing and use:

s/br/\n/gs;

somewhere in the code.

--
Steven Lembark   2930 W. Palmer
Workhorse Computing   Chicago, IL 60647
+1 800 762 1582



ApacheBench says my site is unstable?

2001-10-27 Thread Philip Mak

I'm using ApacheBench to perform stress testing on my mod_perl server.
It's not always working, though. Observe the following two runs: (first is
Broken pipe; second has some failed requests)

[pmak@sg1 bin]$ ./ab -n 1000 -c 10 http://65.119.108.120:8080/
This is ApacheBench, Version 1.3c $Revision: 1.45 $ apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2000 The Apache Group, http://www.apache.org/

Benchmarking 65.119.108.120 (be patient)...Broken pipe

[pmak@sg1 bin]$ ./ab -n 1000 -c 10 http://65.119.108.120:8080/
This is ApacheBench, Version 1.3c $Revision: 1.45 $ apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2000 The Apache Group, http://www.apache.org/

Server Software:Apache/1.3.22
Server Hostname:65.119.108.120
Server Port:8080

Document Path:  /
Document Length:13 bytes

Concurrency Level:  10
Time taken for tests:   21.109 seconds
Complete requests:  1000
Failed requests:22
   (Connect: 0, Length: 22, Exceptions: 0)
Total transferred:  196578 bytes
HTML transferred:   12714 bytes
Requests per second:47.37
Transfer rate:  9.31 kb/s received

Connnection Times (ms)
  min   avg   max
Connect:   99   101   140
Processing: 5   107   364
Total:104   208   504

Whenever I try to load that URL in my browser, it works so I think it has
something to do with the performance of httpd under load:

[pmak@sg1 bin]$ lynx -dump http://65.119.108.120:8080/

   Hello, world!

Looking in my access_log, I see failed requests like this:

66.33.60.115 - - [25/Oct/2001:22:20:43 -0700] GET / HTTP/1.0 200 0 - 
ApacheBench/1.3d

and successful requests like this:

66.33.60.115 - - [27/Oct/2001:21:31:32 -0700] GET / HTTP/1.0 200 13 - 
ApacheBench/1.3c

Does anyone have an idea what's going on? I can't figure out why some
requests seem to return 0 bytes at random, or why ApacheBench crashes with
Broken pipe. There is nothing in the VirtualHost or the serverwide error
log other than the MaxClients warning:

66.33.60.115 - - [27/Oct/2001:21:31:32 -0700] GET / HTTP/1.0 200 13 - 
ApacheBench/1.3c

MaxClients is set to 50, btw.

server1# uname -a
FreeBSD server1.buildreferrals.com 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Fri Oct 12 
13:36:14 PDT 2001
[EMAIL PROTECTED]:/usr/src/sys/compile/LOCAL  i386

Apache version 1.3.22, mod_perl verison 1.26

Is there a quirk of FreeBSD that I have to account for, perhaps? This is
my first time setting up Apache on a FreeBSD system (I've always used Red
Hat Linux or SunOS before).




Re: Benchmarks on server cluster

2001-10-27 Thread Stas Bekman

Issac Goldstand wrote:

 I've just recieved an OK to do some Benchmarks on a server cluster of 
 16+1 (master) dual 450 Mhz machines (master node is dual 650).  I plan 
 on doing benchmarks and comparing perfornance for the following setups, 
 so far:
 
  
 
   Server cluster using httpd process on each individual node and front 
 end round-robin scheme
 
   Singe server on master node using MOSIX and  high volume of child 
 processes
 
   Trying to think of method to test optimal performance on Beowolf type 
 cluster
 
  
 
   I will also try to play around with different Apache-2 setups if I can 
 figure out how to do so...
 
  
 
 If people have any suggestions for other things to test, or ways to test 
 it, please let me know.


You can try to use Apache::Benchmark which I've started some 1.5 years 
ago, but have never finished it so it wasn't released yet. But I think 
it can be quite helpful, at least to start with. You can get it from:

http://stason.org/works/modules/Apache-Benchmark-0.01.tar.gz


I plan to resume working on this project as a ASF sub-project of 
httpd-test (like Apache::Test) and eventually release it on CPAN, once I 
port it to work with HTTP::ApacheBench and mod_perl 2.0's Apache::Test.

The problem is that currently the module is written in a way that the 
client and the server are supposed to be run on the same machine, since 
the client reconfigures/starts/stops the server. The architecture should 
be extended to use PVM or some similar framework to be able to 
start/stop/configure server on a remote machine.


_
Stas Bekman JAm_pH  --   Just Another mod_perl Hacker
http://stason.org/  mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/




Re: PerlSetVar string value - no \n translation?

2001-10-27 Thread Louis LeBlanc

On 10/27/01 12:01 PM, Steven Lembark sat at the `puter and typed:
  . . .
 
 Quick hack for the moment:
 
 PerlSetVar Blah A long line withbrHTMLbrBreaks In It;
 
 that or set the thing and use:
 
 s/br/\n/gs;
 
 somewhere in the code.

Pretty cool.  I am already doing a hash substitution for tags of the
form _TAG_, so I just added the following to the end of the hash:

_BR_  = \n

and that does the trick!

In case any one cares, my substitution now goes as follows:

my %config = {
  _TAG1_ = $var1,
  _TAG2_ = $var2,
  _TAG3_ = $var3,
  _TAG4_ = $var4,
. . .
  _TAGn_ = $varn,
  _BR_   = \n
 };

my $tagRE = join '|', keys %config;

$alert_message =~ s/($tagRE)/$config{$1}/g;

And it works like a charm.  Shoulda thought of that myself.

Thanks!
Lou
-- 
Louis LeBlanc   [EMAIL PROTECTED]
Fully Funded Hobbyist, KeySlapper Extrordinaire :)
http://www.keyslapper.org ԿԬ

Die, v.:
  To stop sinning suddenly.
-- Elbert Hubbard




Re: PerlSetVar string value - no \n translation?

2001-10-27 Thread Stas Bekman

Louis LeBlanc wrote:

 Hey all.  I don't know how many people are lurking here, since the
 list seems to be very light traffic (the lightest of 8 I sub to), but


That's because mod_perl has no bugs :) so we talk about the weather mostly.

 I have a question regarding PerlSetVar and strings.
 
 Here is what I'm trying to do:
 In httpd.conf:
 Location /MyHandler
   . . .
 PerlSetVar MailMsg Access Report \
 This is a mail message spanning several \
 lines that I would like to mail to a \
 particular address when the handler is \
 invoked.  \
 Unfortunately, it all winds up on one line and \
 any \n included do not get translated.
 /Location
 
 And in my module, I am successfully sending this message to the email
 address, but it arrives looking like this:
 
 Access Report This is a mail message spanning several lines that I 
would like to mail to a particular address when the handler is 
invoked.  Unfortunately, it all winds up on one line and any \n 
included do not get translated.
 
 And the darn thing is all on one line.  '\n' is not translated, etc.
 It looks like the string is proveded as if enclosed in single quotes.
 Which is bad.

Probably you are the first one that needed PerlSetVar to work with \n. 
Why don't you use startup.pl or CPerl sections to set the text, where 
you have a complete control over the string?

Yet another solution would be to use this:

PerlSetVar Foo first line
PerlAddVar Foo second line
PerlAddVar Foo third line


Or you can use the hack suggested by Steven.

_
Stas Bekman JAm_pH  --   Just Another mod_perl Hacker
http://stason.org/  mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/




Re: PerlSetVar string value - no \n translation?

2001-10-27 Thread Louis LeBlanc

On 10/28/01 01:15 PM, Stas Bekman sat at the `puter and typed:
 Louis LeBlanc wrote:
 
  Hey all.  I don't know how many people are lurking here, since the
  list seems to be very light traffic (the lightest of 8 I sub to), but
 
 
 That's because mod_perl has no bugs :) so we talk about the weather mostly.

LOL.  I shoulda known!
Really, I'm a perl/mod_perl newbie with a C background and I've really
been bitten by the Perl bug lately.  It's been a goal of mine to start
playing with it for some time, but only recently have I started
_making_ time to do it.
 
. . .
 
 Probably you are the first one that needed PerlSetVar to work with \n. 

Well, it's good to know I got into it before everything had been done
:).

 Why don't you use startup.pl or CPerl sections to set the text, where 
 you have a complete control over the string?

I'll have to look into those.

 Yet another solution would be to use this:
 
 PerlSetVar Foo first line
 PerlAddVar Foo second line
 PerlAddVar Foo third line
 
 Or you can use the hack suggested by Steven.

Interesting.  It hadn't occurred to me that mod_perl would simply
append the values if Foo had several assigned.  I'll consider that
too, but I think the hack suggested by Steven fits more neatly with
other substitutions I am doing with the string.

Thanks for the ideas.
Lou
-- 
Louis LeBlanc   [EMAIL PROTECTED]
Fully Funded Hobbyist, KeySlapper Extrordinaire :)
http://www.keyslapper.org ԿԬ

Optimization hinders evolution.




Re: [OT] P2EE Redux was: Excellent article on Apache/mod_perl at eToys

2001-10-27 Thread Joe Brenner


 At 02:28 PM 10/23/2001 -0400, Perrin Harkins wrote:
 Stephen Adkins wrote:

  If no one suggests an appropriate list, I propose starting a p2ee group

 Can I just say that P2EE is a horrible, horrible name?  It includes the 
 Java version number (when is J3EE coming out?), as well as Sun's 
 desperate attempt to make it sound like something you buy (Edition) 
 rather than simply a collection of APIs.
 
 Something simple, like Perl Enterprise Project or Perl Enterprise APIs 
 makes more sense to me.

 Several of you have made the same good point.
 And now the naming flame war has already begun... ;-)
 
 Unless there is violent opposition, the name will be 
 
Perl Enterprise Framework
 
 I would rather name it after the outcome (Framework)
 than the process (Project).

PEP is a much better acronym though.  

No more Java beans: use PEP pills!




cvs commit: modperl-2.0/xs/tables/current/Apache FunctionTable.pm StructureTable.pm

2001-10-27 Thread dougm

dougm   01/10/27 09:54:21

  Modified:xs/tables/current/Apache FunctionTable.pm StructureTable.pm
  Log:
  sync
  
  Revision  ChangesPath
  1.23  +19 -3 modperl-2.0/xs/tables/current/Apache/FunctionTable.pm
  
  Index: FunctionTable.pm
  ===
  RCS file: /home/cvs/modperl-2.0/xs/tables/current/Apache/FunctionTable.pm,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- FunctionTable.pm  2001/10/21 04:54:25 1.22
  +++ FunctionTable.pm  2001/10/27 16:54:20 1.23
  @@ -2,7 +2,7 @@
   
   # !!
   # ! WARNING: generated by Apache::ParseSource/0.02
  -# !  Sat Oct 20 22:03:27 2001
  +# !  Sat Oct 27 10:00:40 2001
   # !  do NOT edit, any changes will be lost !
   # !!
   
  @@ -3337,6 +3337,10 @@
   'name' = 'pid'
 },
 {
  +'type' = 'apr_exit_why_e',
  +'name' = 'why'
  +  },
  +  {
   'type' = 'int',
   'name' = 'status'
 }
  @@ -4904,10 +4908,14 @@
   'name' = 'ap_wait_or_timeout',
   'args' = [
 {
  -'type' = 'int *',
  +'type' = 'apr_exit_why_e *',
   'name' = 'status'
 },
 {
  +'type' = 'int *',
  +'name' = 'exitcode'
  +  },
  +  {
   'type' = 'apr_proc_t *',
   'name' = 'ret'
 },
  @@ -9244,6 +9252,10 @@
   'name' = 'exitcode'
 },
 {
  +'type' = 'apr_exit_why_e *',
  +'name' = 'exitwhy'
  +  },
  +  {
   'type' = 'apr_wait_how_e',
   'name' = 'waithow'
 }
  @@ -9259,7 +9271,11 @@
 },
 {
   'type' = 'int *',
  -'name' = 'status'
  +'name' = 'exitcode'
  +  },
  +  {
  +'type' = 'apr_exit_why_e *',
  +'name' = 'exitwhy'
 },
 {
   'type' = 'apr_wait_how_e',
  
  
  
  1.22  +5 -1  modperl-2.0/xs/tables/current/Apache/StructureTable.pm
  
  Index: StructureTable.pm
  ===
  RCS file: /home/cvs/modperl-2.0/xs/tables/current/Apache/StructureTable.pm,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- StructureTable.pm 2001/10/21 04:54:25 1.21
  +++ StructureTable.pm 2001/10/27 16:54:20 1.22
  @@ -2,7 +2,7 @@
   
   # !!
   # ! WARNING: generated by Apache::ParseSource/0.02
  -# !  Sat Oct 20 22:03:29 2001
  +# !  Sat Oct 27 10:00:46 2001
   # !  do NOT edit, any changes will be lost !
   # !!
   
  @@ -1266,6 +1266,10 @@
 },
 {
   'type' = 'apr_dso_handle_t',
  +'elts' = []
  +  },
  +  {
  +'type' = 'apr_exit_why_e',
   'elts' = []
 },
 {
  
  
  



cvs commit: modperl-2.0/xs modperl_xs_util.h

2001-10-27 Thread dougm

dougm   01/10/27 10:14:17

  Modified:src/modules/perl modperl_util.h
   xs   modperl_xs_util.h
  Log:
  moving macros to be available outside .xs:
  mpxs_sv_grow= MP_SvGROW
  mpxs_sv_cur_set = MP_SvCUR_set
  
  Revision  ChangesPath
  1.29  +9 -0  modperl-2.0/src/modules/perl/modperl_util.h
  
  Index: modperl_util.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- modperl_util.h2001/10/21 06:22:45 1.28
  +++ modperl_util.h2001/10/27 17:14:17 1.29
  @@ -34,6 +34,15 @@
   #define SvObjIV(o) SvIV((SV*)SvRV(o))
   #define MgObjIV(m) SvIV((SV*)SvRV(m-mg_obj))
   
  +#define MP_SvGROW(sv, len) \
  +(void)SvUPGRADE(sv, SVt_PV); \
  +SvGROW(sv, len+1)
  +
  +#define MP_SvCUR_set(sv, len) \
  +SvCUR_set(sv, len); \
  +*SvEND(sv) = '\0'; \
  +SvPOK_only(sv)
  +
   #define MP_magical_untie(sv, mg_flags) \
   mg_flags = SvMAGICAL((SV*)sv); \
   SvMAGICAL_off((SV*)sv)
  
  
  
  1.10  +4 -7  modperl-2.0/xs/modperl_xs_util.h
  
  Index: modperl_xs_util.h
  ===
  RCS file: /home/cvs/modperl-2.0/xs/modperl_xs_util.h,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- modperl_xs_util.h 2001/09/25 19:44:03 1.9
  +++ modperl_xs_util.h 2001/10/27 17:14:17 1.10
  @@ -33,14 +33,11 @@
   #define XPUSHs_mortal_iv(iv) EXTEND(SP, 1); PUSHs_mortal_iv(iv)
   #define XPUSHs_mortal_pv(pv) EXTEND(SP, 1); PUSHs_mortal_pv(pv)
   
  -#define mpxs_sv_grow(sv, len) \
  -(void)SvUPGRADE(sv, SVt_PV); \
  -SvGROW(sv, len+1)
  +/* XXX: replace the old mpxs_sv_ macros with MP_Sv macros */
   
  -#define mpxs_sv_cur_set(sv, len) \
  -SvCUR_set(sv, len); \
  -*SvEND(sv) = '\0'; \
  -SvPOK_only(sv)
  +#define mpxs_sv_grow(sv, len)MP_SvGROW(sv, len)
  +
  +#define mpxs_sv_cur_set(sv, len) MP_SvCUR_set(sv, len)
   
   #define mpxs_set_targ(func, arg) \
   STMT_START { \