顺序与多线程会计事件处理

发布于 2024-10-09 17:21:25 字数 177 浏览 4 评论 0原文

我们正在开发一个事件驱动的会计引擎,到目前为止,我们正在以批量/顺序的方式做所有事情。

问题是每天会创建数千个事件,并且按顺序处理所有事件会导致速度变慢。

有没有一种安全的方法可以实现多线程事件处理会计引擎,而不必担心财务数据的完整性和一致性?

还是为了安全起见并允许遵循批量/顺序方法更好?

We are working on an event-driven accounting engine and so far we are doing everything in a batch/sequential manner.

Problem is there are thousands of events created per day and processing everything sequentially makes it slow.

Is there a safe way we can implement a multi-thread event processing accounting engine without worrying about financial data integrity and consistency?

Or is it just better to play it safe and allows follow a batch/sequential approach?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

简单 2024-10-16 17:21:25

也许您可能想研究软件事务内存模型。这个概念已在这篇论文

Perhaps you might want to look into software transactional memory model. The concept has been discussed in this paper

溇涏 2024-10-16 17:21:25

您已经成功构建了一个满足您的财务数据完整性和一致性要求的会计引擎。这样,并行处理应该是可行的。

您将需要

  • 一个新的调度程序组件,负责向多个线程提供待处理的事件数据,同时保持一致性(即对每个事件只计费一次),以及
  • 一个新的聚合器组件,用于混合帐户上的额定事件。

通常,聚合器组件将成为并行架构中的瓶颈。

由于您明确打算构建多线程应用程序:根据需求和环境,构建多进程设计可能是可行的,即让多个独立进程并行运行。与进程间通信的实际需求相比,您将获得更简单的并发模型。

几乎所有电信计费系统都通过多线程或多处理进行扩展,因此这绝对是一个明智的前进方向。

You already have managed building an accounting engine satisfying your financial data integrity and consistency requirements. With this, it should be feasible to parallelize processing.

You would need

  • a new dispatcher component which would be responsible for feeding multiple threads with to-be-processed event data while maintaining consistency (i.e. bill each event exactly once) and
  • a new aggregator component for muxing the rated events on the accounts.

Typically the aggregator component will become the bottleneck in your parallel architecture.

Since you explicitly intend to build a multi-thread application: Depending on requirements and environment it might be feasible to build a multi-process design, i.e. have several independent processes running in parallel. You would gain a simpler concurrency model versus the evemtual need for interprocess communication.

Virtually all telecom billing systems scale by multi-threading or multi-processing so this is definitelly a sane way forward.

谜兔 2024-10-16 17:21:25

如果您遵循规则,您可以使用多个并发事务

查看
en.wikipedia.org/wiki/Atomicity_(database_systems)
en.wikipedia.org/wiki/ACID
en.wikipedia.org/wiki/Record_locking

或阅读本节中的所有相关文章
http://en.wikipedia.org/wiki/Category:Transaction_processing

具有正确的级别锁定你正在做的事情

You can use multiple concurrent transactions if you follow the rules

check out
en.wikipedia.org/wiki/Atomicity_(database_systems)
en.wikipedia.org/wiki/ACID
en.wikipedia.org/wiki/Record_locking

or read all relevant articles in this section
http://en.wikipedia.org/wiki/Category:Transaction_processing

with the correct level of locking for what you are doing

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文