Part IV. Distributed Reactivity4 min

Interlude. Meteor Under Load

The PDF storage prototype, put together over a weekend, worked flawlessly on my laptop. The tests passed, documents uploaded, and on the phone through Cordova everything looked the same as in the browser. The difficulties began when people arrived, and almost all of them were built the same way: what Meteor did for me inside one process stopped being free as soon as there were more processes or more users.

We had to start with the database. Tailing the MongoDB log, discussed in the fourteenth chapter, works only with a replica set. The database keeps the operation log in order to copy data between its servers, and a standalone server simply does not write it. Without a replica set Meteor silently fell back to polling every ten seconds, and the only way to find out was that the server started to slow down under load. So even a small production database was brought up as a replica set, if only of one node.

Then there was more than one server, and it turned out you could not simply put them behind a load balancer. If the browser failed to open a WebSocket and SockJS fell back to long polling, every subsequent request from that client had to reach the same server where its session lived, otherwise the server would not recognize the client. The load balancer had to be configured so that each client always reached its own server, and as a result the load was spread less evenly than one would like.

Free, one step away

The rest of the book is free

Leave your email and I will send a link to confirm it. Once you click it, every chapter opens here, on this device, for a year. When a new book comes out I will write to this address; reply “stop” to any email and I will not write again.

Have an INITE account? Sign in and the book opens without an email.

I do not charge for the book. If you would like to support it, you can donate from any chapter.

How your email is stored