A bit ago I noticed that Facebook.com activity peaks around midnight to 1 in the morning, at least with my own friends. Then again - I hardly ever log on. Out of the curiosity my observation generated and a bet with a friend I installed Greasemonkey and spent 10 minutes to write a script.
Facebook has a new feature, where they display the number of your friends online at a given time - live. It looks like they use AJAX to connect to a server and wait for a response. On a timeout - they don’t bother updating the number of users recorded. If the server responds, the scripts parse data from the return value and updates it in the bar at the bottom of the page. This is kind of an ugly workaround - but is something I implemented myself for an AJAX-based chatroom in an unfinished project. It’s fairly resource intense - well, just considering each AJAX request means another TCP handshake, another thread to handle to handle the response, another database lookup (and I’m assuming the databases aren’t kept on every single server in their network - so there’s another TCP handshake). AJAX sends standard HTTP headers including the session key so PHP will have to touch the harddrive. This for millions of users at a rate around once a minute.
I decided to write the script to poll the DOM once every minute with setTimeout() used to recursively call a skim function. It runs a regular expression on the contents of the number-of-friends element to get the number of friends from amongst the text, then pushes it onto an array along with the current time. Every 24 hours the script prints out the array so I can collect it and record it.
Despite the Mozilla Team’s promises and best efforts to clean up the Firefox memory problems with the release of FF3, My script crashes the browser after around 40 hours.
Anyway - I was only capable of collecting one day’s worth of friend activity, which isn’t nearly enough to make good observations with. Since my account has a low volume of friends, I’ll be moving this experiment to a friend’s account with a script which (hopefully) won’t be crashing my browser this time.
The graph
The raw data (the large numbers are UNIX UTC timestamps with three extra digits for the milliseconds)
The script (ugly I know)
The data so far seems to support my observation - my friends’ activity peaked at around 12:30AM.
Features of the new script will include:
- Will ask for a username and password so that the session will not expire (the script will log back in)
- No more crashes
- Script will not poll every minute, but will instead attach an event and get updates only when they occur
- Script will output gnuplot friendly datapoints
source: procrast-nation
Related Stuff
-
MooV: Using cutting edge Video phones and Software Video Phones - coupling all that with VoIP and empowering the disabled.
-
Moo Telecom: VoIP communications made easy - Ring anyway with the fun and ease of using a normal phone
-
TagR:Mobile Social Network with Real Time Locations Based services, and Ambience Intelligence, VoiP, IM, Skype, Googletalk, Mapping, Flickr, Events, Calendaring, Scheduling, SecondLife Support
-
ClearSMS : ClearSMS is a Web-based application that lets you send bulk SMS messages to your customers, contacts, or just about anyone.
-
Jajah:jah is a VoIP (Voice over IP) provider, founded by Austrians Roman Scharf and Daniel Mattes in 2005[1]. The Jajah headquarters are located in Mountain View, CA, USA, and Luxembourg. Jajah maintains a development centre in Israel.
-
Skype: It’s free to download and free to call other people on Skype. Skype the number one voice over ip software
- PrivatePhone: a free local phone number with voicemail and messages you can check online or from any phone.
Be the first ... |Add your comment.
Your Comment ...
Name (required)
Email (required, hidden)
Website
