Server Load - Sessions?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Terriator
Forum Commoner
Posts: 60
Joined: Mon Jul 04, 2005 12:46 pm

Server Load - Sessions?

Post by Terriator »

Hi, currently I'm running very high traffic on my website, hence I'm trying to provide it with a new server to deal with it.

But, while waiting for my new server to be set up, I'm experiencing a rather annoying problem: My users keep getting logged out, as a result of what I think is the server crapping out. It seems as if the sessions are just eliminated at random times? Or is it something else?

And of course, what can be done about it? If anything?

Thanks!

- Terriator
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

you could use database sessions. how many users are really on your site at any given time? what exactally are you storing in the sessions?
Terriator
Forum Commoner
Posts: 60
Joined: Mon Jul 04, 2005 12:46 pm

Post by Terriator »

How does one use database sessions?

I only store a username and such - Nothing much.

I guess it comes up to around 400, perhaps 500 users when all the amaricans are online =) ..
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

It seems as if the sessions are just eliminated at random times? Or is it something else?
Yep, that could very well be exactly what is happening. link
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

That directive in the php ini does NOT indicate that session will expire randomly, it is to set how probable the garbage collection process is to run. The directive session.gc_maxlifetime dictates how old session data must be before PHP will remove it.

However, the host could be deleting session data via a cronjob to empty the temporary directories, which is common.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

A basic example of database sessions is linked from Useful Posts.
Post Reply