Java Keystore.getKey() slow while Key store size I

2019-02-27 18:54发布

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.

2条回答
一夜七次
2楼-- · 2019-02-27 19:07

We have faced this issue when we were using safenet jar file as a key store provider, when I removed safenet as a provider & used default providers of java then I didn't face any performance related issue.

查看更多
成全新的幸福
3楼-- · 2019-02-27 19:17

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.

查看更多
登录 后发表回答