Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

does Application state variable works fine in web farm servers

Tags:

asp.net

I am using an application variables to store the values and again access it.but my Question here as we using multiple servers (web farms). will be there any issue whiling access the values or it not worth to store values in application state variables when we are going ahead with multiple server

Thanks prince

like image 875
happysmile Avatar asked Mar 04 '12 03:03

happysmile


People also ask

What is difference between session and application state?

"Application state" = the state of the application, which is the same for all users. "Session State" = state specific to this particular user session. Each user has separate session state.

What is a variable in web application?

Application variables are values that are available to any user or page within an application. For the first time, they can be any value you wish to store.

How many ways we can store user states for web application?

So, we can say that there are mainly two different ways to manage a web application's state: client-side and server-side.

What type of data is a session state variable design to store?

SessionState: It can be used to store information that you wish to access on different web pages. ViewState It can be used to store information that you wish to access from same web page.


1 Answers

No, Application State is not shared across the servers in a web farm, as per the documentation (see the section entitled Scalability).

Application state is not shared among multiple servers serving the same application, as in a Web farm, or among multiple worker processes serving the same application on the same server, as in a Web garden. Your application therefore cannot rely on application state containing the same data for application state across different servers or processes.

You will need to find some other store for this shared information, i.e. via a database or shared cache.

However, you will be able to share viewstate and forms authenticate tickets across all servers in the web farm, but you must set the <machineKey> to the same values on all servers.

From the first article below:

If you deploy your application in a Web farm, you must ensure that the configuration files on each server share the same value for validationKey and decryptionKey, which are used for hashing and decryption respectively. This is required because you cannot guarantee which server will handle successive requests.

These MSDN articles have more information:
http://msdn.microsoft.com/en-us/library/ff649308.aspx#paght000007_webfarmdeploymentconsiderations
http://msdn.microsoft.com/en-us/library/eb0zx8fc.aspx

like image 98
rsbarro Avatar answered Oct 06 '22 02:10

rsbarro