Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Apache::Sessions -- Good

by gregorovius (Friar)
on Oct 24, 2000 at 01:05 UTC ( [id://38027]=note: print w/replies, xml ) Need Help??


in reply to Apache::Sessions -- Good, Bad or just Ugly?

Actually, database connections would happen only on the first pageload per apache server spawned. Apache::Session sits on top of DBI, and database connections are cached (as any global variables are) if you use mod_perl. If you use Session on MySql your sessions are still going to be very fast, and any performance difference from memory-only sessions would in most cases be offset by the object persistance advantage you get with Apache::Session (otherwise you'd usually need to fill in the session data yourself, with the accompanying db quieries).

I recommend you look at the mod_perl documentation for more on how DB connections are cached.

Replies are listed 'Best First'.
RE: Re: Apache::Sessions -- Good
by ismail (Acolyte) on Oct 24, 2000 at 01:16 UTC
    Well, this opens up a whole other discussion about DB handle caching.. I've got memory (512MB) to burn, so can i use mod_perl to cache a whole load of handles (say 10 per httpd?) and use them interchangeably between whichever sessions? This would obviously improve a bit on performance.
      with Apache::DBI each httpd process automatically opens up just as many handles as it needs. If each of your .cgi scripts only does one DBI->Connect then only one handle is needed. Extra handles would only impose extra overhead. The magic that Apache:::DBI gives you is that once it has a handle open, it doesn't close it so your next call to a .cgi running on that httpd process will re-use that earlier handle.
        OK, I got you.. that makes sense; wouldn't need 10 handles per httpd session. What about scaling there? Say 400 simultaneous instances are created; so we now have 400 reusable handles? And where/when do these get cleaned up, with their parent httpd process? chock full o' q's --ismail

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://38027]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-26 05:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found