matrixone icon indicating copy to clipboard operation
matrixone copied to clipboard

[Feature Request]: Cache short connections in Proxy.

Open fengttt opened this issue 1 year ago • 6 comments

Is there an existing issue for the same feature request?

  • [X] I have checked the existing issues.

Is your feature request related to a problem?

If client quickly establish many connections, run a simple query then disconnect, the connection/session overhead is pretty high.

Proxy should auto pool such connections.

Describe the feature you'd like

At proxy, proxy receive connection request, establish connect to matrixone database. If customer disconnects, proxy can keep the connection to matrix one alive, for a short period of time. When next connection comes in, we check if we can reuse an existing connection.

Describe implementation you've considered

Note that we probably want to reuse connect with same user and same authentication method. We should keep all privilege check etc cached/reused as well.

To reuse an existing connection/session, any state of the session must reset -- session variables and prepared statement handles comes to mind.

Number of cached connections, for how long, etc, should be policy driven. Maybe policy should be per account.

Documentation, Adoption, Use Case, Migration Strategy

No response

Additional information

Connection pooling can happen at different unit of work. It can be statement (means different statement can run using different connection), transaction (means different transactions can run using different connections, but all statement in one transaction are executed in one connection), session. We want session level pooling because we can/must preserve the semantics of session.

fengttt avatar May 16 '24 00:05 fengttt

finished

volgariver6 avatar Sep 09 '24 04:09 volgariver6

proxy 里有个配置项:

[proxy]
conn-cache-enabled = true 

打开这个配置才生效

volgariver6 avatar Sep 25 '24 03:09 volgariver6

after checked with @aressu1985 , this feature has enter testing phase, recommanded milestone is 2.0.1

allengaoo avatar Nov 04 '24 07:11 allengaoo

DEALY 到下个版本解决

aressu1985 avatar Nov 26 '24 02:11 aressu1985

测试一轮有bug,来不及解决,挪到下一版本

heni02 avatar Dec 16 '24 10:12 heni02

下一版本测试

heni02 avatar May 30 '25 06:05 heni02

proxy 日常回归测试使用,没有发现问题,closed

heni02 avatar Nov 06 '25 02:11 heni02