This is Mats Helander's TypePad Profile.
Join TypePad and start following Mats Helander's activity
Mats Helander
Recent Activity
@Skippyfire
You are quite correct. A compiled query should be cached at the application level and be reused between requests.
Jeff's statement "But then I realized it's probably more realistic to make sure that any page we generate isn't doing 500 freakin' thousand queries!" can be misleading. I expect what Jeff means is that with few queries per page, and a small overhead per non-compiled query, the extra response time for that page won't add up to much. Which makes sense.
But it is easy to misread what Jeff said to mean that he thinks compiled queries are only cached for the duration of a request, such that if you don't have many queries per request, the compiled ones won't be reused much and compilation might actually hurt performance. But this, of course, would be unrealistic, since the compiled queries would be cached at application level, and thus if you have multiple requests to the same page, calling on the same query, the compiled one will be used (except the first time the page is called) and performance will improve.
With 1.5 million hits per day on Stack Overflow, a compiled query cached at application level should find tremendous reuse and possibly shave a reasonable chunk of load from the server.
At the same time, each page might still load only marginally quicker, which is what Jeff observes. In other words, it is the type of optimization that may do more (in an already well balanced system) towards lowering the electricity bill for the server owner rather than make significant impact on response times for the end users.
Compiled or Bust?
While I may have mixed emotions toward LINQ to SQL, we've had great success with it on Stack Overflow. That's why I was surprised to read the following: If you are building an ASP.NET web application that's going to get thousands of hits per hour, the execution overhead of Linq queries is goi...
Mats Helander is now following The Typepad Team
Mar 26, 2010
Subscribe to Mats Helander’s Recent Activity
