4 ms·
The cool thing about multi-database feature that's coming to Rails is setting like >config.active_record.database_selector = 2.seconds Rails provides a way to
by gotts 7y ago
The cool thing about multi-database feature that's coming to Rails is setting like
>config.active_record.database_selector = 2.seconds
Rails provides a way to make sure that at-least for first two seconds after the write operation, read requests are handled by the write instance. This assumes that your read replica will get updated within 2 seconds with the live data.
How cool is that
- takeda 7y agoHow does that work though? If you have multiple instances that are serving the same traffic, how do one know about the change made by the other? Is it a global timer? i.e. any write affects reads, or it knows and only works on the same table? Why not keep dependent operations within the same transaction? If that would be done by rails from the start then I could just easily split read/write through pgpool.
- fxn 7y agoIt is read-your-writes semantics, and the metadata is stored in the session.