Pull request opened for dramatic improvements to oplog tailing & writes

Hello all!

One of the programmers (Oleksandr Chekhovskyi) here at Hansoft found a (for us) blocking performance issue that after some profiling and fixing by him dramatitically improved the performance server-side of our application. The issue happen when a method did a lot of writes (not a lot for an application in general).

A short description of the problem from Oleksandr:

Before this change, number of catch-up attempts was N*M, where N is number of writes inside of the fence, and M is number of active observers on affected collections. Every catch up issues yet another query to find the latest oplog entry.

It was extremely inefficient, in terms of both CPU usage and added latency. After executing write-heavy methods, application process was occupied for many seconds doing the same thing over and over again.

You can read about it here: https://github.com/meteor/meteor/pull/4694

Have you experienced similar problems with your app? Any feedback on the solution to the problem?