Re: memory usage

2003-12-19 Thread Hans de Groot
Hi,

I am using 1.3.6. and apache 1.3.27

Wel it keeps getting bigger with one page. When I reload it or click through it
it keeps growing.

To ask a beginners question:

if I make a silly script like this:
--
[*
open F,")
{
$data.=$_;
}
close();
$counter=0;
while ($data =~ s/image.jpg/$counter.jpg/)
   {
$counter++;
   }
*]


[+$data+]




Do I need to empty the vars used or if every thing works okay this should not
cause my apache process to grow all the time? (if this is the only page in the
server)


Than an other question
I installed embperl a while ago, with storable and apache session and made the
session database.

What is the properway to cleanup the session database? Right now I just delete
the content of the session table but this also deletes the sessions of the
current users, which is a it rude.

Regards

Hans de Groot





Met vriendelijke groet,

Hans de Groot



Quoting Gerald Richter <[EMAIL PROTECTED]>:

> >
> > I do have one problem. My apache processes take a lot of memory.
> > Every request of a page it grows in size.
>
> mod_perl httpd takes a lot of memory, that can't be changed. Every new
> request will eat up more memory, because Perl code is compiled. If you
> request only one page more than once memory useage should stay the same,
> that's how you can test if any of your code has a memory leak.
>
> BTW Which Embperl version do you are using?
>
> Gerald
>
> --
> Gerald Richter ecos electronic communication services gmbh
> IT-Securitylösungen * dynamische Webapplikationen * Consulting
>
> Post:   Tulpenstrasse 5  D-55276 Dienheim b. Mainz
> E-Mail: [EMAIL PROTECTED]  Voice:   +49 6133 939-122
> WWW:http://www.ecos.de/  Fax: +49 6133 939-333
> --
> |
> |   ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
> |
> +-
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Pr server data

2003-12-19 Thread Kaare Rasmussen
Hi Gerald

> You can simply put it in a varibale and it will stick. Since Embperl
> normaly cleans up all package variables you can put it in a different
> namespace e.g.

Thanks - it works great! Is this documented? I searched the docs and with 
Google, but...

-- 
Kaare Rasmussen--Linux, spil,--Tlf:3816 2582
Kaki Datatshirts, merchandize  Fax:3816 2501
Howitzvej 75   Åben 12.00-18.00Email: [EMAIL PROTECTED]
2000 FrederiksbergLørdag 12.00-16.00   Web:  www.suse.dk


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Pr server data

2003-12-19 Thread Gerald Richter
Kaare Rasmussen wrote:
> Hi Gerald
>
>> You can simply put it in a varibale and it will stick. Since Embperl
>> normaly cleans up all package variables you can put it in a different
>> namespace e.g.
>
> Thanks - it works great! Is this documented? I searched the docs and
> with Google, but...

This is not Embperl specify, more a mod_perl thing. I guess you will find
something about it in the mod_perl guide (see perl.apache.org)

Gerald


--
Gerald Richter ecos electronic communication services gmbh
IT-Securitylösungen * dynamische Webapplikationen * Consulting

Post:   Tulpenstrasse 5  D-55276 Dienheim b. Mainz
E-Mail: [EMAIL PROTECTED]  Voice:   +49 6133 939-122
WWW:http://www.ecos.de/  Fax: +49 6133 939-333
--
|
|   ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
|
+-


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: memory usage

2003-12-19 Thread Gerald Richter
Hi,
>
> I am using 1.3.6. and apache 1.3.27
>
> Wel it keeps getting bigger with one page. When I reload it or click
> through it it keeps growing.
>

Then there must be something inside the page, that grows.

> To ask a beginners question:
>
> if I make a silly script like this:
> --
> [*
> open F," while()
> {
> $data.=$_;
> }
> close();

this should be

close F ;


> $counter=0;
> while ($data =~ s/image.jpg/$counter.jpg/)
>{
> $counter++;
>}
> *]
> 
> 
> [+$data+]
> 
> 
> 
>

Not sure if the close syntax error has memory side effects, but the rest of
the page is ok

> Do I need to empty the vars used

No, EMbperl does this for you

>or if every thing works okay this
> should not cause my apache process to grow all the time? (if this is
> the only page in the server)
>

Yes, it should not grow

>
> Than an other question
> I installed embperl a while ago, with storable and apache session and
> made the session database.
>
> What is the properway to cleanup the session database? Right now I
> just delete the content of the session table but this also deletes
> the sessions of the current users, which is a it rude.
>

