How to design credit control application?

Tomasz Pastuch tomasz.pastuch@REDACTED
Tue Sep 7 13:28:07 CEST 2010


Dear all,

I’m quite new in erlang language, but I’m fall in love with it after reading Joe’s book.
Now I’m trying to create a prototype of application just to see if erlang is suitable for our purpose. Let’s imagine an telco application for soft real-time credit control. From a stack (i.e. diameter, radius) we receive the information;
-	open a session for user
-	reserve money/debit money from "balance"
-	close session for user

The sessions can last for hours, but every 2minutes we have another request. Each credit control request reserves new money and debit the money from the previous (2m ago) reservation. Each user can have many concurrent sessions (>1000).  The total number of concurrent session will be max 300K.

I’m thinking about designing such system in erlang. We want to have fully redundant system - we cannot loose customer balances.

From the beginning I was thinking to model that situation using :
- customer session -> spawn many erlang process at each open session, use mnesia replicated 
  table for storing reserved amount for each session
- customer balances -> use mnesia replicated table

The problems I have encountered:

1. Mnesia transactions cannot spread over two tables, so I can loose the reserve transaction (If the node fails after decreasing the value from balances and begin storing new reservation record). If I store the reservation inside the balance record, then probably I have problems with many (> 1000) concurrent sessions for each balance (the record will be simply big and the operations of updating the balance can be slower). 

2. If we use processes for modeling user sessions then how to replicate those processes to the replica ? Maybe the better solution is to insert only a record into mnesia for each session, but how then I can process those sessions parallel (when the new request came)?

I’m probably not the first person who is going to create such application – could you advise me how I should design the system in Erlang ? I appreciate for any help.

Best regards


---------------------------------------------
Volskwagen, Audi, BMW, bezpośrednio z Niemiec!
http://linkint.pl/f27f7



More information about the erlang-questions mailing list