简体   繁体   English

Hazelcast 的性能是否足以满足实时游戏的需求?

[英]Is Hazelcast Performant Enough for Real Time Game?

I have this concept of rewriting a game engine as a scalable collection of microservices.我有一个将游戏引擎重写为可扩展的微服务集合的概念。

It's currently a proof of concept but the main principle lies in each player having their session/connection held and managed by a single container, so containers will scale up and down based on the amount of connected users.它目前是一个概念证明,但主要原则在于每个玩家的会话/连接由单个容器持有和管理,因此容器将根据连接用户的数量进行扩展和缩减。

Each player container will speak to multiple other microservices to gather data and perform actions, these services will be static replica's of 2 or 3.每个播放器容器将与多个其他微服务对话以收集数据并执行操作,这些服务将是 2 或 3 的静态副本。

There is one microservice I have in mind which I feel is a bit of bottleneck which I'm currently looking for ways to make more 'scalable' and 'robust'.我想到了一个微服务,我觉得它有点瓶颈,我目前正在寻找提高“可扩展性”和“健壮性”的方法。

This microservice in question is the GameMap service.这个有问题的微服务是 GameMap 服务。 There will be multiple GameMap services (atleast one service for each uniqe or instanced gamemap).将有多个 GameMap 服务(每个唯一或实例化的游戏地图至少有一个服务)。 Each map will contain N number of cells and each cell can contain objects with different types / states for example (ie other playerObjects, ItemObjects)每个地图将包含 N 个单元格,并且每个单元格可以包含例如具有不同类型/状态的对象(即其他玩家对象、项目对象)

I would like to be able to have a replica of atleast 2 for each GameMap to instantly flip if one was to for some reason fail and shutdown.. it is important for the users to have a seamless transition between the failing and failover GameMap.我希望能够为每个 GameMap 拥有至少 2 个副本,以便在某个人因某种原因失败和关闭时立即翻转。对于用户而言,在失败和故障转移 GameMap 之间进行无缝转换非常重要。 To achieve that I need to have consistent / up to date state shared between them.为了实现这一点,我需要在它们之间共享一致/最新的状态。

The need to be able to load balance traffic between the two replica's is a nice to have but not essential.能够在两个副本之间对流量进行负载平衡的需求是很好的,但不是必需的。

So far the one potential solution I have come is hazelcast.到目前为止,我提出的一个潜在解决方案是榛子铸造。 This will allow me to keep the state of each map cell in a scalable memory data grid (again for robustness and scalability).这将允许我将每个地图单元的状态保存在可扩展的内存数据网格中(同样是为了稳健性和可扩展性)。

I expect that there may be up to 100s of state changes within a gamemap every second and my concern is that it may be too slow and cause huge latency between users.我预计游戏地图中每秒可能会有多达 100 次的状态变化,我担心它可能太慢并导致用户之间的巨大延迟。

Has anyone got any hints, suggestions or feedback based on the both scenario or more importantly the usecase of hazelcast here?有没有人根据这两种情况或更重要的是这里的 hazelcast 用例得到任何提示、建议或反馈?

PS i can upload my very crude connectivity/architect diagram of my game engine as micro services at some point if it helps or if anyone is interested. PS,如果有帮助或有人感兴趣,我可以在某个时候将我的游戏引擎的非常粗糙的连接/架构图上传为微服务。

It really depends on your requirements, environment etc.这实际上取决于您的要求,环境等。

Especially if you want to be HA, you probably want to replicate to different availability zones or potentially different regions and you will be bound by the speed of light (or need to accept there is a chance for data loss).特别是如果你想成为 HA,你可能想复制到不同的可用区或潜在的不同区域,你将受到光速的约束(或者需要接受数据丢失的可能性)。 So in other words;换句话说; the performance is mostly determined by the infrastructure.性能主要由基础设施决定。

But just to give you some ballpark numbers;但只是给你一些大概的数字; for a simple read on c5.9xlarge instances on EC between machines in the same low latency group you are looking at 100/200 us.对于同一低延迟组中的机器之间的 EC 上的 c5.9xlarge 实例的简单读取,您正在查看 100/200 us。 And running a hundreds of thousands of gets second per instance is normally not an issue.每个实例运行数十万次获取通常不是问题。

In other words;换句话说; it is very difficult to say if this is the right approach.很难说这是否是正确的做法。 Depending on your situation and how important this is, I would take a single slice of your whole system and make some benchmarks to get an impression how well it performs and how well it scales.根据您的情况以及这有多重要,我会取您整个系统的一个切片并进行一些基准测试,以了解它的性能和扩展性如何。

But my alarm-bells are going of when I see the combination of micro-service with 'real time' and 'game engine'.但是当我看到微服务与“实时”和“游戏引擎”的结合时,我的警钟就响了。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM