Perl lock file while updating
This workaround solved the CPU issue for new clients, but created a network performance problem of its own, as it taxes each client's upload bandwidth.
Over a slow connection, this delays the reception of subsequent commands from the client.
Deploying on intranets means that we can't simply throw hardware at the problem in the same way multi-tenant, hosted-only systems did (e.g., Doc Verse, which later became part of Google Docs); we can assume only a modest amount of server capacity.
Compared to intranet deployments, cloud-hosted instances offer better capacity and on-demand extension, but network connections from browsers are usually slower and fraught with frequent disconnections and reconnections.
We also experimented with embedded JS engines (V8, Spider Monkey), but they imposed their own performance penalties when running inside Feersum's event loop.
Finally, by August 2011, we resolved to rewrite the server in
It took us only an afternoon to code up a functionally equivalent server in just 80 lines of code, thanks to the concise API offered by Zappa JS.
Under the naive backlog model, when a client joins such an edit session, it must replay thousands of commands, incurring a significant startup delay before it can make any modifications.
To mitigate this issue, we implemented a snapshot mechanism.
On top of Feersum, we use the Pocket IO middleware to leverage the popular Java Script client, which provides backward compatibility for legacy browsers without Web Socket support.
The initial prototype closely resembles a chat server.
Initial micro-benchmarking showed that porting to costed us about one half of maximum throughput: On a typical Core i5 CPU in 2011, the original Feersum Tatsumaki stack handles 5k request per second, while Express maxes out at 2.8k requests.