Re: web application speed problem with OO modules

2005-08-15 Thread Perrin Harkins

Badai Aqrandista wrote:
I doubt the ApacheHandler::handler subroutine runs that long, because it 
only shows the accumulated time used by other subroutines it calls. That 
makes the profile isn't really accurate. How do I make it to show the 
statistics of the subroutines called from the handler?


First, give dprofpp the flag that makes it sort by wall time, not by CPU 
time.  Otherwise, things that take most of the time in the average 
program, like I/O, will appear to be very fast.


Second, make sure you initialize the debugger before loading any of the 
code that you want to profile, like this:

Perl
require Apache::DB;
Apache::DB-init;
/Perl

Any code that you compile (e.g. use from startup.pl) before this will 
not get profiled at all.


- Perrin


Re: ApacheCon Europe and http://httpd.apache.org/test/

2005-08-15 Thread Philip M. Gollucci

Geoffrey Young wrote:

I believe anyone that is an httpd committer can change it.



I think that's right.

speaking of which, the real Apache-Test homepage is here

  http://perl.apache.org/Apache-Test/

anyone looking for something to contribute back might spend some time
sprucing it up - IIRC there is already an infrastructure in place to support

  Apache-Test/api
  Apache-Test/user/perl
  Apache-Test/user/php


I saw that.. The link of perl.apache.org is blank though right ?
--
END

What doesn't kill us can only make us stronger.
Nothing is impossible.

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
   http://www.liquidation.com
   http://www.uksurplus.com
   http://www.govliquidation.com
   http://www.gowholesale.com



Re: How to get the SERVER_SOFTWARE string

2005-08-15 Thread Philip M. Gollucci

Nikolay Ananiev wrote:

Hello,
Is there any way to get the SERVER_SOFTWARE string in mod_perl 2?
I tried $r-psignature, but this doesn't work if ServerSignature is Off in
httpd.conf.



my $server_software = $ENV{SERVER_SOFTWARE};



--
END

What doesn't kill us can only make us stronger.
Nothing is impossible.

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
   http://www.liquidation.com
   http://www.uksurplus.com
   http://www.govliquidation.com
   http://www.gowholesale.com



Re: How to get the SERVER_SOFTWARE string

2005-08-15 Thread Geoffrey Young


Philip M. Gollucci wrote:
 Nikolay Ananiev wrote:
 
 Hello,
 Is there any way to get the SERVER_SOFTWARE string in mod_perl 2?
 I tried $r-psignature, but this doesn't work if ServerSignature is
 Off in
 httpd.conf.


 my $server_software = $ENV{SERVER_SOFTWARE};

Apache2::ServerUtil::get_server_version()

?

--Geoff


Re: is there a templating system that....

