Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Concurrency stats

Domchi Underwood
Registered User
Join date: 4 Aug 2007
Posts: 44
01-08-2008 13:38
I'm looking at "Second Life Population Statistics" sign in NCI's Fishermans Cove... and the sign displays how many people are currently logged in. How does it do that - there's no dataserver request for that..?! llHTTPRequest? :)
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
01-08-2008 14:00
Probably. I think the information that shows up in the SL client's login page is via an HTTP request that the client makes, so you'd need to find the URL (the information is probably somewhere in the forums/blog/wiki), and then parse the data returned.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-08-2008 14:01
Yes on the llHTTPRequest(). There is a web interface designed specifically to be used by LSL scripts for this purpose, if I recall correctly. You might try searching for old SL Blog entries about it. I believe I remember one a while back (on the order of months or maybe even a year ago).
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
01-08-2008 14:25
http://blog.secondlife.com/2006/10/03/new-data-feeds-1/
_____________________
Domchi Underwood
Registered User
Join date: 4 Aug 2007
Posts: 44
01-08-2008 22:31
Thank you all, that's it.
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
01-09-2008 00:40
From: Day Oh
http://blog.secondlife.com/2006/10/03/new-data-feeds-1/


I went to Lawrence Linden's Office secondlife://Grasmere/226/45/40 to get the code he referenced in the second blog post, but both the cube and the chart on his desk are not copy able, despite the text saying, "Take a copy and look at the scripts".

Has anyone got copy's that they can pass on or could post the scripts here?
Domchi Underwood
Registered User
Join date: 4 Aug 2007
Posts: 44
01-09-2008 01:27
From: Very Keynes
Has anyone got copy's that they can pass on or could post the scripts here?


I don't have them, but I wrote the script to extract concurrency data, and I'll post it when I get home, if that means anything to you.
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
01-09-2008 06:50
Thanks Domchi, that is exactly the stat I was after too :)

I needed somthing to do whilst the grid was offline so here is my version

CODE

//Very Keynes - 08/01/09 - use freely / mention me if you wish
//returns a list of 6 data eliments each with 2 time stamps from SL
//tested in LSLEditor only as SL is currently down

key requestid;
list data;

default
{
touch_start(integer total_number)
{
requestid = llHTTPRequest("http://secondlife.com/httprequest/homepage.php",[HTTP_METHOD,"GET"],"");
}

http_response(key request_id, integer status, list metadata, string body)
{
if (request_id == requestid)
{
data = llParseString2List(body,["\t","\n"],[]);
//llOwnerSay(llList2CSV(data));
llOwnerSay("Curently online = "+llList2String(data,33));
llOwnerSay("Total Residents = "+llList2String(data,5));
llOwnerSay("logged 60 Days = "+llList2String(data,11));
llOwnerSay("exchange_rate = "+llList2String(data,17));
llOwnerSay("transactions_l$ = "+llList2String(data,27));
llOwnerSay("transactions_us$= "+llList2String(data,35));
}
else llOwnerSay((string)status+" error");
}
}
Domchi Underwood
Registered User
Join date: 4 Aug 2007
Posts: 44
01-09-2008 11:21
Here is my take:

CODE

// Written by Domchi Underwood - do whatever you want with it :)

integer online = -1;
integer online_max = 0;
integer online_delta = 0;

sendRequest()
{
llHTTPRequest("http://secondlife.com/httprequest/homepage.php", [HTTP_METHOD, "GET"], "");
}

