User:Lum Pfohl/LSL Goodies/HI-WA Occupancy Counter System/Relay Servers

From Second Life Wiki
Jump to navigation Jump to search

Relay Servers

The primary purpose of the Relay Servers is to service all of the Endpoint Devices that request occupancy information. Endpoint Devices do not talk to the Collection Server because in doing so, may cause undue load upon it. The Relay Servers keep relatively fresh information which it obtains from the Collection Server and it redistributes that information.

The Relay Servers can also determine which version a particular Endpoint Device trying to connect. It can offer notification to the Endpoint Device that an updated version is available, and can deliver the replacement device to the Agent that owns the outdated device.

Communications

REQT-3.01 says it must transmit the information in a compact manner. This is the same as REQT-2.02 for Collection Server. Any device that connects to the Relay Server must present itself with the following string payload.
QUERY EXT ALL~UUID of Endpoint Device~HUDversion~Owner Name~Owner Key
The following is an actual request
Object-Name:HI/WA HUD 1.05
Region: SLVEC (230400, 229888)
Local-Position: (99, 109, 25)

QUERY ALL EXT~3f24eea9-7a59-09a8-fb59-c51c39bf065e~HUD01.05~Lum Pfohl~5c357419-2ddd-4206-adee-e9567a90d169
Again, we strip off the header until we are left with:
QUERY ALL EXT~3f24eea9-7a59-09a8-fb59-c51c39bf065e~HUD01.05~Lum Pfohl~5c357419-2ddd-4206-adee-e9567a90d169
The Relay Server can compare the current version of the Endpoint Device for which it is programmed to what it receives. If it determines that the Endpoint Device is too old, it responds with:
Object-Name: Lum's OI/HI Relay 1
Region: SLVEC (230400, 229888)
Local-Position: (98, 107, 25)

Update
Otherwise, it responds normally with:
Object-Name: Lum's OI/HI Relay 1
Region: SLVEC (230400, 229888)
Local-Position: (98, 107, 25)

0, 9~0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0!0~0, 0, 0~0, 0~0, 
0~0, 0~0, 0~0, 0~0, 0~0, 0~0, 0~0, 0~0, 0~0, 0, 0~0, 0~0, 23~2, 11~4, 0, 0, 
11~0, 0~0, 0~0, 1~0, 0~0, 12~0, 8~0, 9~1, 1~0, 2~0, 2~0, 12~0, 0~0, 11~1, 0~0, 
0~0, 0~0, 10~0, 2~0, 0~0, 0~0, 3~0, 4~0, 12~0, 12~0, 11~1, 0~0, 2~0, 2~0, 13~0, 
0~0, 0~0, 0~0, 0~0, 0~0, 0~0, 0~0, 1~0, 0~0, 0~0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0!0, 10~0, 0, 0, 3~0, 13~0, 0, 29~0, 0, 0, 7~0, 5~0, 
0, 0, 9~0, 1~0, 3~0, 8~0, 3~0, 0, 2~0, 42~1, 0, 0, 0, 0, 0, 0, 0, 0
To address the 20 second blocking of the llEmail( ) function, each Relay Server has 16 email slaves to which it hands off communications in a round-robin fashion. In this manner, each Relay Server can service a peak of (1 mail/20 seconds) * (60 seconds / 1 minute) * (16) = 48 requests per minute (minus 1 for the Master who contacts the Collection Server each minute). With three Relay Servers we expect it to handle 47 + 48 + 48 = 143 emails each minute. Should we ever need more, we can always set up more clusters on other sims.

Relay Server Cluster

We satisfy REQT-3.03 by polling the Collection Server once a minute such that the Relay Servers keep no data more than 1 minute older than the Collection Server.
But in order to satisfy REQT-2.01 without overwhelming the Collection Server, we set up a cluster of Relay Servers. In SLVEC over Kiosk #6 is one such cluster of 3 Relay Servers less than 1 meter apart. One Relay Server (Relay Server 1) acts as the Master and makes direct contact with the Collection Server. When it receives a response, it repeats the payload information via llSay( ) over channel 321123.
The two Slave Relay Servers listen on channel 321123 for any updates from the Master Server. This method only works when the Master and Slave Servers are in close proximity, but is effective in keeping the traffic down while partially satisfying the requirement REQT-3.02.

Trans-Version Service

We satisfy REQT-3.04 (trans-version service) programmatically through the use of the "Notification Method." The 1.04 and 1.05 HUDS are programmed to use "QUERY ALL EXT". Version 1.00 - 1.02 used "QUERY" and "QUERY HI", requesting OI and HI info separately. The 1.03 HUD used the "QUERY ALL" which requested all OI and HI1-210. The text display boards in SLVEC also used the "QUERY" and "QUERY HI" methods initially, but have been all changed over to "QUERY ALL EXT" The vesitigial code for "QUERY" "QUERY ALL" "QUERY HI", etc. will be removed to prevent code decay.

The current method "QUERY ALL EXT" will return all information in the form

<OI CSV LIST> ! <HI CSV LIST> ! <WA CSV LIST>

as shown above.

Updates Required?

REQT-3.06, 3.07 and 3.08 are satisfied by the HUD providing the HUD Version Info, and the Owner Key in the request to the Relay Servers. If a Relay Server determines that an upgrade is required, it will send back an "Update" message, alerting the HUD Owner that an update is available. If the Owner Key is available (it need not be), then the Relay Server can send an updated version via the llGiveInventory( ) function.

The Code

Configuration/Setup

The Master Server (1 prim object, shown as the top object in the picture). Note the 16 copies of the Email Script. When more than one is placed into the prim, SL automatically appends the number on the end. The Email Script can determine this number and decide if it's #0, #1, #2, etc., and respond to calls from the Relay Server Script.
Also note that this server contains a copy of the HI/WA HUD 1.05. Currently the Relay Server is distributing the updated HUD. Future versions will offload that to the HUD Dispenser located nearby. The second image shows the Relay Server Cluster and its proximity to the HUD Dispenser.

Relay Server Master.jpg Relay Server Cluster.jpg

The Slave Server is configured in the same way.
When the Master Server script is reset, it causes the nearby servers to reset as well. Each server will announce its server key, which must be programmed into the Endpoint Devices. Once a day, around midnight Eastern Time (-4/5 UTC), the Master Server automatically resets itself. In doing so, it also resets the nearby Slave Servers. The Relay Servers will receive new information within 10 or 15 seconds from the Collection Server, thus minimizing the disruption in service.

Lum Pfohl 19:49, 2 September 2008 (PDT)

Lum's Quick Links
LumSelfPortrait.jpg
Click to Enlarge


Related topics

edit