Efficiency of storing Object Graphs in Session State

Last post 05-09-2008 1:19 PM by anas. 1 replies.

Sort Posts:

  • Efficiency of storing Object Graphs in Session State

    05-09-2008, 9:13 AM
    • Loading...
    • cfink
    • Joined on 08-26-2005, 8:25 PM
    • Posts 9

    Is it efficient to store a moderate hierarchical object graph as a reference in a session variable? For example suppose I have an ArrayList arylistData, each row referencing an object. Is it reasonable to do this:

    Session["myLIst"] = arylistData; 

    Given that I do NOT have a server farm, but a single Web server, can I assume that this reference just lives in memory on the server, and retrieve the reference to it via the session variable, as opposed to the server serializing/de-serializing the entire graph on each page request/response?

     
    Thanks,

    Charlie Fink
     

  • Re: Efficiency of storing Object Graphs in Session State

    05-09-2008, 1:19 PM
    Answer
    • Loading...
    • anas
    • Joined on 09-21-2006, 4:31 AM
    • Palestine - فلسطين
    • Posts 2,438

    It depends on the session State Mode,  if its InProc( the default) ,

    then your arry list will be stored as a live Object ,and the session will just holds a reference to it , its the same as assigning it to a shared variable ,

    Howerver, if the Session mode is configured as OOP (out of process) , then the arrylist will be serialized when its saved and decerialized when its retireved ....

    in this case , you need to make sure that you are storing a serialized objects in the arrayList,

     

    Best Regards,

    Best Regards,

    Anas Ghanem - انس الغانم | My Blog
Page 1 of 1 (2 items)