default
{
state_entry()
{
// poll every 3 minutes (since data is updated every 3 minutes,
// so there's not much point in shorter periods)
llSetTimerEvent(180);

// but don't wait that much with first poll
sendRequest();
}

timer()
{
sendRequest();
}

http_response(key request_id, integer status, list metadata, string body)
{
string report;

// check if everything was OK
if (status != 200)
report = "data not available\nHTTP status code " + (string) status;
else
{
// parse response
integer start = llSubStringIndex(body, "inworld\n") + 8;
integer end = llSubStringIndex(body, "\ntransactions_us$");
integer online_temp = (integer) llGetSubString(body, start, end);

// calculate delta (or leave 0 if no previous data
if (online > -1)
online_delta = online_temp - online;

online = online_temp;

// check for maximum and update if needed
if (online > online_max)
online_max = online;

report = (string) online + " users online\n(delta " + (string) online_delta + ", max " + (string) online_max + ")";
}

llSetText(report, <1.0, 1.0, 1.0>, 1.0);
}
}
Domchi Underwood
Registered User
Join date: 4 Aug 2007
Posts: 44
01-09-2008 14:18
BTW, it seems that currently logged in number is not updated every 3 minutes as Lawrence Linden says in blog entry - it looks more like every 6 minutes to me.
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
01-09-2008 15:22
yes I concur, I set mine to 5 min and the lindex updates evry time but not concurrancy
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
01-09-2008 16:18
I have two versions, dropping a copy of both on you. :)
_____________________
Domchi Underwood
Registered User
Join date: 4 Aug 2007
Posts: 44
01-11-2008 14:43
Hm, that concurrency data is pretty strange.

It's updated every 5 minutes, but from time to time, I experience short spike - and than the value returns to that before spike. For example:

[13:31] Object: 54123 users online (delta 0, max 54123)
[13:32] Object: 54520 users online (delta 397, max 54520) - strange
[13:33] Object: 54123 users online (delta -397, max 54520) - strange
[13:34] Object: 54123 users online (delta 0, max 54520)
[13:35] Object: 54766 users online (delta 643, max 54766) - normal
[13:36] Object: 54766 users online (delta 0, max 54766)
[13:37] Object: 54766 users online (delta 0, max 54766)
[13:38] Object: 54766 users online (delta 0, max 54766)
[13:39] Object: 54766 users online (delta 0, max 54766)
[13:40] Object: 54979 users online (delta 213, max 54979) - normal
[13:41] Object: 54979 users online (delta 0, max 54979)
[13:42] Object: 54979 users online (delta 0, max 54979)
[13:43] Object: 54979 users online (delta 0, max 54979)
[13:44] Object: 54979 users online (delta 0, max 54979)
[13:45] Object: 55290 users online (delta 311, max 55290) - seems normal, but...
[13:46] Object: 55290 users online (delta 0, max 55290)
[13:47] Object: 55290 users online (delta 0, max 55290)
[13:48] Object: 54979 users online (delta -311, max 55290) - ...again, more strangeness.
[13:49] Object: 54979 users online (delta 0, max 55290)
[13:50] Object: 55581 users online (delta 602, max 55581)
[13:51] Object: 55581 users online (delta 0, max 55581)
[13:52] Object: 55581 users online (delta 0, max 55581)
[13:53] Object: 55581 users online (delta 0, max 55581)
[13:54] Object: 55581 users online (delta 0, max 55581)
[13:55] Object: 55791 users online (delta 210, max 55791)
[13:56] Object: 55791 users online (delta 0, max 55791)
[13:57] Object: 55791 users online (delta 0, max 55791)

This variations are happening even if I poll more often (this is every 30 seconds):

[14:31] Object: 56578 users online (delta 0, max 56578)
[14:32] Object: 56721 users online (delta 143, max 56721)
[14:32] Object: 56578 users online (delta -143, max 56721)
[14:33] Object: 56721 users online (delta 143, max 56721)
[14:33] Object: 56578 users online (delta -143, max 56721)
[14:34] Object: 56721 users online (delta 143, max 56721)
[14:34] Object: 56721 users online (delta 0, max 56721)

The numbers are updated every 5 minutes, that's fine. But there are some funny glitches in the Matrix... :)

Maybe http requests are served from a cluster of servers, and not all of them get updated at the same time?