I have a similar problem with response.Flush, although not with a database. I have nailed the problem down to requests using Connection: close. These always hang for minimum half a second up to 2 seconds. It's not a problem when Connection is set to Keep-alive, or, when Protocol is set to HTTP1.1 and no connection header is set (because default then is Keep-alive).