For a system, I have certain requirements
- should be soft realtime.
- should be able to handle lots of operations in parallel
- should have ability to add, remove, alter features
- should be able to increase/decrease memory, computation based on load
So I have implemented an app design based on microkernel architecture with a mediator bus pattern. Here is the design
Design Philosphy:
- Worker is any piece of code, running on a dedicated thread.
- Each worker has exactly one message box
- System worker has only one copy, starts/stops with the system only
- User worker can be created/ destroyed or multiple copies can run.
- Workers cannot share anything
- Workers can only communicate through immutable messages
Kernel
Can starts or stops a processes.
Allocates message boxes
can run multiple copies of user workers
Router
Can only move messages from one message box to another.
Undelivered messages are delivered to dead letter collector.
Dead Letter Collector
Messages which have no receiver are received and dumped
Messages undelivered because of no space in target message box are kept and retried after a certain interval 3 times at least.
Features can be built as workers and can be loaded and unloaded without modifying the source code at run time. (similar to plug-ins). If there is load on a certain feature then kernel can load multiple copies of that feature. In case of feature not available, the system does not crash but the messages are considered undelivered. new features can be added, existing ones can be removed or altered.
A feature can be an API, a database functionality, a computation etc. and a feature can be dependent of other features too.
Based on the requirements and the proposed design what are your views and what can we improve upon?