连接到 SQL Server 非常慢

发布于 2024-09-10 02:22:56 字数 456 浏览 3 评论 0原文

我有一个标准的 php 应用程序,它使用 SQL Server 作为后端数据库。我访问的每个页面的响应都有严重的延迟。这是我的开发服务器,因此实时设置不是问题,但在系统上工作确实很烦人。

我每页有 5 - 8 秒的延迟。

  • 我正在虚拟机(虚拟 PC)上运行 SqlServer 2000 Developer Edition。
  • 我已在我的开发计算机上安装了 SqlServer,但遇到了相同的延迟。
  • 我已将问题隔离到对 mssql_connect 的调用(调用 mssql_pconnect 没有效果)

  • 这是一个网络问题我如何设置(或未设置,因为我没有真正更改默认配置)SQL Server。这不是一个严格的编程问题,但我想我可能会在这里得到一些有价值的反馈。

谁能告诉我是否有一个技巧,特定的协议集,注册表设置,或者可以消除这种延迟的东西?

I have a standard php app that uses SQL Server as the back-end database. There is a serious delay in response for each page I access. This is my development server, so its not an issue with the live setup, but it is really annoying for working on the system.

I have a 5 - 8 second delay on each page.

  • I am running SqlServer 2000 Developer Edition on a Virtual Machine (Virtual PC).
  • I have installed SqlServer on my development machine but get the same delay.
  • I have isolated the issue to the call to mssql_connect (calling mssql_pconnect has no effect)

  • It is a networking issue on how I have set up (or not set up, since I didn't really change default config) SQL server. It's not a strictly a programming issue but I thought I might get some valuable feedback here.

Can anyone tell me if there is a trick, specific set of protocols, registry setting, something that will kill this delay?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

浪荡不羁 2024-09-17 02:22:56

我在每次连接时也遇到了 5-10 秒的延迟,使用 PHP 的官方 Microsoft SQL 驱动程序(如 @gaRex 所建议) - 这里发布的答案都没有为我解决这个问题。

正如 @ircmaxell 所建议的,我的问题是 DNS 问题 - 解决方案是编辑 \windows\system32\drivers\etc\hosts 文件(您的本地本地主机文件)并添加名称我自己的机器。

在“系统属性”对话框中,找到您计算机的“计算机名称” - 然后将诸如 127.0.0.1 my-computer 之类的行添加到本地主机文件中。

对我来说,在接下来尝试加载页面时,延迟再次发生 - 之后,速度非常快,根本没有延迟。

请注意,该问题不仅在虚拟机上,甚至在物理机上也可能发生。

I was also experiencing a 5-10 second delay on every connect, using the official Microsoft SQL drivers for PHP (as suggested by @gaRex) - none of the answers posted here solved it for me.

As suggested by @ircmaxell, my problem was a DNS issue - and the solution was to edit the \windows\system32\drivers\etc\hosts file (your local local host file) and add the name of my own machine to it.

In the "system properties" dialog, find the "computer name" of your machine - then add a line like 127.0.0.1 my-computer to your local host file.

For me, the delay occurred once more, on the following attempt to load the page - after that, it was super fast, no delay at all.

Note that this problem may occur even on a physical machine, not only on a VM.

水波映月 2024-09-17 02:22:56

我在运行虚拟电脑时遇到网络问题,与网络相关的所有内容都很慢,请尝试在注册表中添加此条目:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

  • 创建名为DisableTaskOffload的新DWORD值并将其值设置为1 .

  • 重新启动计算机。

它对我有用,来源

I came across network issues when running virtual pc, everything network related is slow, try adding this entry on your registry:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

  • Create new DWORD value named DisableTaskOffload and set its value to 1.

  • Restart the computer.

It worked for me, source.

春庭雪 2024-09-17 02:22:56

这可能是 DNS 问题吗?我知道 MySQL 在每次登录(不是每次连接)时都会进行反向 DNS 查找。如果您的服务器没有反向 dns 记录(或者您的 dns 速度很慢),则可能会导致登录时出现严重延迟。 MySQL 中有一个选项可以禁用它。我不确定 SQL Server,但我认为它可能会做类似的事情......

Is it perhaps a DNS issue? I know that MySQL does a reverse DNS lookup on each login (not each connection). If you don't have a reverse dns record for your server (or your dns is slow) it can cause a major delay at login. There's an option in MySQL to disable that. I'm not sure about SQL Server, but I'd assume it may be doing something similar...

找回味觉 2024-09-17 02:22:56

我记得同样的问题,但忘记了我们是如何解决的。

为了澄清,请指定准确的连接字符串、您的 SQLserver 版本,并尝试启动这个旧的好实用程序 c:\WINDOWS\system32\cliconfg.exe,这也可以带来一些帮助。

是的,我知道,这是从 2k 开始的,但是 m$ 的人不喜欢从头开始创建客户端工具。

还尝试为 PHP 获取“正确的”mssql 客户端 dll。

I remember the same problem, but forgot, how we have solve it.

To clarify please specify exact connect strings, your SQLserver versions and also try to start this old good utility c:\WINDOWS\system32\cliconfg.exe, which is also can bring some light.

Yes, I know, it's from 2k, but guys at m$ don't like to create client tools from scratch.

Also try to get "right" mssql client dlls for PHP.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文