Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
If you're looking for something like a count of total memebers signed in or a list of all memebers signed in then you could do what we did.

That is just have each page request store which user the page was requested for and the current time in a database table. Make the UserID field unique and it shouldn't grow out of hand. When looking to get stats you can just SELECT COUNT(*) FROM ActiveSessions or SELECT UserID FROM ActiveSessions. I would suggest clearing old records from the table with a 5 minute cron or a pseudo-random system (maybe 1 in 500 page loads).

Another thing you can do is actually have summary data that is generated either a) every say 5 minutes or b) whenever that data is changed (ie someone logged in or out). This plan works better on things that don't change very often or where you have a high number of records to deal with.

Note that this method can get database intensive when you get a lot of site traffic. For the above linked site the sessions database does not run on the same machines that run the site's actual content database.

PS: Yes I wrote machines as in plural. 60 Gigs of of web files (ie not including protocol overhead) is not an odd weekday. I think those databases get a fair bit of work for a website. - frink

In reply to Re^3: Listing Active CGI::Sessions by superfrink
in thread Listing Active CGI::Sessions by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (1)
As of 2024-04-18 23:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found