Closed AndreaCrotti closed 7 years ago
Do you run a replica set in production, so that you can do an import from a secondary? That's our usual recommendation to avoid performance degradation.
But we could probably add a rate limit or throttle. If you want to experiment, adding something in handle_op
would probably be the right place: https://github.com/stripe/mosql/blob/master/lib/mosql/streamer.rb#L195
Yes well the Mongo database is pretty fast and it does not have problems, it's just that it's writing too fast in Postgres and thus causing a very high load there.
I think I'll end up just adding some sleeps here and there, not a great solution but it might work at least..
I guess we can close this by now
I've tried to run a migration today on production and it's really fast, I got
550 k rows in 2 minutes, which is around 5k per second. However that's too fast, because the app suffered while I was doing that! In verbose mode it did less than 3k per second and that didn't really affect the db that much..
Is there a way to do some rate limiting to make it run a bit slower (even a bit hacky changing the code)? Even introducing a silly sleep here and there if that makes the trick would be enough for now..