简体   繁体   English

从 Hazelcast Map 读取值列表的最有效方法

[英]Most efficient way to read list of values from Hazelcast Map

We are using Hazelcast as a cache and want to read a list of 50 items from a single map.我们使用 Hazelcast 作为缓存,并希望从单个地图中读取 50 个项目的列表。 Currently we are seeing quite a long delay reading this list ~20ms.目前,我们看到阅读此列表有相当长的延迟~20 毫秒。 Reading a single entry is extremely quick but it seems this is scaling quite badly.读取单个条目的速度非常快,但似乎扩展性很差。 I have tried using the Imap methods of我曾尝试使用 Imap 方法

  • .getAll(setOfKeys) .getAll(setOfKeys)
  • Iterating the list and calling .get(singleKey) for each one迭代列表并为每个列表调用 .get(singleKey)
  • Iterating the list and calling .getAsync(singleKey) and then iterating the list of futures getting them迭代列表并调用 .getAsync(singleKey) 然后迭代获取它们的期货列表

Is there a better way to do this or do I need to rethink the way we are caching/using Hazelcast to reduce the get call on the map to a single call somehow.有没有更好的方法来做到这一点,或者我是否需要重新考虑我们缓存/使用 Hazelcast 以某种方式将地图上的 get 调用减少到单个调用的方式。

Few bits of additional info一些额外的信息

  • The total number of items in the map is ~35,000地图中的项目总数约为 35,000
  • The size of all items is ~350MB with each entry being ~10kb所有项目的大小约为 350MB,每个条目约为 10kb
  • I am running this embedded into the JVM in a Spring Boot application on my local machine我在本地机器上的 Spring Boot 应用程序中运行嵌入到 JVM 中的程序
  • The call on HazelcastInstance.getMap(mapName) is taking less than 1ms对 HazelcastInstance.getMap(mapName) 的调用耗时不到 1 毫秒

I guess it depends a lot on the exact setup, but from your question, it looks as you didn't try entrySet() .我想这在很大程度上取决于确切的设置,但是从您的问题来看,您似乎没有尝试过entrySet()

I believe that would be the fastest.我相信那会是最快的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从文件读取字符的最有效方法? - Most efficient way to read characters from a file? 将整个 map 转换/展平以列出的最有效方法(键和值一起,而不是单独) - Most efficient way to convert/flatten entire map to list (keys & values together , not separately) 在Hazelcast中存储地图地图的有效方法? - Efficient way to store a Map of Maps in Hazelcast? Java:将一个对象列表的属性映射到另一个对象的最有效方法 - Java: Most efficient way to map properties of one list of objects to another 从地图中查找前100个元素的最有效方法 - Most Efficient way to find top 100 elements from a Map 从GAE数据存储读取多对多对象的最有效方法 - Most efficient way to read many to many objects from GAE datastore 从列表中删除具有空属性的对象的最有效方法 - Most Efficient Way to Remove Objects With Null Attributes From a List 从 java 列表 object 创建 XML 的最有效方法 - Most Efficient way to create XML from java List object 对象从列表中删除自身的最有效方法 - Most efficient way for an object to remove itself from a list 在Java中填充Map的最有效方法 - Most efficient way to fill a Map in Java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM