Delphi 7 ADO 连接池在 IIS 之外
我们有一个 Delphi 7 应用程序,它作为 IIS6 中的 ISAPI 扩展运行。 该代码使用 ADO 连接到 MS SQL 2000 数据库并对数据库执行多次读取(无写入)。 如果我在 SQL 探查器中观察审核登录和注销事件,我可以看到对应用程序的大量请求仅导致 1 个审核登录事件。 但是,如果我从 IIS 外部运行相同的代码(即测试应用程序调用 dll 中的相同方法),我会看到许多登录和注销事件。 我的猜测是 IIS 正在执行一些自动连接池,而我无需执行任何操作。 出于性能原因,当我从 IIS 外部运行 dll 时,我希望看到相同的行为 - 在这种情况下应用程序几乎慢了 100%。 当 dll 在 IIS 之外运行时,如何获得 ADO 连接池?
编辑-我实际上正在使用 SQL ole 提供程序。 连接字符串如下所示:
Provider=SQLOLEDB.1;Initial Catalog=%s;Data Source=%s;Password=%s;User ID=%s;Pooling=True;Min Pool Size=5;Max Pool Size= 50;Connection Lifetime=120
我尝试添加 Pooling=True 属性,但这不会改变任何事情。 另外,我了解到审核登录和注销事件不一定会因连接池而改变,因此我开始使用登录/秒、注销/秒和用户连接性能计数器 (SQLServer:GeneralStatistics) 来确定是否发生连接池。 从 IIS 内部,我看到每秒有许多登录,但每秒没有注销。 在 IIS 之外,我看到每秒有许多登录和注销,并且用户连接发生波动(在 IIS 中保持稳定)。
We have a Delphi 7 application that runs as an ISAPI extension in IIS6. The code use ADO to connect to a MS SQL 2000 database and performs many reads on the database (no writes). If I watch the audit login and logout events in SQL profiler I can see that numerous requests to the app result in only 1 audit login event. However, if I run that same code from outside IIS (i.e. a test app calling the same method in the dll) I see many login and logout events. My guess is that IIS is performing some automatic connection pooling without my doing anything. I'd like to see the same behavior when I run the dll from outside of IIS for performance reasons - the app is almost 100% slower in this situation. How can I get ADO connection pooling when the dll runs outside of IIS?
EDIT - I'm actually using the SQL ole provider. The connection string looks like this:
Provider=SQLOLEDB.1;Initial Catalog=%s;Data Source=%s;Password=%s;User ID=%s;Pooling=True;Min Pool Size=5;Max Pool Size=50;Connection Lifetime=120
I tried adding the Pooling=True attribute but this doesn't change things. Also, I learned that audit login and logout events don't necessarily change for connection pooling so I started using the Logins/sec, Logouts/sec and User Connections performance counters (SQLServer:GeneralStatistics) to determine if connection pooling occurs. From inside IIS I see many logins/sec and no logouts/sec. Outside of IIS I see many logins and logouts per second and user connections fluctuates (it holds steady in IIS).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据给定的信息很难说,但连接池肯定是基于连接字符串的 - 如果连接字符串完全相同,则可以池化连接...听起来您的外部应用程序可能正在改变连接细绳?
IIS 不汇集 ADO 连接。 不过它可能会缓存 ISAPI dll。 您是否连续启动/停止外部应用程序? 或者是单次运行导致多个登录事件?
It's hard to say based on the info given, but connection pooling is definitely based off of the connection string - if the connection string is exactly the same then the connection can be pooled... it sounds like your outside application may be altering the connection string?
IIS isn't pooling ADO connections. It is likely caching the ISAPI dll though. Are you starting/stopping your outside application continuously? Or is it a single run causing multiple login events?