Deserialization of Session Variable Really Slow

P

Phil Johnson

Hi,

We have an asp.net web application running on .net 3.5

I have an object that we put on the session. When we get it off the session
on the next page request it takes almost 100ms to get the item and pretty
much all of that time is spent deserializing the object. Thats almost a
tenth of a second to deserialize a single object using the binary formatter.

Is there anything I should look for that could be slowing down the
deserialisation? I have seen on other forum posts that setting a double to
Double.NaN can cause an issue but we don't do that. Are there any other
Gotchas to watch out for with binary formatter deserialiation?

This didn't seem to be an issue with the application when it was running on
the .net 1.1 platform but it is now that it is running on .net 3.5... not
sure if that could have anything to do with it?
 
B

bruce barker

deserialization works by creating your object via it constructor and
setting all the properties that were saved via serialization. any
objects it references must also be created, and properties set.

check you constructor call, and any costly property sets. you should
write a unit test that performs a serialization and deserialization and
use performance tools to look for bottle necks.

-- bruce (sqlwork.com)
 
P

Phil Johnson

Ah,

Looking into this one a bit more it does take a similar length of time to
get the session variables, in the trace of the .net 1.1 app though it shows
in a different place... (AsyncEventExecutionStep.Execute) so the
Application_AcquireRequestState only takes .11 ms but that is because the
session variables have already been pulled from the session state db into the
local session dictionary, whereas the .net 3.5 takes 292ms in the
Appilcation_AcquireRequestState event but it is doing the work to get the
session variable from the session state DB at that point.

The extra time actually seems to be in the OnReleaseState which takes 281 ms
longer in the 3.5 app than it does in the 1.1 app (exactly the same that the
whole request is longer).

I will raise another forum post for this and see if anybody knows more about
the OnReleaseState and if we can speed that up at all.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top