如何加快连接到MS SQL Server的应用程序的速度?

时间:2021-08-05 02:45:31

I have a Delphi application running on SQL Server 2000, but it's taking awfully long to connect to the database!

我有一个在SQL Server 2000上运行的Delphi应用程序,但是连接到数据库需要很长时间!

But when I run this application on my development server it connects pretty fast!

但是当我在我的开发服务器上运行这个应用程序时,它连接得非常快

I am running on Windows 2003 server, SQL Server 2k personal edition, when I look on my MDAC version in the registry, I see version 2.8 already installed!

我在Windows 2003服务器,SQL Server 2k个人版上运行,当我在注册表中查看我的MDAC版本时,我看到已经安装了2.8版本!

Any ideas why this happens on the production machine but not on the development machine?

有什么想法为什么会在生产机器上而不是在开发机器上发生?

4 个解决方案

#1


There's a reasonable chance that this is down to a network level issue connecting to the database. Depending on whether you're running the application and database on the same box of course.

这有可能归结为连接到数据库的网络级问题。取决于您是否在同一个盒子上运行应用程序和数据库。

Try connecting to the database from the same machine using a different tool. You could set up a data source and test it from the control panel as an alternative. If the connection is slow from another tool test the connectivity between the servers for other types of connection (e.g. run a ping). It may be that it's resolving the server via broadcast rather than the domain, for instance. Or any number of other issues - firewall, switch, wins etc.

尝试使用其他工具从同一台计算机连接到数据库。您可以设置数据源并从控制面板进行测试。如果来自另一个工具的连接速度很慢,则测试服务器之间的连接以进行其他类型的连接(例如,运行ping)。例如,它可能是通过广播而不是域来解析服务器。或任何其他问题 - 防火墙,开关,胜利等。

If you are connecting using integrated authentication also ensure that the database can resolve the application server as well as vice versa. This is part of the authentication process and I've seen it cause slow downs in creating database connections before.

如果使用集成身份验证进行连接,请确保数据库可以解析应用程序服务器,反之亦然。这是身份验证过程的一部分,我看到它导致之前创建数据库连接的速度变慢。

In short, I'd be confident that this isn't a problem specific to delphi / sql, but something in the communications between your production servers.

简而言之,我相信这不是特定于delphi / sql的问题,而是生产服务器之间通信的问题。

Good luck!

#2


Keep your connection open once you have established it. This is called connection pooling and will improve performance. I have no clue how to do it with a delphi application.

建立连接后保持连接打开。这称为连接池,将提高性能。我不知道如何使用delphi应用程序。

#3


Your problem most likely is network or transport layer related

您的问题很可能是网络或传输层相关

  1. Are you connecting through TCP, Named Pipes or another mechanism?
  2. 您是通过TCP,命名管道还是其他机制进行连接?

  3. Have you tried tracing opening a connection with Microsoft SQL Profiler?
  4. 您是否尝试过跟踪打开与Microsoft SQL Profiler的连接?

regards,
Lieven

#4


I had a problem a long time ago like this, and it came down to the workstation section of the connection string. its possible if you've copied the connection string from your dev machine that the workstation parameter is still in the connection string and pointing to your dev machine which probably does not exist on your deployment network.

很久以前我遇到过这样的问题,它来到了连接字符串的工作站部分。如果您从开发计算机复制了连接字符串,工作站参数仍在连接字符串中并指向您的部署网络上可能不存在的开发计算机,则可能。

In this case your connection to the database has to wait until the network tries to connect ot a non-existant machine (which obviously takes time). Remove the workstation cluse and it will speed up no end.

在这种情况下,您与数据库的连接必须等到网络尝试连接不存在的计算机(显然需要时间)。删除工作站cluse,它将加速无止境。

#1


There's a reasonable chance that this is down to a network level issue connecting to the database. Depending on whether you're running the application and database on the same box of course.

这有可能归结为连接到数据库的网络级问题。取决于您是否在同一个盒子上运行应用程序和数据库。

Try connecting to the database from the same machine using a different tool. You could set up a data source and test it from the control panel as an alternative. If the connection is slow from another tool test the connectivity between the servers for other types of connection (e.g. run a ping). It may be that it's resolving the server via broadcast rather than the domain, for instance. Or any number of other issues - firewall, switch, wins etc.

尝试使用其他工具从同一台计算机连接到数据库。您可以设置数据源并从控制面板进行测试。如果来自另一个工具的连接速度很慢,则测试服务器之间的连接以进行其他类型的连接(例如,运行ping)。例如,它可能是通过广播而不是域来解析服务器。或任何其他问题 - 防火墙,开关,胜利等。

If you are connecting using integrated authentication also ensure that the database can resolve the application server as well as vice versa. This is part of the authentication process and I've seen it cause slow downs in creating database connections before.

如果使用集成身份验证进行连接,请确保数据库可以解析应用程序服务器,反之亦然。这是身份验证过程的一部分,我看到它导致之前创建数据库连接的速度变慢。

In short, I'd be confident that this isn't a problem specific to delphi / sql, but something in the communications between your production servers.

简而言之,我相信这不是特定于delphi / sql的问题,而是生产服务器之间通信的问题。

Good luck!

#2


Keep your connection open once you have established it. This is called connection pooling and will improve performance. I have no clue how to do it with a delphi application.

建立连接后保持连接打开。这称为连接池,将提高性能。我不知道如何使用delphi应用程序。

#3


Your problem most likely is network or transport layer related

您的问题很可能是网络或传输层相关

  1. Are you connecting through TCP, Named Pipes or another mechanism?
  2. 您是通过TCP,命名管道还是其他机制进行连接?

  3. Have you tried tracing opening a connection with Microsoft SQL Profiler?
  4. 您是否尝试过跟踪打开与Microsoft SQL Profiler的连接?

regards,
Lieven

#4


I had a problem a long time ago like this, and it came down to the workstation section of the connection string. its possible if you've copied the connection string from your dev machine that the workstation parameter is still in the connection string and pointing to your dev machine which probably does not exist on your deployment network.

很久以前我遇到过这样的问题,它来到了连接字符串的工作站部分。如果您从开发计算机复制了连接字符串,工作站参数仍在连接字符串中并指向您的部署网络上可能不存在的开发计算机,则可能。

In this case your connection to the database has to wait until the network tries to connect ot a non-existant machine (which obviously takes time). Remove the workstation cluse and it will speed up no end.

在这种情况下,您与数据库的连接必须等到网络尝试连接不存在的计算机(显然需要时间)。删除工作站cluse,它将加速无止境。