Hazelcast-在客户端/服务器模式下为多个应用程序提供服务的最佳群集拓扑是什么? [英] Hazelcast - What is the best cluster topology to serve multiple applications in client/server mode?

查看:342
本文介绍了Hazelcast-在客户端/服务器模式下为多个应用程序提供服务的最佳群集拓扑是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几乎我们所有的应用程序都在嵌入式拓扑中使用Hazelcast集群。
由于应用程序的高负载,我们有时会遇到内存和cpu问题。因此,我们计划将拓扑从嵌入式模式更改为客户端/服务器模式。

Almost all of our applications are using Hazelcast cluster in embedded topology. Due to high load on the applications, we are occasionally having memory and cpu problems. Because of this we are planning to change our topology from embedded to client/server mode.

问题是,是否应该为每个应用程序设置一个新集群?还是应该由一个群集为所有客户端应用程序服务?

The question is, should we set up a new cluster for each application? Or should a single cluster serve all the client applications?

我知道可以在jvm中启动多个hazelcast实例( http://docs.hazelcast.org/docs/3.5/manual/html/createclustergroups.html )。

I know that multiple hazelcast instances can be started in jvm (http://docs.hazelcast.org/docs/3.5/manual/html/createclustergroups.html). Could this also be an option for production?

推荐答案

让我们根据用例进行分析。

Let's analyze based on the use-cases.


  • UseCase-1: Hazelcast群集主要用作分布式缓存。在这种情况下,您可以仅保留一个公共群集,并且所有应用程序都可以维护 HazelcastClient 来访问该群集。

  • UseCase-2: Hazelcast集群既被用作分布式缓存,又被执行者用作分布式计算目的。在这种情况下,您需要使用执行程序池分析将要存储在集群中的数据量以及将要运行的计算类型。在多个服务器之间分配节点时,还必须考虑CPU /核的数量。

  • UseCase-1: The Hazelcast cluster is mainly used as a Distributed cache. In this case, you can simply keep a common cluster and all the applications can maintain HazelcastClient to access the cluster.
  • UseCase-2: The Hazelcast cluster is being used both as a Distributed Cache as well as Distributed Computing purpose using executors. In this case, you need to analyze the amount of data that you will be storing in the cluster and the type of calculations that you will be running using executor pool. You will have to take the number of CPU/Cores also into consideration while allocating the nodes across multiple servers.

最佳做法


  • HazelcastClient 对象保留为单例,以便该连接将为每个请求重用,而不是创建多个客户端连接,从而增加了可能影响性能的网络开销。

  • Keep the HazelcastClient objects as singleton so that the connection would be reused for each requests instead of creating multiple client connections adding network overhead which can impact the performance.

使用 NearCache 功能(如果适用),用于将频繁访问的数据缓存在客户端本身,而不是每次调用都进行集群访问。

Utilize the NearCache feature wherever applicable, to cache the frequently accessed data at the client side itself instead of making a trip to the cluster for each call.

最好在自己的JVM中启动每个节点,而不是在单个JVM中运行多个节点。父JVM中任何无法预料的问题都将导致所有节点崩溃。

It's better to start each node in their own JVMs instead of running multiple nodes inside a single JVM. Any unforeseen issue in parent JVM will lead to crashing of all the nodes.

这篇关于Hazelcast-在客户端/服务器模式下为多个应用程序提供服务的最佳群集拓扑是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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