Distributed system using only C

I have work on the implementation of a distributed system of nodes (for example, p2p nodes), each of these nodes (allows A, B, C and D) to perform certain functions and must interact with each other for various operations, such as synchronizing operations and other things , such as 15 nodes, interact with a group of 5 nodes B to get into the least loaded node queue and get the token number, and then expect C to redirect them to free node D, etc.

I lost a bit, how can I go about design:

  • The protocol I was thinking about is encapsulating a structure such as an operation and other things to send. In addition, this is done using a confirmation scheme, so I can be sure that the other party has received the message.

  • How to move to the distributed aspect of mutual exclusion, since I do not have a central server. I assume that each node replicates the data, but it sounds too expensive (not to mention stupid).

  • What is the main design methodology used in the implementation of p2p systems, that is, how can I implement the program in such a way that it is blocked upon receipt, but can also send additional updates, etc., and at the same time receive information from others about the "state" the whole system.

  • How to provide the general order of requests

Also, what are the other issues that I might need to view / face. I would also appreciate if you could point me to some good online resources for implementing p2p and distributed systems.

Thanks!!

+1
source share
3 answers

I will not try to give a β€œcomplete” answer (because the question is too big and vague anyway), but I could point you to an interesting part of the puzzle:

  • You can use a message queuing system (for example, AMQP RabbitMQ : there is experimental C-binding) to implement reliable message delivery between your nodes.

  • Mutual exception: you can use a protocol like Paxos

+1
source

The secret to preventing blocking is that your endpoints must be recorded as servers with threads for processing the "protocol" that are separate from threads for processing data.

Regarding the linear protocol, I became in love with JSON for the linear protocol. It is read by man. It is thread safe without length bytes! It is easily extensible and largely immune to protocol version changes.

+1
source

Another useful software might be KadC!

http://kadc.sourceforge.net

-1
source

Source: https://habr.com/ru/post/924231/


All Articles