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

Connection re-use #2

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Conversation

jason-o-matic
Copy link

We were running into connection limit issues with mysql when using multiple :shard_by values. We're sharding different models differently, but to the same set of shards, so we end up duplicating connections that are the same for all intents and purposes. I made a change that searches through shard_pools looking for an connection to the same DB before creating a new connection. This reduced our number of DB connections by half.

I also added a test for this. In order to ease my life when testing I setup everything with bundler, which I'm hoping you'll pull in as well.

Thanks,
Jason

@bpot
Copy link
Owner

bpot commented Mar 3, 2012

This looks good. Can you extract the equivalent config finding logic into a separate method, #current_pool is getting kinda busy.

@jason-o-matic
Copy link
Author

I'm not actually working on the project I was using data_fabric for anymore. This pull request was actually sitting on the parent repo for many months before mperham noticed and recommended I send it over here, which didn't require any dev setup or work. Unfortunately it will probably be a while before I get a chance to work on it again.

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.

2 participants