首页 > 解决方案 > 如何加速多个 crypto.randomBytes 调用

问题描述

我将构建一个经常使用 crypto.randomBytes() 的服务。据我所知,它阻塞了 I/O。有没有办法至少加快这个过程?多核或多线程可以做什么?

标签: javascriptnode.js

解决方案


这里有一些细节:crypto#randomBytes 有多随机?

假设您不使用 windowscrypto.randomBytes()正在使用/dev/urandom. /dev/urandom如果它是性能瓶颈,似乎有一些替代方法: https ://serverfault.com/questions/6440/is-there-an-alternative-to-dev-urandom

也不,/dev/urandom 不会运行多核:https ://bbs.archlinux.org/viewtopic.php?id=160967


推荐阅读