Click here to Skip to main content
15,867,594 members
Articles / General Programming / Performance
Tip/Trick

Common serialization mistakes to avoid

Rate me:
Please Sign up or sign in to vote.
4.75/5 (4 votes)
17 May 2011CPOL1 min read 27.6K   4   2
Caching frequently used objects, that are expensive to fetch from the source, makes application perform faster under high load. It helps scale an application under concurrent requests. But some hard to notice mistakes can lead the application to suffer under high load, let alone making it perform be
Caching frequently used objects, that are expensive to fetch from the source, makes application perform faster under high load. It helps scale an application under concurrent requests. But some hard to notice mistakes can lead the application to suffer under high load, let alone making it perform better, especially when you are using distributed caching where there’s separate cache server or cache application that stores the items. Moreover, code that works fine using in-memory cache can fail when the cache is made out-of-process. Here I will show you some common distributed caching mistakes that will help you make better decision when to cache and when not to cache.

Here are common mistakes we make that makes performance worse:

* Relying on .NET’s default serializer.
* Storing large objects in a single cache item.
* Using cache to share objects between threads.
* Assuming items will be in cache immediately after storing it.
* Storing entire collection with nested objects.
* Storing parent-child objects together and also separately.
* Caching Configuration settings.
* Caching Live Objects that has open handle to stream, file, registry, or network.
* Storing same item using multiple keys.
* Not updating or deleting items in cache after updating or deleting them on persistent storage.


For detail explanations of these, you can read these article:
Ten Caching Mistakes that Break your App[^]

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect BT, UK (ex British Telecom)
United Kingdom United Kingdom

Comments and Discussions

 
GeneralDistributed caching. Pin
wesnur31-May-11 19:10
wesnur31-May-11 19:10 
GeneralRe: Distributed caching. Pin
Omar Al Zabir1-Jun-11 22:49
Omar Al Zabir1-Jun-11 22:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.