Note that there are some explanatory texts on larger screens.

plurals
  1. POC# (mono) Linux web server hosting with consistent static variables across threads
    text
    copied!<p>Does anybody know of a C# (mono) Linux web server hosting configuration that enables consistent static variables across threads (ie not the CGI model of an instance per thread)?</p> <p><strong>Details</strong></p> <p>I have some c# (mono) code that we need to host on linux as part of a simple web app. We don't need any traditional asp or even asp.net mvc features, really we just need the ability to respond to specific urls with dynamic content based on shared static variables. </p> <p><strong>Static Variables:</strong> The one special requirement we do have is that we need static variables to retain their value across all incoming requests (the same way they do on windows with an ASP.net mvc application). Common ways of hosting a mono c# web app like Apache mod_mono appear to use an 'c# application instance per thread' model where there would be multiple independent instances of our c# application each with their own static variables. That is the problem we need to avoid. I need a way of hosting a c# application that provides one common app with a shared set of static variables that all incoming requests will see. It is ok if when the app recycles that the static variables get reset (just like in normal IIS/MVC), so long as recycles are infrequent. </p> <p>The background is that this web app needs to hold a large amount of data in RAM in a static variable and rapidly answer questions about that data. Having a copy of the app open for each thread would limit RAM resources too much and reloading the data into memory frequently would make the app too slow (occasional recycles like IIS/Asp.net MVC has are fine). The system works amazingly well on Windows/IIS7 (50,000+ dynamic requests per second) and we <strong>do not</strong> want change this architecture, so the answer I'm looking for relates to hosting not changing the application design. </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