2005-08-15 Thread David Nicol
On 8/15/05, jonathan vanasco [EMAIL PROTECTED] wrote:

 
 Petal templates do look nice, because
  span tal:replace=my_var/hello_world 'Jack'Hola, Mundo!/span
 is valid xhtml AND lets you have mockup text that is then replaced
 
 Unfortunately, petal supports all the smart features of tal like if/
 loops (stuff I didn't want in there), but its ok.  i'll deal.

Hmm.  So if you were doing substituting with

$template_copy =~ s
{span tal:replace=(.+?).+?/span}
{$template_var_hashref-{$1}}g;

would that do everything you need?

I'm seriously considering publishing a Template::Substitution::KISS or
something like that in a futile attempt to piss higher than Uri Guttman.

With the substitution target regex configurable, it could be used against
arbitrary variable identification syntaces.


-- 
David L Nicol
Do you really not know the difference between
underscore and dash or are you just being difficult?


Re: is there a templating system that....

2005-08-15 Thread Matisse Enzer
On Mon, 15 Aug 2005, David Nicol wrote:
 
 I'm seriously considering publishing a Template::Substitution::KISS or
 something like that in a futile attempt to piss higher than Uri Guttman.

Just a data point:
  I'm the maintainer of Text::TagTemplate and will soon release a version
  that lets you set the regexes that define the start and end of a tag.
  I'm happy to send an alpha version to anyone who asks.

-M



Re: is there a templating system that....

2005-08-15 Thread Jonathan Vanasco


Yep.  Validate templates.

What the template renders to better damn well be valid -- but if I  
use a templating system that allows for invalid templates, then it  
becomes my job to restructure them to be valid in addition to doing  
the logic and substitution.  Thats a mess.


I want designers that I work with to make valid templates that I just  
swap stuff in and out of.  I run everything that I get through  
xmllint, and if its good I use it, if not, they fix it -- not me.



On Aug 15, 2005, at 4:36 PM, David Hodgkinson wrote:


Huh? you want to validate templates? A template is just that. What
it renders to should be validated!


Re: is there a templating system that....

2005-08-15 Thread Perrin Harkins
On Mon, 2005-08-15 at 16:39 -0400, Jonathan Vanasco wrote:
 What the template renders to better damn well be valid -- but if I  
 use a templating system that allows for invalid templates, then it  
 becomes my job to restructure them to be valid in addition to doing  
 the logic and substitution.  Thats a mess.

Since Petal (and HTML_Tree, but that's a dead project) are the only ones
that do this at all, I'd say most people are doing just fine without
templates that are valid XML.  I don't remember you mentioning this
requirement earlier.  If you had, I would have told you Petal was your
only option.

- Perrin





Re: is there a templating system that....

2005-08-15 Thread David Nicol
On 8/15/05, David Hodgkinson [EMAIL PROTECTED] wrote:

  HTML::Template got ruled out because the only way to get templates
  to render as xhtml valid is to use info as comments
 
 Huh? you want to validate templates? A template is just that. What
 it renders to should be validated!

By having validatable templates, he can reduce his interactions with
the designers.

If the target regex was set to something like

 use hypothetical_substituting_template_system
  template_vars_hashref = \(our %TemplateVars),
  target_regex = qr{font color=FF\s*([^]+?)\s*/font};

for example, the designer would be able to specify template names in by
coloring the text red, without viewing any source code.




-- 
David L Nicol
Do you really not know the difference between
underscore and dash or are you just being difficult?


Re: is there a templating system that....

2005-08-15 Thread Perrin Harkins
On Mon, 2005-08-15 at 15:48 -0500, David Nicol wrote:
 If the target regex was set to something like
 
  use hypothetical_substituting_template_system
   template_vars_hashref = \(our %TemplateVars),
   target_regex = qr{font color=FF\s*([^]+?)\s*/font};
 
 for example, the designer would be able to specify template names in by
 coloring the text red, without viewing any source code.

You won't get far with that before you need to use a variable in a place
where the font tags would violate XHTML.  Petal is a much more complete
solution.

- Perrin



Re: is there a templating system that....

2005-08-15 Thread Jonathan Vanasco

On Aug 15, 2005, at 4:45 PM, Perrin Harkins wrote:

Since Petal (and HTML_Tree, but that's a dead project) are the only  
ones

that do this at all, I'd say most people are doing just fine without
templates that are valid XML.  I don't remember you mentioning this
requirement earlier.  If you had, I would have told you Petal was your
only option.


Yeah, I never mentioned that... although it was mostly because I  
assumed that most templating languages would provide for that.  I  
think looking at everyone's suggestions and talking with everyone  
pushed me more towards Petal too.


HTML::Template does provide for it in a roundabout way - using  
comments, and the new version of Text::Tagtemplate handles it well.   
Neither are 'viewable' templates.


On Aug 15, 2005, at 4:48 PM, David Nicol wrote:

By having validatable templates, he can reduce his interactions with
the designers.


That's pretty much dead on.

Ironically, right now I'll be doing the bulk of the html design and I  
wish I could reduce my own interactions with myself, but I don't know  
if that's possible.  Looking into the future I want to be able to  
compartmentalize responsibility.  And blame.


On Aug 15, 2005, at 4:14 PM, David Nicol wrote:

I'm seriously considering publishing a Template::Substitution::KISS or

I'm a firm believer in KISS


Re: [mp2] make test failure in t/api/access2

2005-08-15 Thread Michael G Schwern
On Fri, Aug 12, 2005 at 09:19:13PM -0700, Stas Bekman wrote:
 On Fri, Aug 12, 2005 at 08:47:30PM -0700, Stas Bekman wrote:
 
 e.g. inside a handler t/response/TestAPI/access2.pm
 
 
 Put it in there and didn't see any extra output in STDERR or error.log.
 
 what test are you running?
 
 t/TEST t/api/access2.t

That test.


-- 
Michael G Schwern [EMAIL PROTECTED] http://www.pobox.com/~schwern
Reality is that which, when you stop believing in it, doesn't go away.
-- Phillip K. Dick


Re: is there a templating system that....

2005-08-15 Thread Perrin Harkins
On Mon, 2005-08-15 at 17:18 -0400, Jonathan Vanasco wrote:
 Yeah, I never mentioned that... although it was mostly because I  
 assumed that most templating languages would provide for that.

It's actually an unusual thing to want.  Valid XHTML templates are not
guaranteed to look correct in a browser or to generate valid XHTML
output.  (That would be XSLT.)  Also, people who want to support a wide
variety of browsers can't use strict XHTML, according to my local web
standards expert.

- Perrin



Re: is there a templating system that....

2005-08-15 Thread Perrin Harkins
On Mon, 2005-08-15 at 17:02 -0500, David Nicol wrote:
 How do you get, for instance, netscape composer, to generate a span tag?

I don't think people use Netscape Composer for real websites.  I
sometimes use it for writing documentation, but that's about it.

 Do the industrial GUI HTML tools all provide span tags?

I think DreamWeaver does.  It's not a MSFT tool though.  Most of the
good HTML coders will use either DreamWeaver or a text editor.

- Perrin



Re: web application speed problem with OO modules

2005-08-15 Thread Frank Wiles
On Mon, 15 Aug 2005 11:42:52 -0400
Perrin Harkins [EMAIL PROTECTED] wrote:

 Frank Wiles wrote:
Give Apache::SmallProf a try.  Where Apache::DProf shows you the
subroutine calls, SmallProf will show you a profile on a line by
line basis.  This should help you zero in on what is causing the
slowness.
 
 I'd say just the opposite in most cases.  Usually you want to see
 which  subs are taking the time.  SmallProf is mostly useful when your
 subs are  much too big.
 
 It is very common though for people to not properly initialize the 
 debugger when using DProf and thus not get results for most of their 
 code.  That often leads them to think they should use a different 
 profiler, like SmallProf.

  Yup that's exactly what I was thinking, I should have thought about
  the initialization issue. 

 -
   Frank Wiles [EMAIL PROTECTED]
   http://www.wiles.org
 -



Re: web application speed problem with OO modules

2005-08-15 Thread Badai Aqrandista


First, give dprofpp the flag that makes it sort by wall time, not by CPU 
time.  Otherwise, things that take most of the time in the average program, 
like I/O, will appear to be very fast.


Second, make sure you initialize the debugger before loading any of the 
code that you want to profile, like this:

Perl
require Apache::DB;
Apache::DB-init;
/Perl

Any code that you compile (e.g. use from startup.pl) before this will not 
get profiled at all.


- Perrin


Thanks for the replies...

I'll give it a try...

---
Badai Aqrandista
Cheepy (?)

_
SEEK: Over 80,000 jobs across all industries at Australia's #1 job site.
http://ninemsn.seek.com.au?hotmail




Re: [mp2] make test failure in t/api/access2

2005-08-15 Thread Stas Bekman

Michael G Schwern wrote:

On Fri, Aug 12, 2005 at 09:19:13PM -0700, Stas Bekman wrote:


On Fri, Aug 12, 2005 at 08:47:30PM -0700, Stas Bekman wrote:



e.g. inside a handler t/response/TestAPI/access2.pm



Put it in there and didn't see any extra output in STDERR or error.log.


what test are you running?

t/TEST t/api/access2.t



That test.


Where does it go then?  Are you sure you've applied the patch and the warn 
statement is there?


--
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


apache children waits for each other? (was: Re: web application speed problem)

2005-08-15 Thread Badai Aqrandista

Hi all,

My mod_perl web app uses memcached to cache most of the (MySQL) database 
query results and as the session storage (Apache::Session::Memcached). When 
doing performance tests with httperf, I found that apache processes waits 
for each other. I mean: all requests are accepted (apache forks off lots of 
children), then processed (no process finishes), and after a while, all the 
processes finish almost at the same time...


If I put warns in the apache handler's start and end, it gives this output 
(edited for brevity, md5 hash in the end is the session ids, just disregard 
them):


... output from 90+ of other warns...

Start process 30324: Tue, 16 Aug 2005 11:00:23 
EST,af263d03f531584c4d05c7f3df55c7d4
Start process 30326: Tue, 16 Aug 2005 11:00:23 
EST,931f8a3a2de409fb3285c3bd038ec7b6
Start process 30325: Tue, 16 Aug 2005 11:00:23 
EST,48ca7271dab9037f3a7426a6a68789e5
Start process 30314: Tue, 16 Aug 2005 11:00:23 
EST,259709a683879491498cb81055466948


... after a while, suddenly the following output comes out ...

End process 29803: Tue, 16 Aug 2005 11:05:47 
EST,dc7e7c893f0ee15b0b6c94d061f9493c
End process 30337: Tue, 16 Aug 2005 11:05:49 
EST,73f520865a13715e02d183c5cbb920d4
End process 30002: Tue, 16 Aug 2005 11:05:49 
EST,cbfb00260afade004d3cc3086f425272
End process 30003: Tue, 16 Aug 2005 11:05:51 
EST,b84da97b68df5f54e336a7767d64a1f8


... output of other 90+ warns ...

It's like they are not processed concurrently. I wonder why does it happen? 
Is it memcached? Or is it how apache works? Or is it because of the 
benchmarking application that I use?


Thanks...

---
Badai Aqrandista
Cheepy (?)

_
SEEK: Over 80,000 jobs across all industries at Australia's #1 job site.
http://ninemsn.seek.com.au?hotmail




Re: is there a templating system that....

2005-08-15 Thread David Nicol
On 8/15/05, Matisse Enzer [EMAIL PROTECTED] wrote:

 Just a data point:
   I'm the maintainer of Text::TagTemplate and will soon release a version
   that lets you set the regexes that define the start and end of a tag.

FWIW, I have just uploaded TipJar::Template::fill to CPAN.  It
is an abstraction around the s/// operator, that creates fill subroutines
in the caller's package, that substitute data into templates.  It defaults
to using [square_brackets] but takes regex as an argument, so it
could be configured to read simple petal templates or templates from
any other system as long as variable substitution is all you want to do.

The hash from which the data is read to substitute in is configurable
with a hashref argument and defaults to a hash with the same name
as the subroutine, which defaults to fill.

Please direct feedback on it to me off-list and I will modify the documentation
accordingly, for instace including a list of regexes to make it handle simple
replacement templates from all the systems Perrin Harkins lists in his
comparison
article.

-- 
David L Nicol
The original republican:
http://cronos.advenge.com/pc/Honest_Abe