This is was part of conversation with my colleague. We tried to solve a problem in our system, that our solution today doesn't solve it.
Our system is multi-threaded system developed in C++.we have couple of threads in the system, and each thread has his own state machine. Each thread communicate with other processes and changes his state accordingly. To manage the states for each thread it is a nightmare. We tried boost State Machine with boostio but it too complicate and we want KISS. So i thought maybe to take client side logic, which has also concurrency and states, and to modify it a little bit to fit the server logic. So Redux, yes!
let take for example a system which give a service of a conference calls. each customer can register to system and create a conference call and add other clients to his own call. each conference has different capabilities, and those are defined according to the client license. for example 4k bit rate for golden customer and 1K for silver. the system can manage only 50 concurrent conference calls, and in each conference you have 100 participants max. This is an example for my test case.
the challenges are:
- creating the thread pool for all the conferences
- each conference must manage a state machine to defined the conference state. for example: client send SIP register, 200OK etc. in addition, the conference object needs to communicate with the license server to get the client policy for the conference. this is Async operation (server send policy query, and wait for an answer).
- Async events handling: during a call we must have
this is the reason why I come to Redux. "Redux is a predictable state container for JavaScript apps...". yes I know everyone know what Redux is, and this is the reason why I want to adopt it to my solution:
- help to manage data flow
- state machine
- Async events
implementation aspect:
- Creating thread pool to manage all conferences
- Add observer pattern for the real time events (and also for the async responses for the requests to the license server)
- using dispatcher to manage the event Q for all the threads
btw, for messaging and ipc I use thrift and RabbitMQ
My questions are:
Do you think is it a good idea to take redux way to solve my problems? (server side problems)
Do you have any different solution?
Aucun commentaire:
Enregistrer un commentaire