I was recently asked to speed up a C#/ASP.NET/SQL Server business app website. Since I just started, I don’t know too much about the internals. So where do I start? Sight unseen, what is the single most important thing affecting performance on a system like this? Database tuning? Hardware? Individual page optimization? What is the first thing you’d look at?
EDIT: After I actually do the work, I’ll come back and post the answer. 😉
EDIT again: “Profile” is currently the most-voted answer, and I agree that that is clearly what one should do. But I was looking for guesses/experience as to what the profiling results would show, so I don’t think that answer counts…
It turns out that the most egregious problem was a few trouble pages that hammered the database with thousands of SQL queries. The code was relatively innocent-looking, just some data bound grids. However, C#/LINQ was a bit too powerful for its (or our) own good: if you bind a grid to a table, but the grid wants to display a field from another table linked via foreign key, it does it! But it does it by running a zillion queries:
and so on… by making sure that the dataset that was bound to the control had all necessary data without requerying the database, the problems eased noticeably.
Now back to profiling…