Collection.find().observe() stopping when there are many updates

Hi,

We send push notifications from a dedicated instance whose sole task is to observe a collection for updates and when certain updates happen it sends the relevant push notifications to users.

The problem is that we have burst of updates where a few thousand happen in a short period of time. When this happens, observe just stops and only starts up again when we restart the server.

Is there a way to avoid having to restart the server manually to fix this and to find out when observe has maxed out?

One idea we have is to just rerun the observe function every 30 minutes or so so that we have a maximum of 30 minutes of downtime. But I was wondering if there’s perhaps a better alternative.

The docs say that observe should run forever:
The query will run forever until you call this.

This is unfortunately not the case however when there’s heavy load.

Are you sure observe stops, or does the server process go into meltdown? It may be worth examining the process stats to see if you can fix this by allocating more memory to the node process (may help if garbage collection is eating the cpu).

Yup. It’s the server crashing. Will take a look at CPU/memory allocation. Thanks

2 Likes