Updated Architecture: Cluster Multi Process (markdown)

TJKoury 2016-10-25 11:01:25 -04:00
parent 7762d4ddf5
commit d1ff38853c
1 changed files with 1 additions and 0 deletions

@ -23,6 +23,7 @@ Communication from the Worker processes to the Master is handled via IPC.
|red/runtime/storage/localfilesystem.js|Modified to only allow Master to log.|
|settings.js|Modified to expose the cluster module in function nodes, also provides the default setting for number of Workers.|
##Issues
- [ ] **Clustering Admin Interface**. To make it practical to keep the default behavior of using the admin httpServer as the primary interface for http / websocket nodes, the entire admin interface must be used in cluster mode. Running a server on the master process restricts the amount of data that can be serialized/deserialized in IPC as multiple workers are handling the requests that originate and end in the master process. **However**, running the admin interface in worker threads also poses it's own problems. As any worker process might be the one that a web client connects to, all messages headed to the browser must be serialized and sent to all workers. This will cause a massive increase (n * workers -1) in the amount of data handled to inform the admin interface, from node registry events to node status events, debugging, etc.
- [ ] **Modified nodes**. As nodes are capable of binding ports, listening to file-system events, spawning other processes, etc., simply clustering by forking can lead to serious issues. There appear to be two options: modifying the nodes to play nice, or build in strict limitations on what nodes can do.
- [ ] **Config node capabilities**. Currently, config nodes (and certain nodes like TCP) are allowed to bind ports, meaning that if flows are loaded equally in the Master and child processes, the Master process will listen on that port, and then block the port from being [bound specifically to distribute incoming to Workers](https://github.com/nodejs/node/blob/master/lib/cluster.js#L116). Some nodes might be run only in the Master (inject) and [serve events to Workers based on a round-robin](https://github.com/TJKoury/node-red/blob/cluster/clusterRED.js#L88). Limiting config nodes to run only on Worker processes, then moving any code that could cause issues into a config node, could be a standardization solution to this issue.