wolf-null / resource-network-sim-v2

Simulating wealth distribution in logistic networks. Second version: more versatile
GNU General Public License v3.0
0 stars 0 forks source link

[Architecture]: Signal packaging? #2

Open wolf-null opened 3 years ago

wolf-null commented 3 years ago

Signal packaging?

Once one is in need of configuring ProcessHost or transfering dozens of signals from peer A to peer B for another reason, one will face a problem of signal routing overload. This can slow down all signal routing process and, if to run it in async mode, to wipe out other transactions.

In that case, one can propose signal packages: a series of signals from a single A to a single B to be wholly transferred.

There are two ways of packaging:

Since there are cases, it would be more flexible to allow nodes to implement or not to implement that feature.

At the moment, Node class doesn't implement any exec() routines.

One can implement all these, but this will ruin the standard since the developer doesn't know which method of serialization is passed to the node, there is an ambiguity that is fixed by code overlapping.

The core problem is that the sender node is not really supposed to know is the receiving node is ready to deserialize or not.

Host signal packaging

Essentially different way of packaging is to operate it at the host-host level, so signal serialization is hidden from a node. If there is a task to process input signals in a block there is no big deal: will the Host send n signals to the node OR if the Node will deserialize the package and process right the same amount of nodes as signals.

Deserialization is twice transparent for a Node (compared to previously proposed solutions): there is no need to complicate the Node class or anything else. Deserialized messages came to the destination straight consequently so it's also processed mostly simultaneous.

The serialization problem remains. And there is two solutions (both engages special SerializedSignal class):

[SOLUTION] But do we really need serialization?

The idea of serialization originates as the problem of adding multiple nodes to the remote host is arisen. This requires the transmission of lots of data messages (imagine transferring a large number of nodes).

But, for this particular case, why not transfer the whole database instead of transferring dozens of data signals?

Well, actually, this is the solution. One can push a big database update:

This decreases the number of messages sent down to the number of nodes spawned.

Maybe this is it...

Originally posted by @wolf-null in https://github.com/wolf-null/resource-network-sim-v2/issues/1#issuecomment-923957226