Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8131105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:58:46+00:00 2026-06-06T08:58:46+00:00

We are using octopus in our rails app to forward read queries directly to

  • 0

We are using octopus in our rails app to forward read queries directly to our slave boxes, and writes to our master. Have to say its a great gem, but we noticed that queries to the slaves forgoes Active Record’s default SQL caching. Kind of defeats the purpose to scale the DB servers horizontally only to lose out on the caching layer that would help scale.

Does anyone have an idea on how to fix this, or is there a better gem to use. We don’t need the sharding functionality that octopus gives; just the replication.

thanks ahead of time

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T08:58:47+00:00Added an answer on June 6, 2026 at 8:58 am

    The way SQL caching is turned on for a connection is by doing something like

    ActiveRecord::Base.connection.cache do
        # the query cache is used here
    end
    # and turned off by here
    

    For the main activerecord connection rails has a rack middleware that sets this up for each request. If you want this to happen for your slave connection then you’ll need to do something similar yourself to enable caching for your second connection (slightly easier than a rack middleware would be an around_filter)

    I’m not very familiar with octopus, but it seems likely that these two connections will be independant – activerecord won’t know to invalidate its cache on your read connection just because you’ve done some writes on your other connection

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
Using Xcode4.2.1, with a basic PhoneGap template based app. (I say template, but I
Using report builder 3.0, I have a report that queries a cube. How do
Using rails 3.1, ruby 1.92. I have a bunch of products in a store:
Using Rails 3.1. I have some pages that render same layout, except the contents
I am using Rails 3.0.9. (With ruby 1.9.3) I have been looking into some
Using Rails 3.2.0 with haml and sass: I Would like to link an external
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using Rails 3.2.0 with haml, sass and coffeescript: Basically I am trying to disable
Using MVC2 I have an AJAX form which is posting to a bound model.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.