很长一段时间来加载.NET中第一个SQL连接 [英] Long time to load first sql connection in .NET

查看:171
本文介绍了很长一段时间来加载.NET中第一个SQL连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某种原因需要7秒开的firt时间到SQL Server数据库的连接,后续连接需要一秒钟。任何想法可能是什么原因?

For some reason it takes 7 seconds to open a connection to a sql server database for the firt time, subsequent connections takes a second. any idea what could be the reason?

我使用C#和asp.net

I'm using C# and asp.net

它的编译后,我本质上我每次重新启动该网站,这意味着每次需要actualy创造了第一的连接时间。据我所知,建立连接池有开销,但我从来没有见过,我应该需要7秒钟,设置它。

Its after compilation, i essence every time i restart the site, which means every time it needs to actualy create the "first" connection. i understand that setting up connection pooling has overhead, but i have never seen that i should take 7 second to set it up.

推荐答案

除了连接池和CLR的编译,不要忘了,在数据库服务器上的数据和规划缓存可能是冷太...

As well as connection pooling and CLR compilation, don't forget that the data and plan caches on the database server could be "cold" too...

我见过的第一个电话在一个非常感冒的网站需要5-10秒,从按钮点击响应(例如,搜索),在屏幕上结束了该数据。

I've seen first calls on a very "cold" web site take 5-10 seconds to respond from button click (for example, "search") to the data ending up on screen.

这篇关于很长一段时间来加载.NET中第一个SQL连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