Enterprise Services (.NET 1.1) Performance Guidelines - State Management
- J.D. Meier, Srinath Vasireddy, Ashish Babbar, and Alex Mackman
Prefer stateless objects.
Ideally, you should avoid holding state to maximize scalability. If state is needed, store and retrieve the state information from a common store like a database.
The SPM is designed for storing small pieces of information (simple strings, integers) and not complex or large amounts of data. It uses ReaderWriterlock to synchronize single-write and multiple-reads; therefore, storing large amounts of data can cause throughput bottlenecks and high CPU. Using this feature causes server affinity, so you cannot use it in applications that will be deployed in a Web farm or application cluster. Even for single machine scenarios, do not use it as a cache or as a placeholder for complex data.