ASP.Net Timeouts – How to fix that

Ever seen these two errors on ASP.Net application:

1) “Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding”.

2) “Request timed out”.

These errors are in a way related. There are two timeout thresholds available in the life cycle of an ASP.Net request. First: The amount of time taken to execute an SQL Query, Second: The overall time taken to complete the request. Error conditions can happen if your application takes more time on any of the two operations.

Overall Request Time Span (default 110 seconds)
= Time spent prior to SQL execution
+ Time spent during SQL execution (default 30 seconds)
+ Time spent after SQL execution

For a snappy application, ideally each of the above components should be completed in few 100 milliseconds, with overall time spent taking less than a second.

However, in poorly designed applications, any of the segments can take several seconds to complete. For example, what if your SQL execution takes more than 30 seconds. In this case, your command object will throw “Timeout Expired” exception. Ideally, you should wrap try catch around your SQLs or better the business layer invoking those data calls and should deal with the errors.

Besides SQL Timeouts, an application can spend time doing other work, for e.g. waiting for a web service to respond or doing complex calculations, reading a large file, in which case the overall time allocated to execute and complete the request may exceed the default timeout (110 seconds). If that happens ASP.Net will yank that request and return a response “Request Timed Out” response back to the client (browser).

Solution:

1)  In order to fix “Timeout expired” issue, you can need to bump the SqlCommand.CommandTimeout property from default of 30 seconds to something as desired by your application.

Unfortunately, there is no easy way to configure that using web.config connection string. You should probably create a new setting in web.config for CommandTimeOut and use that in your data layer while executing the actual SQL commands.

2) In order to fix “Request Timed Out” problem, you can simply edit the web.config file and bump the httpRuntime.executionTimeOut property. The default value is 110 seconds:

<httpRuntime executionTimeout=”200″/>

Caveat:

As I mentioned earlier, these two errors are related. For example, if you set the CommandTimeOut to be 240 seconds, and executionTimeout to be 180 seconds, and query takes roughly 200 seconds to execute. In this case, the executionTimeout threshold will reach first, thereby causing ASP.Net to yank that request, even though the CommandTimeOut has not expired yet.

A general rule of thumb:  ExecutionTimeOut should be equal to or preferably more than CommandTimeOut.

Summary:

SqlCommand.CommandTimeout and httpRuntime.executionTimeOut can be used to fix two common ASP.Net timeout issues. However, I personally think web applications should be snappy, and ideally one should not bother with any of the two settings.

If you are reading this blog and trying to use the recommendations, I’d strongly recommend to step back and take another look into the app and fix the real problem, you are just treating the symptom, not the root cause. 

Posted in asp.net | Tagged , , , , , | Leave a comment

Dude, I’ve seen slumdog!!

Last week I was at a Christmas Party, where I happened to sit next to a gentleman born and raised in Vancouver. I was in a decent suite and so was he, you know….the typical ones for such occasions. That restaurant was called Anduccis, one of the finest Italian Restaurant of Vancouver. I believe we had never met before; and obviously we had to be on the dining table for over an hour, so I started looking for a common topic to talk about. If you know me, I am someone who can talk only so much on local sports or politics. I like talking more about technology and contemporary business trends. Four countries that interest me are India, China, US and Canada. I am so keen to know more about Japan and Europe in general. That’s not the point though 🙂

Much to my surprise, we had lots of stuff to talk about. We started with how we both like living in Vancouver. He’d get a sense of relief when his plane lands in Vancouver. With that we talked about living (and not living) in US, travelling, and finally about airports. I mentioned to him about the new International Airport in New Delhi. I said Vancouver was no comparison to the Terminal 3 at New Delhi, in fact Heathrow looked old as well.

I went ahead and said, given the poverty in India, the divide between the rich and the poor, that airport is a testimony on how quickly India is catching up with the west. I compared how Vancouver made a great deal of the Canada Line Construction, the new skytrain connecting Vancouver Airport to Vancouver Downtown, almost costing about $2 billion and taking 5 years or so. In comparison, India spent close to $2.7 billion on the new airport and took about 3 years to complete. What I was trying to get was that, now India spends at or above world-levels on infrastructure projects. The gentleman agreed with me. Then I asked, do you have a sense of the poverty-levels in India…in a way Indians being so poor compared to developed world-standards, the country as a whole is spending at the developed-world levels.

He said, “Yes, I know about India’s poverty, I’ve seen Slumdog….”. I paused for a second after that statement, didn’t know what to say. Slumdog has shown so much of the dark and grim side of India, that people now use that movie as a reference to depict the sad part of India. Is it a bad thing though? I suppose world should know what India is and what it is not. In my mind, the movie did a good job letting the rest of the world know about India. I think India needs to come clean in front of the world, keep up with the pace, at the same time take care of the ‘common man’.

BTW, that was an interesting conversation which ended in about 90 minutes, as me and my wife needed to rush out to pick up the kids.

Did I mention that the food was awesome :), thanks a lot to the Host and the Chef (I believe his name is Greg).

Posted in Heathrow, India, infrastructure, movie, slumdog millionaire, Vancouver | Leave a comment

Heathrow does 1,300 flights a day

According to WSJ, Heathrow airport in London does about 1,300 flights a day including arrivals and departures. In my mind, that’s a lot of flights; in fact Heathrow is the world’s busiest airport.

Well, that 1,300 number is on a busy day, still if I do my math, 1,300 a day means about 54 flights an hour, that’s almost one flight a minute. That’s a lot to handle. Hats off to the airport operations, as I happen to travel through that airport for the getting so much accomplished. I pass through Heathrow, at least once a year with family. Safety comes first 🙂 🙂

