seamless_database_pool | Add support for master/slave database clusters | Database library
kandi X-RAY | seamless_database_pool Summary
kandi X-RAY | seamless_database_pool Summary
Add support for master/slave database clusters in ActiveRecord to improve performance.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of seamless_database_pool
seamless_database_pool Key Features
seamless_database_pool Examples and Code Snippets
Community Discussions
Trending Discussions on seamless_database_pool
QUESTION
I have a Rails/ActiveRecord application that occasionally executes some heavy read-only queries against the application's models for ad-hoc admin/reporting purposes. I currently send these queries to a separate read-replica database endpoint using the seamless_database_pool gem so these queries do not add load to the primary database. However, this setup adds a constant runtime dependency on the replica, reducing my application's availability - whenever the replica goes offline for maintenance, the entire site returns 503 errors on any request, even though most requests never query the read-replica at all.
How can I connect to a read replica for ad-hoc reporting queries on ActiveRecord models without affecting the availability of my application? Is there another database-adapter gem that handles this use-case explicitly?
Or, (even better) is it possible to accomplish this directly using ActiveRecord? I know that it's possible to connect to a separate database by calling #establish_connection
in order to direct a specific model to a separate database across all controller actions, but for my use case I need to connect to a separate database across all models, but only for specific controller actions.
ANSWER
Answered 2017-Feb-24 at 15:59I managed to work around this issue by modifying the seamless_database_pool
gem to relax the runtime dependency on the read-replica when only the master connection is being used. See the relevant issue and PR.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install seamless_database_pool
On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Installers can be used to install a specific or multiple Ruby versions. Please refer ruby-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page