Skip to Content
Networks · Fundamentals

Client-server or producer-consumer: two communication models

Data communication models

The client-server model offers centralized, request-based communication. The producer-consumer model, decoupled, is event-driven. CAN relies on the latter, for decentralized, efficient and scalable communication.

Two complementary paradigms

The client-server model always describes a one-to-one relationship between a client and a server, even if several clients are possible. The producer-consumer model describes a one-to-many relationship between a producer and one or more consumers. All modern data communication concepts of industrial automation support both.

Sequence diagram of a confirmed service in the client-server model
Figure 1: sequence diagram of a confirmed service in the client-server model.

In this diagram, the vertical lines represent the local or remote layers of the OSI model at both participants, and the diagonal lines the transmission of protocol data units over the medium. A service request at level 7 could, for example, be the request to read a variable in a remote participant: the requested value is then returned to the client with the service confirmation.

Services in which a participant provides data to others unprompted, or following a one-time subscription — for example as a multicast or broadcast message — belong to the producer-consumer model. The services offered by the producer are made available to the other participants through a notification, which they may consume or ignore. Since the producer normally does not know the consumers, a service confirmation would make no sense. This is the model that describes the transmission of CAN messages.

Sequence diagram of a service request in the producer-consumer model
Figure 2: sequence diagram of a service request in the producer-consumer model.

Comparison

CriterionClient-serverProducer-consumer
Communication flowTriggered by the client's request, to which the server respondsTriggered by the production of data; the consumer waits for it to arrive
Scalability and flexibilityScalable by adding servers or sharing the load, but limited by the central nature of the serverHigh: producers and consumers can be scaled independently
Fault toleranceThe failure of the server affects the entire systemDecoupling limits the impact of the failure of a single element

Use in CAN networks

For basic communication, CAN relies on the producer-consumer model. This makes it possible to transmit messages efficiently between the ECUs or sensors of a vehicle without a central server. Each ECU can act both as producer and consumer of data, which allows flexible and decentralized communication. The data produced is sent to the bus without addressing a specific consumer; the other nodes listen and process what is relevant to them. This architecture reduces the complexity of the transmission and increases system reliability.

In summary

Where the client-server model offers a centralized, request-based structure, the producer-consumer model is characterized by its decoupling and its event-based transmission. In CAN systems, the latter fits perfectly with the decentralized and robust nature of the network.

Neutralized