1

I have an existing, large Rails app, servicing customers. My predecessors used the Apartment gem to partition the business customers into separate DBs within MySQL (really, Aurora on AWS). They also started using Octopus to direct some of the DB reads to Aurora read replicas.

This has started causing some issues. Writes are being directed to read replicas, dogs and cats getting along in peace, that sort of thing.

Unfortunately, I'm already running on the biggest hunk of hardware Amazon offers and, while I am currently using only about 10% of server CPU, I expect that to climb considerably as I start generating more complex reports. I need those reads to go to replicas, but I can't use Octopus to do it.

Is there any way, via ActiveRecord, Apartment, AWS, Aurora, Voodoo, or magical elves, that I can get stable behavior using read replicas with Apartment? Removing Apartment is not an option, since it's deeply entwined with our codebase and database schemas. So far, we're using Octopus only very lightly - it only shows up 3-4 times in the codebase (though it's keeping the Aurora replicas quite busy).

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Sniggerfardimungus
  • 11,583
  • 10
  • 52
  • 97
  • It sounds like an issue with how you are using Octopus. If you are writing to a read replica you just have it set up incorrectly. – nzajt Jan 19 '18 at 17:42
  • To this point, Octopus has behaved well enough, it's as we start doing more complicated activities with it that we've discovered that it's supposedly not compatibly with Apartment. Are you running them in a complex configuration in a production environment? – Sniggerfardimungus Jan 19 '18 at 21:37
  • Did you ever find a solution for this? I need to use Apartment to host Postgres schemas on databases in different regions. I wanted to use Octopus for public schema read replicas to reduce latency between the regions. – KPheasey Mar 01 '19 at 15:22

0 Answers0