An operation of encrypting user passwords is synchronous and takes 69ms. Is it acceptable?
If there are a large number of users and multiple people register at the same time, will it cause the node process to crash
Please ask God for answers. .
仅有的幸福2017-05-16 13:33:05
Multiple people register at the same time...
How much more can it reach 10k? Moreover, it is all blocked and encrypted synchronously. It will not crash, it will just be slower.
If you are worried, just take a test and you will know.
高洛峰2017-05-16 13:33:05
It will not crash. CPU operations cannot be asynchronous. All asynchronous operations are IO operations
天蓬老师2017-05-16 13:33:05
I want to know what kind of complex encryption is it that takes so long? I found that multiple new Date() also have time differences
phpcn_u15822017-05-16 13:33:05
Use ab to stress test the interface, and you will know whether it will crash and whether the speed is acceptable.
In case of crash, use PM2 to start the service. PM2 can automatically wake it up for you.
PS: Your encryption operation here takes 69ms, but finish takes 600ms. If this finish refers to http finish, the biggest performance bottleneck is your framework
黄舟2017-05-16 13:33:05
Since you can’t accept it, change the encryption process to asynchronous one