English 中文(简体)
Sequential vs multi-threaded Accounting Events Processing
原标题:

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?

问题回答

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

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.

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





相关问题
SQL Server - How many users do I *really* need?

I m setting up an application, and I m looking into purchasing a license for SQL Server. My question is pretty simple (though may have a complicated answer...) How many users accounts do I really ...

Object Graph / Persistence Question

I m currently working with an online application that requires multiple screens/steps in order to complete. The application domain is modeled using an object graph. Persistence to and from a database ...

Why does stack get truncated in Exception.StackTrace?

Why does the high part of the stack (in Exception.StackTrace) gets truncated? Let s see a simple example: public void ExternalMethod() { InternalMethod(); } public void InternalMethod() { try ...

ASP.NET MVC and Service Oriented Architecture

I would like to know how do i incorporate a feature like wcf within and MVC application. My current idea of the architecture is as follows: EntityFramework -> ASP.NET MVC (Views) ...

热门标签