Re: mod_perl and 700k files...

2001-05-12 Thread Morbus Iff

>> I'm relatively new to mod_perl... I've got a 700k file that is loaded each
>> time I run a CGI script, so I'm hoping to cache the file using mod_perl
>> somehow. The file will change occasionally (maybe once a week) - the reload
>> of a few seconds isn't worrisome, but it has to be done without restarting
>> the server.
>
>Boy you sure got some complex answers...

You know, I really was thinking the same thing myself, but I'm new with
mod_perl, so I thought it was normal. Funnily enough, I got some offlist
replies about how sending signals causes memory leaks (and how the mod_perl
people won't admit it), and how Stas flips out a lot. Ah well...

>I store a .stor file which is a storable dump of my XML tree. I check the
>mtime of that against the mtime of the .xml file. Whichever is newer I
>load that. Works fast and is very simple.

I'll certainly check it out. I also started looking into SAX to see if I
could do something with that as well, and that looks promising too. Tell
me, is there some write up of the differences between XPath and SAX? And
why I should use either one?

-- 
  ICQ: 2927491  /  AOL: akaMorbus
   Yahoo: morbus_iff/  Jabber: [EMAIL PROTECTED]
   [EMAIL PROTECTED]   /   http://www.disobey.com/



Re: mod_perl and 700k files...

2001-05-10 Thread Morbus Iff

 >> I hope ya understand.
 >
 >Well, I hope we've all got that off our chests.

I'm really hoping so - I *hate* this sort of stuff.

 >Now, have you got enough to get you going OK?

I'm thinking I do, yes. Thanks for asking.


Morbus Iff
.sig on other machine.
http://www.disobey.com/
http://www.gamegrene.com/




Re: mod_perl and 700k files...

2001-05-10 Thread Morbus Iff

 >> Sigh. What the frel is your problem, binky?
 >
 >Stas' problem, which apparently your researches have not discovered,
 >is that he WROTE the guide and when somebody starts spamming fifteen
 >hundred mailboxes because he didn't read it he's understandably a
 >little irritated.

Oh, no, don't get me wrong. I know he wrote the manual. I've even been to 
his website and seen his credentials (unknowingly enough, I've had his perl 
pages bookmarked for quite a while). I totally understand the whole RTFM 
thing. I did RTFM - how else would I have known all the other things to try 
in my original message (reproduced below)?:

 > - PerlSetupEnv Off
 > - PerlModule and PerlRequre
 > - Remove buffering.
 > - Cache from XML::Simple **

It wouldn't have been that big of a deal if he didn't point me to the exact 
same page that I had quoted from in my return email. And now, all of a 
sudden, I'm "spamming"?

 >Please try to understand that a lot of people have put a lot of work
 >into the stuff you are using for free.  Try to remain polite.

I'm not the one who initially accused me of not reading the manual and then 
trying to pull a fast one over on everyone else ("You didn't search the 
guide, even if you try to make everyone believe that you did").

 >We're doing our best to help.  Some of us are very busy.  Stas is very busy.

You don't think I'm busy? I code large projects, run an ISP/webhost, 
maintain a content site called Disobey.com which get a million hits a 
month, and have been doing it for the past four years. Disobey brought the 
world Ghost Sites and NetSlaves, and gets press 
(disobey.com/about/presspit.shtml) frequently enough that it's becoming 
flippin' annoying. But I digress.

I know what it's like to busy. I know what it's like to say "Hey! RTFM!". 
But I don't like being sent to the same page that I quoted from, with 
solutions outside of perl (which I had already said in another reply was 
not what I was looking for), and then to be given an elitism attitude at 
the same time.

If the list feels it best that I unsubscribe, then by all means, say so 
offlist. For the record, however, I'm not the clueless newbie, I did RTFM 
(although, as admitted in another post, skipped the explanation of 
triggering the USR2 signal due to it being related to 'kill' and not a perl 
solution), and was only impolite after the golden rule came into effect.

I hope ya understand.

Morbus Iff
.sig on other machine.
http://www.disobey.com/
http://www.gamegrene.com/




Re: mod_perl and 700k files...

2001-05-10 Thread Morbus Iff

>>>The above code asigns a signal handler for the USR2 signal.
>>>This signal has been chosen because it's least likely to be
>>>used by the other parts of the server.
>>
>> That, unfortunately doesn't tell me what causes a USR2 signal to be sent to
>> Apache. Or when it's caused. I only want to reload the file when said file
>> has changed. Am I supposed to do some checking against the file -M time
>> myself, and then send a USR2 signal myself?
>
>You didn't search the guide, even if you try to make everyone believe that

Sigh. What the frel is your problem, binky?

>talking about using USR2, not the caching technique). The first hit in the
>http://thingy.kcilink.com/modperlguide/debug/Using_the_Perl_Trace.html

Actually, no, not really. That's the same exact page I got when I "didn't"
search the search engine (thus pulling the wool over your elite mod_perl
eyes) before. Strangely, enough, the same quoted sentence in my email, is
golly gosh darn, the second sentence on that page.

And my comments to that page still apply. I will agree, in some sense,
however, that my comments about not "tell[ing] me what causes a USR2
signal" are incorrect. I was looking for a solution in all perl, so when I
saw the kill command, I just stopped reading, since it wasn't what I'm
looking for.

>http://perl.apache.org/guide/porting.html#Configuration_Files_Writing_Dy
>http://perl.apache.org/guide/porting.html#Using_Apache_Reload

The first was more helpful than the second (ignorantly speaking). The thing
that worries me the most is about the 700k file being passed around to all
the children during a ::Reload or other solution. More specifically, is
there anyway to reload a file into the parent, which would automatically be
shared with existing children, and all newly spawned children? Without
restarting the server?

Thanks for the help...

-- 
  ICQ: 2927491  /  AOL: akaMorbus
   Yahoo: morbus_iff/  Jabber: [EMAIL PROTECTED]
   [EMAIL PROTECTED]   /   http://www.disobey.com/



mod_perl and 700k+ files?

2001-05-10 Thread Morbus Iff

Hey there, wondering if anyone could help me with this.

I'm relatively new to mod_perl... I've got a 700k file that is loaded each 
time I run a CGI script, so I'm hoping to cache the file using mod_perl 
somehow. The file will change occasionally (maybe once a week) - the reload 
of a few seconds isn't worrisome, but it has to be done without restarting 
the server.

Any suggestions on exactly the best way to do this? I've going to:

  - PerlSetupEnv Off
  - PerlModule and PerlRequre
  - Remove buffering.
  - Cache from XML::Simple **

** The 700k file is an XML file, read in by XML::Simple. XML::Simple can 
cache that file into memory. Is this how I should do it? Or should I load 
the file from my startup.pl script so that the file is shared amongst all 
the apache children? If that's the case, how would I dynamically reload it?


Morbus Iff
.sig on other machine.
http://www.disobey.com/
http://www.gamegrene.com/




Re: mod_perl and 700k files...

2001-05-09 Thread Morbus Iff

>> Ultimately, I'm looking for something I can do totally from within Perl.
>
>Couldn't you create a Perl script to run as a cron job that could stat
>the file off-line for you and HUP the server when it has changed?
>That would seem easy enough.  You'd just have to work out the perms on
>the cron user to make sure it could affect httpd.  Restarting Apache
>isn't the end of the world, is it?

Well, it's a big deal if you've no "in" with the place you're webhosting
with, sure... No one wants to be told that some lowly customer wants to
restart the server that's running 200 other vhosts...

Granted, I work at the damn webhost, but it's gotten to the point where all
the gizmo's and crap I've added have slowly been dipping the "stop touching
the server, you feature freak" - I'd rather not stress the relationship.

-- 
  ICQ: 2927491  /  AOL: akaMorbus
   Yahoo: morbus_iff/  Jabber: [EMAIL PROTECTED]
   [EMAIL PROTECTED]   /   http://www.disobey.com/



Re: mod_perl and 700k files...

2001-05-09 Thread Morbus Iff

Ok. Thanks for the replies everybody. Collectively, I'm looking for a 
solution that DOES NOT require an Apache restart, or one that requires me 
to use a kill/killall command. I'm not in front of the server 100%, and I 
won't have access to telnet/ssh in to issue commands.

Ultimately, I'm looking for something I can do totally from within Perl.

 >You might have better luck just having your app check -M against the file
 >and reload as needed.  If you don't want to take the hit on every request,
 >you can just use a counter or a "last checked" time kept in a global, and
 >check every 10 minutes or 100 requests or whatever.

 From various other posts, I'm understanding that I can do what I want by 
defining a subroutine in my startup.pl that would reload the file, and then 
I could call that subroutine whenever I determine the file is out of date 
(either through a cache, request, or -M system)...

 >Keep in mind, if you load this data during startup (in the parent) it will
 >be shared, but reloading it later will make a separate copy in each child,
 >chewing up a large amount of memory.  You might have better luck using dbm

That is something I was hoping I wouldn't here ;) ... Even reloading the 
file into the same variable in my startup.pl wouldn't cause the parent to 
share it with new children?


Morbus Iff
.sig on other machine.
http://www.disobey.com/
http://www.gamegrene.com/




Re: mod_perl and 700k files...

2001-05-09 Thread Morbus Iff

 >> Ahhh. Ok. What's this $SIG{'USR2'} thingy. What's that do?
 >
 >http://perl.apache.org/guide

Well, that's all fine and dandy, and I've gone through there before, but 
the only thing the search engine brings up concerning USR2 is:

   >The above code asigns a signal handler for the USR2 signal.
   >This signal has been chosen because it's least likely to be
   >used by the other parts of the server.

That, unfortunately doesn't tell me what causes a USR2 signal to be sent to 
Apache. Or when it's caused. I only want to reload the file when said file 
has changed. Am I supposed to do some checking against the file -M time 
myself, and then send a USR2 signal myself?


Morbus Iff
.sig on other machine.
http://www.disobey.com/
http://www.gamegrene.com/




Re: mod_perl and 700k files...

2001-05-09 Thread Morbus Iff

At 04:24 PM 5/9/01, Robert Landrum wrote:
 >At 3:51 PM -0400 5/9/01, Morbus Iff wrote:
 >>** The 700k file is an XML file, read in by XML::Simple. XML::Simple
 >>can cache that file into memory. Is this how I should do it? Or
 >>should I load the file from my startup.pl script so that the file is
 >>shared amongst all the apache children? If that's the case, how
 >>would I dynamically reload it?
 >
 >Basically, I loaded the file into $My::Data via the startup.pl.
 >
 >Then I did a
 >$SIG{'USR2'} = sub {
 >  open(FILE,'file');
 >  $My::Data = process_file(\*FILE);
 >  close(FILE);
 >};

Ahhh. Ok. What's this $SIG{'USR2'} thingy. What's that do?


Morbus Iff
.sig on other machine.
http://www.disobey.com/
http://www.gamegrene.com/




mod_perl and 700k files...

2001-05-09 Thread Morbus Iff

Hey there, wondering if anyone could help me with this.

I'm relatively new to mod_perl... I've got a 700k file that is loaded each 
time I run a CGI script, so I'm hoping to cache the file using mod_perl 
somehow. The file will change occasionally (maybe once a week) - the reload 
of a few seconds isn't worrisome, but it has to be done without restarting 
the server.

Any suggestions on exactly the best way to do this? I've going to:

  - PerlSetupEnv Off
  - PerlModule and PerlRequre
  - Remove buffering.
  - Cache from XML::Simple **

** The 700k file is an XML file, read in by XML::Simple. XML::Simple can 
cache that file into memory. Is this how I should do it? Or should I load 
the file from my startup.pl script so that the file is shared amongst all 
the apache children? If that's the case, how would I dynamically reload it?



Morbus Iff
.sig on other machine.
http://www.disobey.com/
http://www.gamegrene.com/