In light of the rising popularity of AJAX during the last couple of years, Microsoft wanted to include the feature natively into ASP.NET’s object model. They came up with an elegant solution for the feature in ASP.NET 2.0 and they called it Client-Callback.
The elegance of Client-Callback
The lack of performance
All of this great functionality comes with a price, and that price is performance. The time between the request and the response is the measure of performance of this feature, and it’s actually not bad for single requests. The slow performance occurs when you do multiple calls on the same page.
Let’s say you have a table of 25 products and when the mouse hovers over the name, an image of that product is displayed right next to the cursor. It’s a nice feature and the website visitors find it useful and try hovering over multiple products in a relative short period of time. The first image is loaded pretty fast, but the rest hangs for a second or more. This is not acceptable because you want it as close to real time as possible.
Finding the solution
Choosing the right approach
I’ve used the Client-Callback feature many times in a lot of different scenarios without it giving performance issues. But in this case it did and it took me several hours of trial and error before I came up with a solution that basically wasn’t simple at all. Well, not simple compared to the Client-Callback approach and that really bothers me. I’m a keep-it-as-simple-and-clean-as-possible kind of developer and although the solution wasn’t very complex or hard to do, it’s still more complicated.