• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 8. Shared Objects > Optimizing Shared Object Performance

8.9. Optimizing Shared Object Performance

While it is possible to store complex data structures such as objects or arrays in a shared object slot, doing so is often not a good idea. The reason goes back to the fact that when one property in the object or array changes, the entire data structure is copied to the remote shared object and distributed to every client. To avoid the unnecessary copying of data, shared objects should be designed to reduce redundant updates. For example, a natural and seemingly logical way to design a list of users would be to create a shared object with each property value containing an object with information about each user. In SSAS we might create a structure like this:

userList_so = SharedObject.get("public/userList");
userList_so.lock(  );
userList_so.setProperty("blesser", {cn: "Brian Lesser", status: "Offline"});
userList_so.setProperty("peldi", {cn: "Giacomo Guilizzoni", status: "Offline"});
userList_so.setProperty("reinhardt", {cn: "Robert Reinhardt", status: "Offline"});
userList_so.unlock( );

					  


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint