Blogger Widgets
  • Sharing Photos using SignalR
  • TFS Extenstion - allows copy work items between projects
  • Displaying jquery progressbar with ajax call on a modal dialog
  • Managing windows services of a server via a website
  • Exploring technologies available to date. TechCipher is one place that any professional would like to visit, either to get an overview or to have better understanding.

Search This Blog

Wednesday, 12 September 2012

State management in ASP.NET for high availability of data

ASP.NET session is the correct answer for state management. Yes that's it developers have to just use session to maintain state ie.. any data relavant to a user's session. Ways to store session state can mainly be categorized into InProc and OutProc.

InProc


Session state stored as in-memory on the web server.

Websites running in "Inproc" mode is completely dependent on the resources of the server. Limitation for number of users is dependent on the following factors
- Memory of server
- Amount of data stored per user session

As the memory used starts to exceed available memory application pool gets recycled and hence data stored is lost.

Single Web Server

Easy to configure and setup.
To enable session state as "Inproc" update web.config as follows:-


Advantages
- Easy access to data as stored in-memory

Disadvantages
- Data loss due exceeded memory utilization

Web Farm

Another method of increasing user capacity is by enabling sticky sessions on a web farm. This can achieved by using a Network Load Balancing (NLB). NLB has a feature known as "The Request Forwarder" and can be used to configure a cluster (web farm).

Sticky sessions use a HTTP cookie, which is returned for each client request that contains server instance GUID (ie.. first server that handled the request) and session ID allocated for the user. Subsequent requests will pass back server instance GUID and session ID that load balancer identifies and forwards to respective server. For mode detail explanation of this works look at technet article avalaible at http://technet.microsoft.com/en-us/library/bb734910.aspx.

Advantages
- Increased user capacity
- Easy access to data as stored in-memory

Dis-Advantages
- Partial load balance as user's are tied to specific server that served the request
- Still has possibility of data loss due exceeded memory utilization

OutProc


Session state is stored on a state server. Also this can be located on the same machine as web server or can point to another machine on your network. This mode is reliable as restarting web application does not affect state server and hence no data loss.

This mode can be configured either for a single server instance or for multiple servers on a web farm. In case of multiple web servers in a web farm,
- objects stored in session needs to be serializable
- should be installed on the same path in each of the web server in the Web farm.

1)StateServer

Session state is stored on an ASP.NET state service. Session data stored on a remote machine, no data loss due to application pool recycling. But still has the overhead of data loss if machine that has been configured as state management server is restarted.

Advantages
- No data loss due to application pool recycle

Dis-Advantages
- Is still limited based on the memory
- Reduces performance as data is read from a remote machine

2)SQLServer

session state is stored in an SQL Server database. Session data stored in a database because of which data is never lost. Machine restart will still not loose data as data is stored in a database.

Advantages
- No data loss due to application pool recycle - Data stored permanently in a database which has high reliability

Dis-Advantages
- Reduces performance as data read is from a database - Limited to memory allocated to database

3)Custom

Session state is stored on a custom provider. There are various options available for custom provider are AppFabric, Memcached etc.

AppFabric
- distributed in-memory application cache, refer to AppFabric for windows server for more details.
Memcached
- high-performance, distributed memory object caching system, refer to Memcached for more details.
SharedCache
- distributed and replicated memory object caching system, refer to SharedCache for more details.
“The most likely way for the world to be destroyed, most experts agree, is by accident. That’s where we come in; we’re computer professionals. We cause accidents.” – Nathaniel Borenstein

24 comments:

  1. Thanks to share.AWS (Amazon Web Services) is a popular and newly emerging cloud computing service powered by Amazon to do data management easily and to deliver hardware, software and storage solutions via internet. Scalability, security, dependability and flexibility are some of the important features of AWS.

    aws training in Bangalore

    ReplyDelete
  2. Great post, Thanks for sharing with us, This is very helpful for me.

    Software Testing Training in Chennai

    ReplyDelete
  3. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    Digital Marketing online training

    full stack developer training in pune

    full stack developer training in annanagar

    full stack developer training in tambaram

    ReplyDelete
  4. It would have been the happiest moment for you,I mean if we have been waiting for something to happen and when it happens we forgot all hardwork and wait for getting that happened.
    python training institute in chennai
    python training in Bangalore
    python training in pune

    ReplyDelete
  5. Thank you for allowing me to read it, welcome to the next in a recent article. And thanks for sharing the nice article, keep posting or updating news article.
    Blueprism training in tambaram

    Blueprism training in annanagar

    Blueprism training in velachery

    ReplyDelete
  6. I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post.is article.
    java training in chennai | java training in bangalore


    java training in tambaram | java training in velachery

    ReplyDelete
  7. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.
    Microsoft Azure online training
    Selenium online training
    Java online training
    Java Script online training
    Share Point online training

    ReplyDelete
  8. I am overwhelmed by your post with such a nice topic. Usually I visit your blogs and get updated through the information you include but today’s blog would be the most appreciable. Well done!
    ExcelR Solutions

    ReplyDelete
  9. Thank you for taking the time to discuss this informative content with us. I feel happy about the topic that you have shared with us.
    AWS training in chennai | AWS training in annanagar | AWS training in omr | AWS training in porur | AWS training in tambaram | AWS training in velachery


    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete
  11. Thank you for this post. Thats all I are able to say. You most absolutely have built this blog website into something speciel. You clearly know what you are working on, youve insured so many corners.thanks.
    data science training in chennai

    data science training in omr

    android training in chennai

    android training in omr

    devops training in chennai

    devops training in omr

    artificial intelligence training in chennai

    artificial intelligence training in omr

    ReplyDelete
  12. Impressive! I finally found great post here. Nice article on data science . It's really a nice experience to read your post. Thanks for sharing your innovative ideas to our vision.Digital Marketing Training in Chennai

    Digital Marketing Training in Velachery

    Digital Marketing Training in Tambaram

    Digital Marketing Training in Porur
    <
    Digital Marketing Training in Omr
    Digital Marketing Training in Annanagar

    ReplyDelete
  13. Indeed a great article! I am definitely going to bookmark it to go through it over again after work. It seems to cover the major information about the topic in points.
    SAP training in Kolkata
    SAP course in kolkata

    ReplyDelete
  14. This is an awesome post. Really very informative and creative contents. Visit my website to get best Information About Best IAS coaching Institutes in Dadar.
    Best IAS coaching Institutes in Dadar
    Top IAS coaching Institutes in Dadar

    ReplyDelete
  15. "Thanks for writing this post! It was a great read and I learned a lot from it. I found your explanation of the topic to be clear and easy to understand. The examples you provided were also very helpful in illustrating your points. Keep up the good work, and I look forward to reading more from you intelligent data management!

    ReplyDelete

  16. Nice Post... waiting for your next post. I have learned some new information. thanks for sharing.

    performance marketing

    ReplyDelete

Copyright © 2013 Template Doctor . Designed by Malith Madushanka - Cool Blogger Tutorials | Code by CBT | Images by by HQ Wallpapers