Skip to content

[Discussion] Design of dsock and future libdill #5

@raedwulf

Description

@raedwulf

Hello Martin!

I'm back from my holiday, so I have time (lots of time) to work on libmill/dill related stuff.

While thinking about the layering and composability of protocols, I sketched out some tables which I think would be useful to keep in mind for API design.

dsock/dplumbling? API

Pipeline Object

The API will orient itself around a new object called pipeline. These pipeline objects represent a series of composed protocols that represent the end-to-end communication for a server and client.

Based on the OSI model, we have up to 4 different layers in the pipeline. For example:

Layer 4 Layer 5 Layer 6 Layer 7
TCP/IP TCP/IP - HTTP1.1
TCP/IP TCP/IP TLS HTTP2
UDP DCCP over UDP DTLS Custom App

This is the basic form. All layers are optional; see Multiplexing.
Layer 7 is a special case. The structure for `pipeline' can have more than one layer 7 for horizontal composability (protocol switches). For example, the old switching between HTTP1.1 to HTTP2.

Micro-protocol API

Layer 4, Layer 5, and Layer 6 protocols, when composed, have a similar API. Layer 6 dictates what the exact API that Layer 7 has to implement is and will be of one of two forms:

Connection-based

Protocol Functions
Server / Client
Establish listen / connect
Send send
Receive recv
Disestablish close

Connection-less

Protocol Functions
Server / Client
Bind listen / not applicable
Send send
Receive recv
Unbind close / not applicable

Capabilities of Micro-Protocols

Each micro-protocol will require a number of capabilities from the previous protocol in the pipeline and exhibit a set of new capabilities for the next protocol in the pipeline. A protocol may change some of the capabilities e.g. Conn-less to Conn-based, Stream to Datagram, Unreliable to Reliable.

Type Conn-less Conn-based Datagram Stream Reliable Domain Endpoint
Unix IPC Slp+
Pipes IPC Sl
UDP Net IP Slp+
TCP/IP Net IP Slp+
Mq IPC Slp+
Shm * * * * * IPC *

The endpoint field refers to the type of endpoint i.e. what can it implement/provide:

  • Slp: Supports multicast with one of blocking or unreliability or multiplexing.
  • Sl: Multiple producers and multiple consumers can be implemented.
  • +: Sharing only involves parent and its children processes. Unrelated processes cannot share this endpoint.

IPCs don't really fit into connection or non-connection based paradigm. There is an address which multiple writers/produces can write to. This is what I mean that they are connection-less. However, it is reasonably trivial to implement a connection-based system over these IPC primitives as well.

Shm - Shared Memory

Custom shared memory implementations for cycle squeezing. It can, in theory, implement all the other protocols in varying degrees. Some implementations are available here. Some results are here.

One benefit of using shared memory is that multicasting can be implemented with very low overhead to other processes.

Multiplexing and IP/IPC conversion

As a special Layer 5/6/7 protocol, multiplexed protocols can be mux'd or demux'd and connected to other pipeline objects. This allows composing across Net IP and IPC protocols.

TODO

I'll update this document as discussion follows. This isn't complete... needed lunch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions