HmacSHA1的Mac.getInstance()需要花费很多时间才能执行 [英] Mac.getInstance() for HmacSHA1 taking ages to execute

查看:398
本文介绍了HmacSHA1的Mac.getInstance()需要花费很多时间才能执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到了一个部署问题,调用了Mac.getInstance("HmacSHA1").
在此特定服务器上执行该单个调用最多可能需要10分钟,而在其他计算机上,该调用将立即执行.

I've recently ran into a deployment issue with a call to Mac.getInstance("HmacSHA1").
It can take up to 10 minutes to execute that single call on this specific server, whilst on other machines its execution is instant.

通话期间CPU使用率也会飙升.

CPU usage also spikes during the call.

有关服务器的一些详细信息:

Here's a bit of details on the server:

  • 操作系统:CentOS 5.6 Final(内核2.6.35.8-16,i686);
  • JVM :Sun的JDK 1.6.0_25(32位);
  • CPU :Intel Core2 Duo CPU(E8400@3.00GHz);
  • 内存:2GB RAM;
  • 专用物理服务器.
  • OS: CentOS 5.6 Final (kernel 2.6.35.8-16, i686);
  • JVM: Sun's JDK 1.6.0_25 (32bit);
  • CPU: Intel Core2 Duo CPU (E8400@3.00GHz);
  • Mem: 2GB of RAM;
  • Dedicated physical server.

关于这里可能是什么问题的任何线索?

Any clues on what might be the problem here?

推荐答案

我怀疑您对安全随机数的系统熵了解不足.请查看此页面进行检查:在Linux中检查可用的熵.这个问题可以考虑以下答案:如何使用Java SecureRandom解决性能问题?特别是此Java选项应该可以帮助您:

I suspect you're low on system entropy for secure random numbers. See this page to check: Check available entropy in Linux. And this question has answers to consider: How to solve performance problem with Java SecureRandom? In particular this Java option should help you:

-Djava.security.egd=file:/dev/./urandom

速度更快,但安全性稍差.

It's much faster, but slightly less secure.

这篇关于HmacSHA1的Mac.getInstance()需要花费很多时间才能执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