I have been trying to optimize an ASP.NET C# application for a few days and I am curious of some issues.
Using the PageSpeed Firefox plug in i was able to track down and eliminate some unnecessary ajax calls and enabled caching of static resources, but there are still considerable performance issues.
When opening any given page there are roughly 25 requests to the server (ajax, automatic post backs, static content) and one of the issues that PageSpeed pointed out was that the request size was too high, more specifically the cookie size is 1.4KB. As i understand it from other sources the cookies get passed to the server with each request. I’ve also read about a solution, “Cookie free domains for static content”, but that is not an option as I am not in control of the application structure and hosting environment.
The cookies are written and read using a memory stream and a System.Runtime.Serialization.Formatters.Binary.BinaryFormatter object to serialize a list of custom objects (2 fields and 2 properties for those fields, a bit redundant for BinaryFormatter).
My questions are:
- How much can such large request influence performance?
- Are they enough to cause the server to hang/crash? (it happens frequently)
- Is there a way to considerably reduce the size of the output of the BinaryFormatter?
- I know serializing objects into cookies is not a good idea, so will replacing the serialization of objects into cookies with strings that will be parsed solve my performance issues?
- As I’ve said the pages use some automatic post backs and i can debug andvatch the cookies get read (deserialized), written (serialized) around 5 times before a page loads. Does this have such an adverse effect on performance as to cause the server to hang/crash?
Thanks and have a nice day,
You could just try to use a server-side “cookie-store” (NoSQL?) and just save an identifier in the actual coockie and see what happens, because big cookies are bad (think of slow internet connections with even slower upload speed)…