You might add a datetime column and select on that what to delete. Search
the mailing listarchive, there should be some more ideas

Gerald


--
Gerald Richter ecos electronic communication services gmbh
IT-Securitylösungen * dynamische Webapplikationen * Consulting

Post:   Tulpenstrasse 5  D-55276 Dienheim b. Mainz
E-Mail: [EMAIL PROTECTED]  Voice:   +49 6133 939-122
WWW:http://www.ecos.de/  Fax: +49 6133 939-333
--
|
|   ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
|
+-


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Cookie and Cookieless sessions

2003-12-19 Thread Stefan Cars
Hi!

No since problems with tables forces me to use EmbperlBlocks. (Since I have
tables starting and ending in Executes...).

/ Stefan 

-Original Message-
From: Gerald Richter [mailto:[EMAIL PROTECTED] 
Sent: den 19 december 2003 05:52
To: Stefan Cars
Cc: [EMAIL PROTECTED]
Subject: Re: Cookie and Cookieless sessions

Stefan Cars wrote:
> What is the status of this, Gerald ? Is that implemented yet ??
>
> smodeUDatUrl = 4
>
>   The session id for the user session will passed as a part of the
> URL. NOT YET IMPLEMENTED!!
>

No it's not implemented, but what you want is

smodeUDatParam

(smodeUDatUrl would do something like //path/data.epl)

Gerald


>
> Kind Regards,
> Stefan Cars
>
> -Original Message-
> From: Gerald Richter [mailto:[EMAIL PROTECTED]
> Sent: den 2 december 2003 16:20
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: Cookie and Cookieless sessions
>
> Hi,
>
>>
>> Basically what I want to do is to have standard cookied sessions,
>> however if user doesn't support cookies then it falls back to
>> cookieless sessions.
>>
>> Can I
>> a)  Have both cookie and cookieless sessions running at the same time
>> - if so how do I configure this.
>
> In Embperl 2.0 look at EMBPERL_SESSION_MODE
>
>> b)  Optionally pass the session_id as a param - so if there isn't a
>> cookie, but there is a param then it loads the session using the
>> param session id.  If so whats the correct name of the session id
>> (as in ?session_id=sds232sd23dsgrfgf355565)
>>
>
> If you set session_mode correctly Embperl will do this for you
> automaticly
>
> Gerald
>
>
>>
>> Regards
>>
>>
>> Pete
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>
> --
> Gerald Richter ecos electronic communication services gmbh
> IT-Securitylösungen * dynamische Webapplikationen * Consulting
>
> Post:   Tulpenstrasse 5  D-55276 Dienheim b. Mainz
> E-Mail: [EMAIL PROTECTED]  Voice:   +49 6133 939-122
> WWW:http://www.ecos.de/  Fax: +49 6133 939-333
> --
>>
>>   ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
>>
> +-
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

--
Gerald Richter ecos electronic communication services gmbh
IT-Securitylösungen * dynamische Webapplikationen * Consulting

Post:   Tulpenstrasse 5  D-55276 Dienheim b. Mainz
E-Mail: [EMAIL PROTECTED]  Voice:   +49 6133 939-122
WWW:http://www.ecos.de/  Fax: +49 6133 939-333
--
|
|   ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
|
+-


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: memory usage

2003-12-19 Thread Kee Hinckley
At 1:44 PM +0100 12/19/03, Hans de Groot wrote:
>if I make a silly script like this:

Just so you know, that while is *real* inefficient.  What you really want is something 
like:
s/foo.jpg/++$counter . ".jpg"/ge

See the below results.  I did them in 1 iteration and 10 separately because the while 
version was too slow for me to wait for the results if I tried it 10 times.

Benchmark: timing 1 iterations of per-line g, slurp g, while data, while inline...
per-line g:  0 wallclock secs ( 0.14 usr +  0.00 sys =  0.14 CPU) @  7.14/s (n=1)
(warning: too few iterations for a reliable count)
   slurp g:  0 wallclock secs ( 0.06 usr +  0.00 sys =  0.06 CPU) @ 16.67/s (n=1)
(warning: too few iterations for a reliable count)
while data: 44 wallclock secs (35.37 usr +  0.00 sys = 35.37 CPU) @  0.03/s (n=1)
(warning: too few iterations for a reliable count)
while inline: 44 wallclock secs (35.20 usr +  0.00 sys = 35.20 CPU) @  0.03/s (n=1)
(warning: too few iterations for a reliable count)
   s/iter   while data while inline   per-line g  slurp g
while data   35.4   --  -0%-100%-100%
while inline 35.2   0%   ---100%-100%
per-line g  0.140   25164%   25043%   -- -57%
slurp g  6.00e-02   58850%   58567% 133%   --

at 10 iterations (with the slow two turned off)

Benchmark: timing 10 iterations of per-line g, slurp g, while data, while inline...
per-line g:  2 wallclock secs ( 1.41 usr +  0.00 sys =  1.41 CPU) @  7.09/s (n=10)
   slurp g:  1 wallclock secs ( 0.64 usr +  0.00 sys =  0.64 CPU) @ 15.62/s (n=10)
while data:  0 wallclock secs ( 0.00 usr +  0.00 sys =  0.00 CPU)
(warning: too few iterations for a reliable count)
while inline:  0 wallclock secs ( 0.00 usr +  0.00 sys =  0.00 CPU)
(warning: too few iterations for a reliable count)
Rate  per-line gslurp g while data 
while inline
per-line g7.09/s  --   -55%  -100% 
   -100%
slurp g   15.6/s120% --  -100% 
   -100%
while data   1/s 141000% 64016% -- 
  0%
while inline 1/s 141000% 64016% 0% 
  --


#!/usr/bin/perl
#
use strict;
use warnings;

use Benchmark qw(cmpthese);

cmpthese($ARGV[0] || 10, {
'while data'=> q{
return if ($ARGV[0] > 1);   # too slow
#print STDERR "while data: ";
my ($data, $counter);
$data = '';
open(T, ") {
$data .= $_;
}
close(T);
$counter = 0;
while ($data =~ s/e/$counter/) { ++$counter; }
#print STDERR "$counter\n";
},
'while inline'  => q{
return if ($ARGV[0] > 1);   # too slow
#print STDERR "while inline: ";
my ($data, $counter);
$counter = 0;
open(T, ") {
while (s/e/$counter/) { ++$counter; }
}
close(T);
#print STDERR "$counter\n";
},
'per-line g'=> q{
#print STDERR "per-line g: ";
my ($data, $counter);
$counter = 0;
open(T, ") {
s/e/++$counter/ge;
}
close(T);
#print STDERR "$counter\n";
},
'slurp g'   => q{
#print STDERR "slurp g: ";
my ($data, $counter);
$counter = 0;
open(T, ";
close(T);
$data =~ s/e/++$counter/ge;
#print STDERR "$counter\n";
},
});

-- 
Kee Hinckley
http://www.messagefire.com/ Next Generation Spam Defense
http://commons.somewhere.com/buzz/  Writings on Technology and Society

I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Viewing Previous Request's Post Data

2003-12-19 Thread Bruce Kessler
If I were trying to implement a page for an ErrorDocument directive for a
500 error, and I wanted to get the post data from the users request that
caused the error, how could I get this information back from Apache or
Embperl?  I am under the impression that using $req_rec->content() will not
work, nor will $req_rec->prev()->content(), am I right?  It seems that the
data is consumed already by the time I get the request object and %fdat is
empty.

Thanks for any help you can provide.

Bruce Kessler


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: memory usage / session cleanup

2003-12-19 Thread Wim Kerkhoff
Hans de Groot wrote:

Than an other question
I installed embperl a while ago, with storable and apache session and made the
session database.
What is the properway to cleanup the session database? Right now I just delete
the content of the session table but this also deletes the sessions of the
current users, which is a it rude.
 

Here's what I do...

I'm using PostgreSQL to store the sessions.

In the sessions table, I added an extra column for stamp_inserted with 
type timestamp, in addition to the id and a_session fields.

I set the default on this timestamp column to be now(). Here's the DDL 
from pg_dump:

CREATE TABLE sessions (
   id character(32) NOT NULL,
   a_session text,
   stamp_inserted timestamp without time zone DEFAULT now()
);
ALTER TABLE ONLY sessions
   ADD CONSTRAINT sessions_pkey PRIMARY KEY (id);
Then, have a cronjob that runs a DBI script, with something like:

$dbh->do("delete from sessions where stamp_inserted <  now() - interval 
'2 days'")

You can't do this with MySQL, since it won't let you set a default value 
to a function, only a constant (null, 1, 'foo', etc).

HTH,

Wim

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]