I use nginx to do the load balancing. I host meteor on digitalocean and
have my mongodb with compose in the digitalocean data centre in the same
location and have never noticed any speed issues between meteor and the db
but I’m not sure how I would measure that either.
For CDN that’s an easy fix. You can use cloudfront or cloudflare for free.
The issue with cloudflare is you need to make sure the load balancing still
works if you stick cloudflare in front of it since if you use ip_hash for
the load balancing algorithm with nginx, that depends on knowing the user’s
If you’re on aws then just using cloudfront may make more sense.
I serve all my static assets using cloudfront. The one exception is the
main html, js and css files for the site. The reason I don’t use cloudfront
for these is that if I have two meteor instances running different versions
of the site, then cloudfront may not be able find the the correct files to
serve the user and then the site won’t load for the user. One way to get
around this would be to always make sure that all meteor instances are on
the same version but this would be even be an issue during updates of the
In addition to this you can get nginx to cache static assets for even less
load on node.js.
But the real issues I’ve felt have been adding more servers no longer helps
things. Apparently connecting too many instances to your mongo db can cause
Oplog and the cpu required for publications observing the oplog seem to be
the biggest scaling pains.
One thing I’m interested to hear about is if people have tried splitting up
publications into different meteor instances. Basically all this instance
does is run publications for a single collection. That would be a really
nice way to scale. I just wonder how many connections each instance could
handle and how exactly you’d connect to the multiple instances from the
client. What the best way to structure such a system would be. Sending DDP
messages between servers may be the way to go with this approach and that
may be what meteor cluster package is all about.
I’d also be interested to hear about hitting mongo bottlenecks with too
many reads or writes per second. And how people have dealt with that and
when you can expect to hit these limits.