Note that there are some explanatory texts on larger screens.

plurals
  1. POUse application-wide variable on load balanced servers
    text
    copied!<p>I've a site which is hosted in two load balancing servers. I've a collection of variables which is stored as a <a href="http://msdn.microsoft.com/en-us/library/bb460184%28v=vs.110%29.aspx" rel="nofollow">Lookup</a> in a static variable to perform frequent and fast querying. <em>The value in the static variable is a tree structured data, so I don't want to query it each time to DB and bind the relationship between the list variables.</em> The static variable structure is like given below.</p> <pre><code>public static ILookup&lt;long, ITree&gt; MyStaticVar; public interface ITree { long ID { get; set; } // Some other properties ITree Parent { get; set; } IEnumerable&lt;ITree&gt; Children { get; set; } } </code></pre> <p>Sometimes the content of the static variable might get updated (when Admin modifies some values), so I update the static variable with updated values and all the so that users could get the changes instantly. </p> <p>It is working well in single server, but when I publish it to two or more servers, the variables won't get updated other servers than the one Admin logged in (since the static variable in that application server is only getting updated). </p> <p>What is the best approach to maintain my static variable synchronized in multiple servers? Or is there any other way to manage my situation (Event driven or some other way to trigger/notify other servers and refresh the variable in them)?</p> <p>I've a session state server which manages session values across these load balancing servers. Is there any way to store a single instance of the ILookup variable in session state server and share it across all users?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload