Domanda

We switched to using Octopus for sharding in our rails2.3/postgresql/resque app because we were maxing out the disk I/O of our database server. We have ten databases, each with multiple shards. (A shard includes a schema search path).

Some of our processes that work across multiple customers are very slow.

Here is the structure of the code:

User.each do |u|
  Octopus.using(u.shard.to_sym) do
     update data
  end
end

We suspect that the issue is Octopus is constantly opening and closing database connections.

Is this how Octopus works? Can it keep a pool of database connections?

È stato utile?

Soluzione

There is a possible bug in ar-octopus 0.3.4. It was fixed with the following commit:

https://github.com/tchandy/octopus/commit/0c71fa228c3a9d659482a0dee8be5b4bd47493eb

The only change was to remove "hijack_initializer" from self.using.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top