# What mathmatical model shall be used for describing P2P processes interaction?

I am creating a distributed service system. It runs in the cloud on heterogeneous hardware. I am using C# .NET for business logic and C++ for different physics\chemical calculations. Having three logic applications and 2xN heavy calculation applications. There are external web clients, which connect to logic applications, but for now, we do not care for them. Therefore, server side connected applications:

• They interact via heavily extended proprietary ZeroMQ analog middleware - so there is a finite set of communication patterns between applications.
• There is a protocol (Protobuf based) via which applications encode messages. Different types of messages are sent on same communication channels (for example 10 types of requests with 10 types of responses for each Request-Reply channel)

I wonder if there is a mathematical model in terms of which I can describe my Peer to peer services system. Of course, I need a model that can be useful: one that after its creation I would be capable to gain some new knowledge about properties of my distributed application.

I looked at a few

• Petri networks and they can provide reachability, liveness
• Queueing theory, which generally seems to lead to Stochastic Petri Nets

After few days of research, my small brain collapsed because I need a Colored Hierarchical Stochastic Petri Net and all I would get from it would be reachability and liveness of components and connections may be also maximal/normal messages passing volumes.

To create such model timing, message type’s interaction and publishing stats would be required as well as directions of message streams. Computational logic can stay as a black box.

So I wonder - is there any other mathematical model which could provide more data on system behavior in terms of prediction/reasoning, what data it would require?

• I'm pretty sure there are formal models for distributed agents that send each other messages.
– Raphael
Dec 16, 2014 at 23:10

## 1 Answer

If you're looking for a single model that describes all relevant aspects of your system, you'll have a hard time. And building the model will take as much effort as implementing the system itself, if not more. Therefore, break the system down into different aspects, and consider different modelling techniques for each. Examples for aspects might be:

• The protocol between two of the peers. This could detect deadlocks or pointless messages in the protocol. Repeat for every combination of two types of peers.
• Behavior of a single peer as it connects with different types of peers. Could there be problems if a message from peer type X comes in while processing another message from peer type Y?
• Behavior of the network as peers come and go. Will it stay connected? Here, you'd just model "peer connects" and "peer disconnects", rather than the sequence of messages for connecting and disconnecting.
• Performance depending on the number of peers of each type.
• ...
• I know it's an old question, but the problem of trying to put too much into a single model will remain for eternity :-) May 5, 2019 at 6:57