7.3. Controlling data transfer
When a Morloc value crosses a pool boundary, the runtime picks one of three routes for data transfer:
-
Inline — for serialized payloads that are less than 64 KiB (by default), the bytes ride inside the packet over the Unix socket.
-
Shared memory — for larger payloads, the data sits in
/dev/shmand the packet carries only an 8-byte pointer. This allows zero-copy data transfer between pools on the same host. -
Temp file — only used when shared memory has been disabled (see
--no-shmbelow). The data is written to a.mpkfile and the packet carries the path.
Three morloc make flags let you override the default policy when it
is wrong for your workload — restricted containers, tight /dev/shm
quotas, debugging the wire-level traffic, or simply tuning the
threshold to a value that matches your data shape:
| Flag | Effect |
|---|---|
|
Move the inline/large threshold. Accepts a bare number or
|
|
Disable shared memory. Payloads above the inline threshold are written to a temp file and passed by path. |
|
Directory for the temp files produced under |
7.3.1. Combinations
| Build flags | Behavior |
|---|---|
(none) |
Inline |
|
Never inline; all cross-pool transfers go through shared memory. |
|
Inline |
|
Every cross-pool transfer is a temp file. Slowest mode, but works on systems with no shared memory at all. |
7.3.2. Examples
Build for a container with no usable /dev/shm:
$ morloc make --no-shm -o nexus main.loc
Run a workload where 64 KiB is too small (large records, every call exceeds the default):
$ morloc make --inline-size 1m -o nexus main.loc
Inspect the wire-level packets for debugging or testing:
$ morloc make --no-shm --inline-size 0 --tmpdir ./wire-dump -o nexus main.loc
$ ./nexus pipeline arg1 arg2
$ ls wire-dump/
morloc-pkt-12345-0.mpk morloc-pkt-12345-1.mpk ...
Each file is a self-contained MessagePack payload — one per pool
return. Because --tmpdir was supplied, they persist after the
program exits and can be inspected with any MessagePack reader.