I have already a website built on 3-tier architecture (UI, BAL/BLL and DAL). My all BAL layers methods are static methods that accepts Business Objects (Entity objects) or some other parameters (like string or int) based on that it gets or insert data from/to database.
That website has around 10K hits every day and till now I have not seen any problem in this architecture. My concern is if the number of hit开发者_运维百科s will grow by many folds because my BAL/BLL methods are static it may create problem because of static methods (static method or variables are shared across requests on the servers).
I want to know that is my BAL/BLL static methods are really going to create problem for me when the visitors will increase and simultaneous hits will be there or will this work just fine?
I am sorry but I am not very expert in these things.
You should be ok with static methods, as long as those methods are thread safe. If those methods only use/operate on parameters passed in to them than they are thread safe. (As long as each object that is passed in is thread safe, and each object those objects hold is thread safe, .... etc.)
Thread safety should not go unchecked. Run CHESS.
Static method are untestable. Static method make your application non scalable. Check your architecture if you can't make them non-static.
I suggest you to make them non-static, turn your BLL classes in services, extracting interfaces and common models. Use an IoC container to inject the right BLL services. Make your DAL a service and inject it, too.
精彩评论