带有客户端服务器的Hazelcast中的性能问题

问题描述 投票:0回答:1

我在将hazelcast配置为客户端服务器时遇到性能问题。我有一个由5个节点和1个主节点组成的K8S群集。每个节点具有64 GB的RAM和16核(Hazelcast版本3.12.4)Hazelcast服务器部署在K8S上,集群中可用节点之一上有一个POD我的客户端部署在通过智能客户端连接到以上Hazelcast的K8S上(为K8S启用了Hazelcast发现)。我的应用程序总共有10个POD,每个节点由我的应用程序的2个POD组成。

我正在运行不同的API,并对我的应用程序执行负载测试(所有10个POD一次共享大约110个线程)

我在应用程序中具有以下代码来获取缓存。

public Map<Object, Object> get(String cacheId, Long lTenantId) {
     String strMethodName="get";
     long t1 = System.currentTimeMillis();
     Map<Object,Object> cacheDataMap=hazelcastInstance.getMap(cacheId);
     long totalTimeTaken = (System.currentTimeMillis()-t1);
     if(totalTimeTaken > 10){
         logger.warnLog(CLASSNAME, strMethodName,"Total time taken by "+cacheId+" identifier for get operation is : "+totalTimeTaken+" ms");
      }
      return cacheDataMap;
}

我的应用程序使用此地图的方式有所不同

1)

map.get(key);

2)

Set keys = map.keySet();
   Iterator iterator = keys.iterator(); //I changed to keyset iterator because entryset was causing lot of performance issues
   while (iterator.hasNext()) {
      // doing stuff
   }

当启动所有我的API进行加载时,我正在将这些日志打印在应用程序中(花费的总时间...。),其中每个缓存访问时间都> 10毫秒,这会导致性能问题,因此我无法为所有API达到我期望的TPS。

大约有300张地图存储在缓存中,缓存的总大小为4.22 MB

我正在使用近乎高速缓存的配置,并且在管理中心上它的有效性也显示为100%。 (这是在启用hazelcast.client.statistics.enabled时采取的。)

我还尝试了在Hazelcast服务器的4个节点和1个专用节点上部署8个POD,但是问题仍然相同。当我以嵌入式方式连接Hazelcast时,没有发现任何问题,并且能够为所有API实现所需的TPS。

我是否缺少引起此问题的任何配置或其他任何东西?

这是我的hazelcast-client.xml

<hazelcast-client
xmlns="http://www.hazelcast.com/schema/client-config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/client-config
                  http://hazelcast.com/schema/client-config/hazelcast-client-config-3.11.xsd">

<group>
<name>dev</name>
</group>
<instance-name>hazelcast</instance-name>
<properties>
<property name="hazelcast.client.shuffle.member.list">true</property>
<property name="hazelcast.client.heartbeat.timeout">600000</property>
<property name="hazelcast.client.heartbeat.interval">180000</property>
<property name="hazelcast.client.event.queue.capacity">1000000</property>
<property name="hazelcast.client.invocation.timeout.seconds">120</property>
<property name="hazelcast.client.statistics.enabled">false</property>
<property name="hazelcast.discovery.enabled">true</property>
<property name="hazelcast.map.invalidation.batch.enabled">false</property>
</properties>

<network>
<discovery-strategies>
<discovery-strategy enabled="true"
class="com.hazelcast.kubernetes.HazelcastKubernetesDiscoveryStrategy">
<properties>
<property name="service-name"><service-name></property>
<property name="namespace"><namespace></property>
</properties>
</discovery-strategy>
</discovery-strategies>
<smart-routing>true</smart-routing>
<redo-operation>true</redo-operation>
<connection-timeout>90000</connection-timeout>
<connection-attempt-period>100</connection-attempt-period>
<connection-attempt-limit>0</connection-attempt-limit>

</network>

<near-cache name="default">
                <in-memory-format>OBJECT</in-memory-format>
                <serialize-keys>true</serialize-keys>
                <invalidate-on-change>true</invalidate-on-change>
                <eviction eviction-policy="NONE" max-size-policy="ENTRY_COUNT"/>
        </near-cache>
</hazelcast-client>

这是我的hazelcast.xml

<?xml version="1.0" encoding="UTF-8"?>

<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.11.xsd"
           xmlns="http://www.hazelcast.com/schema/config"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <management-center enabled="${hazelcast.mancenter.enabled}">${hazelcast.mancenter.url}</management-center>

</hazelcast>

我在将hazelcast配置为客户端服务器时遇到性能问题。我有一个由5个节点和1个主节点组成的K8S群集。每个节点具有64 GB的RAM和16核(Hazelcast版本3。...

java performance kubernetes hazelcast hazelcast-imap
1个回答
0
投票

缓存的目标是尽可能快地从键中获取值。通常,您已经有了密钥,并要求提供值。这意味着您将请求发送到任何节点,这将在分区表中查找键所属的分区,并将查询转发到相关节点。

© www.soinside.com 2019 - 2024. All rights reserved.