WiserSolutions/quadro

Evaluate switching from Koa to Fastify

tomeresk opened this issue · 2 comments

https://github.com/fastify/fastify

Their benchmarks claim it is 50% faster than koa when using koa-router (and koa itself is faster than all the other popular web servers/frameworks).

Fastify itself supports async/await and routing and seems to be decently convenient to use.
Also has optional JSON Schema support to possibly make heavily used APIs/handlers faster.

This will likely be a breaking change, though that can possibly be prevented by Quadro intervening to enforce the existing koa API and internally converting it to the Fastify API (I don't think thats a good idea though).

The main discussion I want to raise here is whether this performance increase is big enough to warrant evaluating the feasibility/effort of making this change

I think this likely won't make a big impact in most cases, since most of the time spent handling the request is not related to koa itself.
It will probably make a noticeable difference in the simple GET APIs (which we are hitting a lot), but I don't think those APIs have a significant impact on server performance at this point.

Generally I think this is something to keep an eye on as services that use Quadro increase in scale, but probably not worth the time investment at the moment.
Main thing in favor is that making such a change will become harder in the future when more services use Quadro.

Router/web framework performance is a complete non-issue in Wiser apps at this point (and if we ever write service that handles so much load that we have to care about router performance then I sincerely hope it won't be using Node.js).
Fastify might be useful for us as we evolve Quadro (TS support, JSON Schema) but that would be covered in a different task.