From: Ilmari Heikkinen Date: 2005-04-30T10:37:10+09:00 Subject: Re: drb question On 30.4.2005, at 03:43, Joe Van Dyk wrote: > On 4/29/05, Joe Van Dyk wrote: >> class Player >> def initialize >> @player_attributes = { :some_key => "some value", :another_key => >> "another_value" } >> @player_id = 2 >> end >> end >> >> Say there's 100 Player objects running. They're stored in an array. >> >> DRb clients need access to the data stored in each Player. The Player >> objects get updated every second with new data. >> >> What's the best way of doing so? @player_attributes contains about >> 20-30 keys and values, if it matters. >> >> Thanks, >> Joe >> > > Oh, and the DRb clients (there's probably only one or two of them at a > time) have to use all the values in each Player's attribute list every > second or so. > Depends on the amount of data and the bandwidth of the link. If the attributes are roughly 50 bytes per attribute, the player list takes 150KB of space, and requires about 1.5Mbps connection to wholly update every second. Twice that for two clients. If your server can sustain the 3Mbps, you can just send the player array over. If the link is slow or you don't want to use that much bandwidth, you could use some diff algorithm to send only the values that have changed. Anyhow, you probably want to minimize the amount of DRb calls, as these introduce some overhead. So send the changeset with a single call. Maybe this was of assistance, maybe not :-I Cheers, Ilmari Heikkinen -- 66. The regions beyond these places are either difficult of access because of their excessive winters and great cold, or else cannot be sought out because, of some divine influence of the gods.