Re: database-based sessions for 3rd party php app [message #179028 is a reply to message #179021] |
Wed, 05 September 2012 14:21 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 9/5/2012 8:39 AM, Axel wrote:
> Am Mittwoch, 5. September 2012 14:11:11 UTC+2 schrieb Jerry Stuckle:
>
>> You can set session.save_handler in the php.ini file to point at a
>> different handler. Define your handler and write the data to the
>> database. Instructions are in the PHP doc.
>
> really? I found just a bunch of stuff describing the general principle. I'll have another look, thanks.
>
>> Alternatively, you can also set an auto prepend file to include your
>> session handler code in every file.
>
> ah! That's kind of what I had in mind :) . I didn't know that - I'm not a php developer.
>
>> However, are you sure this will help performance? Why do you think your
>> current session handling is causing performance problems? Not that I
>> like using NFS shares, but they're typically faster than remote databases.
>
> Hm. That's a good question. _Right Now_ we have 57000 active sessions, and a "dir" on the directory with them takes 20+ seconds. Also the NFS serves most of our content, so bottom line - I have no clue, but I think this might improve performance - which is kind of neccessary. So basically I wanted to change and have a look.
>
>
> thanks for your help!
> Axel.
>
>
The other question is - why do you have 57K sessions? What's your
session expiration time? Too long, maybe?
Or is your garbage collection set too low so it's not cleaning up
expired sessions?
57K concurrent sessions would be a *very busy* website - probably tens
of millions of hits per day.
But if they are valid, then using a database *might* speed things up.
But remember - most of the time spent with the dir will be in
transferring the entire directory listing over the network and
displaying it - neither of which needs to be done by a session handler.
The real test would be how long it takes to open a session file in the code.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|