Posted in flights, Heathrow, New Delhi International Airport, safety | Leave a comment

Online Subscriber Statistics

Here is the blog where I intend to capture subscriber statistics of the various online services. The table is work in progress, I will update as I gather information:

https://spreadsheets.google.com/pub?key=0AsuteTF6vSthdDFjOEhaMHN4bkhfRHhqZF9QUFp6OWc&output=html&widget=true

Posted in facebook, netflix, online, skype, subscriber | Leave a comment

Are there Barriers to Entry in Mobile Games?

Having worked in the field of software development for years, I’ve started to think that the barriers to entry in this field is slowly fading away. With some sort of training, one can start coding in no time. There is no need to have formal education in software engineering to be able to get a job and do something meaningful. On top of that, there is so much of rich content on the web to learn; most of the content is free. So much of open source code to copy-paste from.

Anyways, I was starting to think that video games (especially the mobile games) are at the same level. But I must say, ever since I started playing Angry Birds on my iPhone or iTouch my view points are changing quickly. It’s just not the visual and the audio of the game that’s impressive and difficult for non-serious ones to accomplish, there is a whole lot of Physics involved. All those shooting birds reminded me of the physics trajectory questions I used to solve in grade 12, especially to prepare for the IIT-JEE (one of the hardest to crack, I happened to pass that ) exams in India.

The way those planks fall, the strength and direction in which you shoot the birds, it’s all physics. These guys must have been through a lot of thinking to present such a wonderful experience in the game. I can clearly see that the folks need to be way smarter compared to any other run of the mill programmer. There’s definitely barriers to entry here.

I am starting to wonder if there are any modeling tools available to make such things easier for game developers. If I get time, I’d go and take some classes on mobile gaming, just to know how these guys are able to pull off such great visuals and awesome reflexes. Great Job!!!

Posted in Angry Birds, iphone, ITouch, Mobile Gaming, Physics, Software Development, Video Gaming | Leave a comment

Are there Barriers to Entry in Mobile Games?

Having worked in the field of software development for years, I’ve started to think that the barriers to entry in this field is slowly fading away. With some sort of training, one can start coding in no time. There is no need to have formal education in software engineering to be able to get a job and do something meaningful. On top of that, there is so much of rich content on the web to learn; most of the content is free. So much of open source code to copy-paste from.

Anyways, I was starting to think that video games (especially the mobile games) are at the same level. But I must say, ever since I started playing Angry Birds on my iPhone or iTouch my view points are changing quickly. It’s just not the visual and the audio of the game that’s impressive and difficult for non-serious ones to accomplish, there is a whole lot of Physics involved. All those shooting birds reminded me of the physics trajectory questions I used to solve in grade 12, especially to prepare for the IIT-JEE (one of the hardest to crack, I happened to pass that :)) exams in India.

The way those planks fall, the strength and direction in which you shoot the birds, it’s all physics. These guys must have been through a lot of thinking to present such a wonderful experience in the game. I can clearly see that the folks need to be way smarter compared to any other run of the mill programmer. There’s definitely barriers to entry here.

I am starting to wonder if there are any modeling tools available to make such things easier for game developers. If I get time, I’d go and take some classes on mobile gaming, just to know how these guys are able to pull off such great visuals and awesome reflexes. Great Job!!!

Posted in Mobile Gaming, Software Development, Video Gaming | Tagged , , , | Leave a comment

Hello world!

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

Posted in Uncategorized | 1 Comment

Research and Development Budget of Top Technology Companies


I’d like to collect Research and Development budget of world’s top technology companies. This spreadsheet will be work in progress; I will update as I gather more data.

https://spreadsheets.google.com/pub?key=0AsuteTF6vSthdEJaZFl6RDBoMzQ5bUwxQlEyN01wYkE&output=html&widget=true

Posted in Budget, Expenditure, Research and Development, Technology Companies | Leave a comment

Portable Gaming Devices Statistics – By Units Sold So Far

By now, you’ve probably figured out that I am the guy with lots of stats. I like them because them help put things in perspective. During my morning run of news hunt, came across an article on WSJ about portable gaming device market, where do the players stand. Based on that decided to do some more research to get the complete picture. Below are some of the findings:

https://spreadsheets.google.com/pub?key=0AsuteTF6vSthdGZyMkVSUVNvRzl2elJsZkRLTF9kTHc&hl=en&single=true&gid=0&output=html&widget=true

iOS is at the top of the stack, but I believe Android is catching up too. One thing to note here is that PC shipment for one year is probably more than the total of all the portable devices. That’s where Mr. Softy (Microsoft) gets all the money from 🙂

Posted in android, ios, nintendo ds, pc, portable gaming device, psp2, statistics | Leave a comment

Technology Market Projections – next 3 years

I’d like to dedicate an entire blog on technology-market-projections that pop-up in news from time to time, ranging from Tablets, Cloud, Mobile-Ad, Mobile-App, Location Based Services, Smart Phone, Social Apps, and so on. Often times one would hear demand for such and such thing is going to double the next year. It’s very hard to catch-up with these projections from the Industry pundits.

Being a technology professional, I’d like to know which is hot, what’s upcoming and what’s phasing out; Don’t want to stuck doing something that’s going to become obsolete soon.

As a starting point, I’d like to start recording here in this blog as I find them, and we can go from there:

https://spreadsheets.google.com/pub?key=0AsuteTF6vSthdFhoQ2p0czluREtRWUx1T3JTaWNabkE&hl=en&single=true&gid=0&output=html&widget=true

Posted in Future, market valuation, Projections, technology | Leave a comment