微服务架构,用于频繁访问数据;在内存解决方案中? [英] Microservices Architecture for highly frequent data access; in memory solutions?

查看:226
本文介绍了微服务架构,用于频繁访问数据;在内存解决方案中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们定义以下用例:

  • 必须完成一个模拟任务,其中涉及[ day1,day2,...,dayN ]上的迭代/模拟.迭代的每个步骤都取决于先前的步骤,因此顺序是预先定义的.
  • 该任务的状态由 Object1 表示,该对象将在迭代的每个步骤中进行更改.
  • 迭代步骤涉及2个不同的任务: Task1 Task2 .
  • 要完成 Task1 ,需要来自 Database1 的数据.
  • 要完成 Task2 ,还需要来自其他数据库(即 Database2 )的外部数据.
  • 任务1 完成后,需要应用任务2 .
  • Task1 Task2 也需要访问 Object1
  • 完成两项任务后, Object1 的状态将更改,并且一个迭代步骤已完成.

此迭代/模拟任务平均涉及 10,000个迭代步骤.平均而言,平均需要 100个迭代/仿真任务,同时由多个最终用户启动.

现在,由于生产中应用程序所需的可扩展性,我们将针对该问题讨论微服务架构.同样出于开发目的,这也至关重要,因为Task1和Task2是最近添加的新功能/参数,并且在开发中具有不同的缩放比例.

因此,为避免出现网络瓶颈,其中涉及常数 每次迭代中的数据库访问以及之间的发送数据 Task1和Task2,什么样的系统架构才适合 这个问题吗?

对于Task1,至少应有两种不同的服务 Task2甚至可能针对实际的迭代/仿真状态之一 控制?有人可以告诉我们更多有关使用 内存数据网格解决方案,例如 hazlecast 或仅在内存中 像 redis 这样的数据库来解决此问题?

这里的主要问题是微服务的参数是什么 架构可能是由于通信/网络瓶颈?这 加快速度的唯一方法是产生所有需要的数据 将模拟任务存储在内存中并始终保持在该位置,以避免 网络瓶颈?

感谢您的回答和宝贵的意见.

(此问题与服务间通信无关,例如消息传递或REST http(发布/订阅或req/resp),两者都可能为该任务施加很大的网络负载.)

解决方案

现在,由于在生产中需要应用程序的可伸缩性,因此我们将讨论用于该问题的微服务体系结构.出于开发目的,这也至关重要,因为最近已向Task1和Task2添加了新功能/参数,并且在开发中具有不同的缩放比例.

这正是流处理平台所擅长的.我建议使用类似 Apache Kafka 解决方案

Now we discuss a microservice architecture for the problem, due to the needed scalability of the application in production. Also for development purpose this is crucial, because Task1 and Task2 are recently added new features/parameters and scale differently in development.

This is exactly what a stream processing platform is doing good. I recommend to use a system like Apache Kafka or Apache Pulsar for this problem.

Should there be at least two different services for Task1 and Task2 and maybe even one for the actual iteration/simulation state control?

Task1 and Task2 is what is called stream processors, they read (subscribe to) one topic, doing some operations/transformations and write (publishes) to another topic.

The main question here is what are the arguments for a microservice architecture due to probably communication/network bottleneck? The only way to speed this up is to spawn all needed data for the simulation task in memory and keep it there the whole time, to avoid the network bottleneck?

Again, this is exactly the problem that a system like Apache Kafka or Apache Pulsar is doing good. To scale writes and reads in a stream processing system, you can partition your topics.

这篇关于微服务架构,用于频繁访问数据;在内存解决方案中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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