Best way for .NET website to handle high traffic
One of the websites I manage is going to be linked to from a very high traffic website. So over the next couple of days I am planning to scale up my setup to make sure it can handle this high traffic load. My current setup is a 32-bit machine with 4 GB RA开发者_运维百科M, Win Server 2K8, IIS7, SQL Server 2K5 and is a dedicated webserver in the same country from where the traffic is expected. It is equipped with a leased line connection of 2MBPS. This server is dedicated for my website and the database too is on the same website(as of now). The website(basically an ERP app) has high interaction with database and has considerable graphics as well.
What can be the best way to handle traffic in the magnitude of around 10K-15K in such cases?
Test it.
Fire 10k-15k requests (per day? per minute? per second?) at your server, see how it behaves. Measure, and then take appropriate actions. This Measuring .NET Application Performance is a bit dated, but you still get a decent mileage out of the info in there (apparently not all dated, still recommended by some even in 2010).
As I said in my comment above, making sure your server can handle high traffic is as much a server-related issue as an application-related one.
Here are some tips that may help you in terms of making your website more efficient:
- Use data caching and output caching - You should cache the results of database queries in
HttpRuntime.Cache
, especially intensive ones, and you should cache the output of individual pages using the OutputCache attribute. - Cut down on heavy resources - Make sure you keep resources in check, such as database connections/contexts, threads, etc. Also, for your database, making your queries more efficient might help.
- Test it - As Remus was saying, testing is incredibly important. Send a bunch of requests and see what happens!
- Audit your site - See what methods use the most resources and take the longest, and try to improve those. Also, Google Chrome's Inspector tool now has an Auditing feature that will probably give you some good tips to make your site more efficient.
- Enable GZip compression - this will help you reduce network load without a significant effect on efficiency.
Good luck!
精彩评论