[nycphp-talk] Hmm, how to count 'online' users?
Matthew Terenzio
webmaster at localnotion.com
Thu Aug 12 09:46:00 EDT 2004
On Aug 12, 2004, at 9:25 AM, Mitch Pirtle wrote:
> Joseph Crawford Jr. wrote:
>
>> Better yet just count the files that are in your session save
>> directory ;)
>>
>
> I'd love to, but I need to aggregate those counts in groups ("125
> people in group A" etc.).
I haven't thought this out Mitch, but could one possibly name each
group session differently and then get a count of all active sessions
with each individual named session. Don't flame me anyone, but this
would be a little more straight forward inside a servlet container.
>
> One of the biggest issues is lock contention on the accounts table, as
> it is constantly getting hammered with SELECTs ('SELECT count(*) FROM
> accounts WHERE group = 3 AND online = 1'), and constantly getting
> hammered with UPDATEs when 10,000 people show up and login ('UPDATE
> accounts SET online = 1 WHERE id = 12323').
>
> Ultimately, the output would include:
>
> group 1 3,545 online
> group 2 4,292 online
> group 3 5,123 online
> ...and so on...
>
> The site gets over 3.5 million page views daily, and averages around
> 10,000 people logging in daily. Served on two dual Xeon servers, the
> hardware is fine, but the statistics in MySQL show that InnoDB has
> some major lock issues:
>
> ----------
> SEMAPHORES
> ----------
> OS WAIT ARRAY INFO: reservation count 1823, signal count 1709
> Mutex spin waits 153589, rounds 772170, OS waits 437
> RW-shared spins 1276, OS waits 587; RW-excl spins 531, OS waits 103
>
>
> These stats were collected right after a restart in the morning, with
> less than 1,000 people online.
>
> I'm redesigning the site with fixes to the most glaring architectural
> issues (using classes instead of redundant includes scattered randomly
> about the filesystem is a big plus), and also will be switching to
> PostgreSQL ;-)
>
> So again, my biggest dilemma is deciding how to separate the account
> info that is static (username, email) with stuff that is constantly
> changing (online status, last logged in timestamp). Any pearls of
> wisdom out there?
>
> -- Mitch
>
> _______________________________________________
> New York PHP Talk
> Supporting AMP Technology (Apache/MySQL/PHP)
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.newyorkphp.org
More information about the talk
mailing list