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

Dependency on Rails #1

Open
adomokos opened this issue May 23, 2018 · 3 comments
Open

Dependency on Rails #1

adomokos opened this issue May 23, 2018 · 3 comments

Comments

@adomokos
Copy link
Contributor

Hello,

we are evaluating this gem and we noticed it has a dependency on Rails. We've also looked at ar-octopus, but that has no dependency on Rails, only on activerecord.

We are considering using it in a pure Ruby app and we are hesitant to use it due to this dependency.

Can you please describe why you have the dependency on Rails and not on ActiveRecord only? Would you consider a PR to narrow that dependency?

Thanks!

@hsgubert
Copy link
Owner

hsgubert commented May 24, 2018

Hi @adomokos, thanks for your message.

I developed rails-sharding to suit the needs of my company, after having a bad experience trying to work with octopus. Not that octopus is a bad gem, it is just that it had issues (bugs) and in our opinion it has kind of a double purpose (sharding and replication), which can be confusing some times.

I never worked with activerecord outside of rails, so I simply didn't put the time to narrow the gem dependency to activerecord only. And in our use case, it just didn't matter since we use rails.

Taking a look at rails-sharding code, I think the only things that depend on Rails are the generators and the railtie (which adds the rake tasks to the Rails app). I don't know how you would deal with those components outside of a Rails app (e.g. how to include rake tasks into a pure Ruby app), but this is probably just because I don't know how those apps are structured.

If you want to take a stab and narrow the dependency to AR only that would be much appreciated. As long as it doesn't affect how the gem works in a Rails app it's fine by me.

Just some info to help you decide about the gem: we've been using it in a full-fledged large-size application with dozens of MariaDB shards for 1.5 years now and we couldn't be happier. I can also assure you I will keep maintaining the gem, as our companies' systems all depend on it. Of course, the logic of choosing the shards where to put/get data must be implemented in your app, but I actually see this as a good thing, as the gem is completely agnostic to your sharding criteria.

Feel free to discuss with me any ideas you might have.

@adomokos
Copy link
Contributor Author

@hsgubert - I am super happy to read your comment! 👍 💯

Our company is using Octopus with 1 master and ~150 smaller sharded dbs, and since that project seems to be abandoned, we are looking for an alternative. Your gem came on our horizon. :-)

We have a more distributed environment, where we have Ruby workers using our data access gem, but right now we are stuck with AR 4.1.x, as Octopus is bascially abandoned. Octopus seems bloated for our simple sharding needs, and rails-sharding might fit the bill. We have toyed with the idea of writing it on our own, but this gem is very close to our needs.

I'll look into what it would take to narrow the scope of the dependent gems, your comments are definitely helpful. Thanks for it! I'll submit a PR and we can discuss it through that.

@hsgubert
Copy link
Owner

Great!

You're probably right about octopus. I met the gem maintainer at a RubyConf 2017 and he told me personally he would not maintain the current gem anymore. He did say he was thinking about writing a v3.0 but I think he never started it.

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

No branches or pull requests

2 participants