Live upgrade #144
Replies: 5 comments 5 replies
-
https://libertyeagle.notion.site/Live-Upgrade-1137020489df416695e52944e95bf2db |
Beta Was this translation helpful? Give feedback.
-
In our initial version, we will not support live upgrade to shared resources between a group of engines, e.g., add new Commands between mrpc and RpcAdapter engines. In 2.0 version, this can be implemented in some way similar to the following: let local_states: HashMap<EngineId, Vec<Box<dyn Any + Send + Sync>>> = HashMap::new();
let shared_states: HashMap<String, Box<dyn Any + Send + Sync>> = HashMap::new();
// engine_groups is a group of inter-connected engines correspond to the same user thread
// e.g., mrpc engine and RpcAdapter
for engine in engine_group.topology_order() {
engine.dump(&mut local_state[engine_id], &mut shared_states);
}
for engine in engine_group.topology_order() {
// for shared states like Sender<mrpc::Command>, Receiver<mrpc;:Command>
// if mrpc::Command type has not changed, then mrpc and RpcAdapter engines directly re-attaches the Sender and Receiver from `shared_states`
// if the types has changed and the queue needs to upgrade, first we ensure the old queue is flushed before dumping engine states
// then mrpc engine creates Sender and Receiver, it attaches Sender to itself
// and update the Receiver in `shared_states`
// so when RpcAdapter is recreated, it can extract the Receiver from `shared_states`
reloadable_module.upgrade_from_old_engine(&mut local_state[engine_id], &mut shared_states);
} Live upgrade to the data path queues (i.e, |
Beta Was this translation helpful? Give feedback.
-
After the deadline, we can even try to support dynamic adding new modules with dynamiclly changing dependencies between engines. |
Beta Was this translation helpful? Give feedback.
-
Currently, pub fn create_engine(
runtime_manager: &RuntimeManager,
n: Node,
mode: SchedulingMode,
client_pid: Pid,
cmd_rx: tokio::sync::mpsc::UnboundedReceiver<ipc::mrpc::cmd::Command>,
cmd_tx: tokio::sync::mpsc::UnboundedSender<ipc::mrpc::cmd::Completion>,
) -> Result<RpcAdapterEngine> To support flexiable live upgrade, we may change the API to the following: pub fn handle_new_client(
&mut self,
n: Node,
mode: SchedulingMode,
client_pid: Pid,
shared_resources: HashMap<String, Box<dyn Any + Send + Sync>>
) -> Result<(Box<dyn Engine>, HashMap<EngineType, HashMap<String, Box<dyn Any + Send + Sync>>> Here The return is an engine (through a trait object), and shared resources created by this engine for downstream engines to use (we create engines in topological order). In the future, we may also implement |
Beta Was this translation helpful? Give feedback.
-
To have a higher level abstraction of message bus, we may not avoid dynamic dispatch. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
All reactions