Java Keystore.getKey()缓慢,而Key存储大小增加 [英] Java Keystore.getKey() slow while Key store size Increase

查看:907
本文介绍了Java Keystore.getKey()缓慢,而Key存储大小增加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用java密钥存储来存储和检索加密密钥。当我的密钥存储大小小时,它的工作速度更快。但是,一旦我的主要商店规模比主要店铺的运营增长缓慢。



我正在linux平台上工作,Java版本为Jdk_1.8。和safenet作为提供者。

解决方案

我已经面临与执行速度相关的相同问题,随不同的操作系统平台而变化。 p>

Jvm将密钥存储器加载到内存中。它的hashtable集合作为内部存储。



Hashtable是同步的。



每当你执行从键的操作存储,而不是从内存密钥存储而不是从物理密钥库返回它。
您可以通过在linux基础操作系统中使用(top - %wa部分)命令来确认。



密钥存储正在使用散列表,它是根导致性能下降。



我已经解决了这个问题,将密钥库中的所有密钥加载到ConcurrentHashMap中,同时初始化项目。后来,
所有读操作都将从MAP而不是keystore执行。
并确保所有写操作都将在密钥库和MAP上执行。


I am using java key store to store and retrieve encryption key.It works faster while my key store size is small. But once my key store size is increased than key store operation goes slow.

I am working on linux platform, Java version Jdk_1.8. and safenet as provider.

解决方案

I have been facing the same issue related to execution speed varies with different operation system platform.

Jvm loads key store in memory. And its having hashtable collection as internal storage.

Hashtable is synchronized.

Whenever you perform get operation from key store, than it will return it from in-memory key store not from physical keystore. You can confirm it by using ("top" - %wa section) command in linux base OS.

Key store is using hashtable and it is the root cause behind performance decriment.

I have solved this issue by loading all keys from keystore into ConcurrentHashMap while initializing the project. and later on, All the read operation will be performed from MAP instead of keystore. And make sure that all write operation will be perform on both keystore and MAP.

这篇关于Java Keystore.getKey()缓慢,而Key存储大小增加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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