Home > AppFabric > Optimizing AppFabric 1.1 for Session State

Optimizing AppFabric 1.1 for Session State

Amazingly although there are a lot of resources on using AppFabric for SessionState, there is no single site that attempts to give you all the necessary settings in order to run Appfabric for session state properly


Here are some of the settings which you need to use in order to optimize AppFabric

<td valign="top" Type
Parent Setting Reason
AppFabric Settings > Advancedproperties <transportProperties maxBufferPoolSize=”2147483647″ maxBufferSize=”2147483647″ /> Session states might be big (imagine those with huge gridviews) so putting it as a bigger size is necessary in order not to encounter errors with too small size to store viewstate
AppFabric Settings > Advancedproperties <partitionStoreConnectionSettings leadHostManagement=”false” /> If you are using a HADRON setup for SQL Server, you might want to set leadhostmanagement to false so that SQL manages the cache cluster rather than lead hosts, this way as long as SQL is up, your caching service is always up.

If you use lead hosts, make sure that there is always at least 2 lead host active else the ENTIRE cluster will go down

For more details refer to here

AppFabric Powershell Set-CacheConfig -CacheName Web-Session -Eviction None Make sure the Eviction property for the session cache is set to none instead of LRU else some weird things may happen during eviction
AppFabric Powershell
new-cache MyCache -Secondaries 1
Enable secondaries for the session state, you don’t want things to go missing just because a server went down
Application Ensure you are running the latest cumulative update for AppFabric (as of writing CU5)
Infrastructure Appfabric is designed for scale out rather than scale up, so 4 servers with 32gb of ram is better than 2 servers with 64 gb of ram. In fact the more servers the merrier.

Additionally the more servers there are, the better the performance since more servers can respond to the requests

Infrastructure For high availability and best performance, use SQL server rather than file server
web.config Ensure you are running the latest DLL for AppFabric
web.config sessionState Ensure you are using Microsoft [dot] Web [dot] DistributedCache [dot] DistributedCacheSessionStateStoreProvider as the Session provider
web.config sessionState useBlobMode=”false” Set useblobmode = false so that the web server only grabs what it needs rather than the entire session. However if your application generally uses everything in session, then set this to true instead so that lesser round trips are needed
web.config dataCacheClients <transportProperties connectionBufferSize=”131072″ maxBufferPoolSize=”104857600″

maxBufferSize=”104857600″ maxOutputDelay=”2″ channelInitializationTimeout=”60000″


update the transport properties to be the same as appfabric settings (or lesser) so that appfabric can optimize the connections
web.config dataCacheClients <localCache isEnabled=”true” sync=”TimeoutBased” objectCount=”1000″ ttlValue=”600″ /> Enable localcache so that some items can be stored locally instead of constantly grabbing from the server
Categories: AppFabric
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: