V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
tututututututu

在.Net 中 是否有第三方实现 Sqlserver 客户端连接池的 SDK

  •  
  •   tututututututu · Apr 13, 2023 · 3118 views
    This topic created in 1116 days ago, the information mentioned may be changed or developed.

    需求:在.Net 中我想有一个连接池并且使连接一直处于被打开状态,比如我有 100 个已经被打开的连接,这样流量过来的时候就不需要新创建 SqlConnection 然后再 Open(这个操作 Latency 太高了),有类似实现的 SDK 嘛

    2 replies    2023-04-15 21:33:11 +08:00
    jtwor
        1
    jtwor  
       Apr 13, 2023
    forgottencoast
        2
    forgottencoast  
       Apr 15, 2023
    连接池是内置的,你只需要根据你的需求进行配置就可以了。
    详见: https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/sql-server-connection-pooling
    Connection pooling reduces the number of times that new connections must be opened. The pooler maintains ownership of the physical connection. It manages connections by keeping alive a set of active connections for each given connection configuration. Whenever a user calls Open on a connection, the pooler looks for an available connection in the pool. If a pooled connection is available, it returns it to the caller instead of opening a new connection. When the application calls Close on the connection, the pooler returns it to the pooled set of active connections instead of closing it. Once the connection is returned to the pool, it is ready to be reused on the next Open call.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   863 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 18:49 · PVG 02:49 · LAX 11:49 · JFK 14:49
    ♥ Do have faith in what you're doing.