KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to ensure my website is capable of being hosted on the cloud in the future and also that it can handle a lot of requests. How safe are static variables? Are they unsafe because separate requests by separate users are actually sharing these static variables? Or is it because if you spread the site over threads/sharding or similar, (to handle high loads) the threads are sharing the static variables? Mainly I have helper classes, with static properties, should I change this architecture so that I instead create an instance of each class and access the instances? E.G Here is a sample of what I am doing: using System; using System.Collections.Generic; using System.Linq; using System.Web; using Mvc.Mailer; namespace MVCWebsite.Helpers { public class AppSettings { public static void OnAppInit() { //General AppName = "MyApp"; DesktopBaseURLs = new Dictionary<string, string>(); DesktopBaseURLs.Add("dev", "localhost:50560"); DesktopBaseURLs.Add("test", "www.test.whatever.com"); DesktopBaseURLs.Add("live", "www.whatever.com"); MobileBaseURLs = new Dictionary<string, string>(); MobileBaseURLs.Add("dev", "m.local.whatever.com"); MobileBaseURLs.Add("test", "m.test.whatever.com"); MobileBaseURLs.Add("live", "m.whatever.com"); //Emails EmailHostName = AppName + ".com"; //For the moment atleast NoReplyEmailAddress = "no-reply@" + EmailHostName.ToLower(); SupportEmailAddress = "support@" + EmailHostName.ToLower(); ErrorEmailAddress = "errors@" + EmailHostName.ToLower(); //Resources
Tags (comma-separated)
Save Edits
Cancel