My authentication system is slow in my backend code.
I am a software engineer and recently started learning some backend development, currently NestJs + Express and NodeJS as runtime.
Right now I had completed the authentication module but when I tested the system the password encryption using bcrypt is quite slow and taking good amount of performance from the CPU, and I am planning some solutions.
Currently it is all asynchronous code using async/await.
But I am thinking how I can offload this heavy cpu workload from main thread
Right now I thought of 2 solutions:
- Using service-workers
- Using wasm + some low level language code
I will implement both of them as learning but I am curious how in production do these problems are tackled ?
Also did not tried bun due to its non reliability.