Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

share connection between catalog #31

Closed
wants to merge 2 commits into from
Closed

share connection between catalog #31

wants to merge 2 commits into from

Conversation

gfreezy
Copy link
Contributor

@gfreezy gfreezy commented Mar 13, 2016

setCatalog 场景是:
在设计分库的时候,为了以后方便扩展,会使用比较大的切片,比如拆分为 4096 个shard。但是初期的数据量并不会很大,比如用 16 台机器,每个机器跑1个数据库进程,每个进程放 256 个 db。按照现有的一个db一个连接的情况下,一个worker就要用掉数据库256个连接,随便起几十个worker,数据库的连接数就满了。

实现了 ShardConnection 的 setCatalog getCatalog 方法。

@terrymanu 根据 #27 做了调整。

H2 不支持 setCatalog 所以没有增加相关的测试

@hanahmily
Copy link
Contributor

@gfreezy 你的虚拟桶的分片思路是很好的,与couchbase的vBucket思路很像。当时目前有一个问题,你每次会切换catalog,但是目前正在使用Sharding-JDBC的工程一般都是直接配置MySQL的url配置database名字的,而数据源名字仅仅作为一个区分并不与database有任何关联。

我们核心维护这边目前规划在将catalog纳入到这个路由规则里面进行实现,单这牵扯的功能很多,需要有一定时间才能完成。

@hanahmily hanahmily closed this Mar 29, 2016
terrymanu pushed a commit that referenced this pull request Sep 23, 2018
@sunOnly sunOnly mentioned this pull request Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants