7  Latency, reliability and performance

FxmeNet trades latency for reliability. This chapter explains the two settings that control the trade, how to read what happens, and how to tune the machines.

7.1  Block size N and network budget D
7.2  Choosing the settings
7.3  Measured performance
7.4  Making the server reliable (Linux)
7.5  Making the client reliable

7.1  Block size N and network budget D

The plugin sends the audio to the server in blocks of N samples and gives each reply D blocks of time to come back. Both are in the Settings tab.

Block size N

32 to 1024 samples. A small block means less latency but more packets per second and tighter deadlines for the server and the network.

Network budget D

1 to 8 blocks. A larger budget survives a slower network or a busier server, at the price of more latency.

The latency that FxmeNet reports to the DAW is roughly N times D samples plus the DAW’s own block size, plus the latency of the chain’s plugins. The Settings tab shows the exact figure for your settings, in samples and milliseconds, split between the network and re-blocking part and the chain itself. The DAW compensates for all of it, so the track stays in time; what changes is how late a played instrument is heard, which matters when you record through the plugin.

If a reply is not back in time, that block is concealed: a short fade to silence (64 samples) and back, so that there is no click, only a very brief dip. Concealed blocks are counted on the bottom line of the window.

The default is N = 128 and D = 2 (5.8 ms of budget at 44.1 kHz).

7.2  Choosing the settings

Situation

Suggested settings

Mixing, many heavy tracks

1024×2 or 512×2: the most robust. Latency is no concern while mixing.

Recording through the plugin, light chain

128×2, or 64×2 if the server has a lot of spare CPU.

A server near full load

Larger blocks. A busy server sometimes stalls for 20 to 50 ms, which small blocks cannot absorb.

Network with other traffic or Wi-Fi

Raise D, or move to a wired connection.

Tip.  Test with the DAW’s own settings in mind: the DAW’s audio buffer adds to FxmeNet’s latency. Using a large buffer in the DAW for mixing and a small one for recording is common practice, and works the same here.

7.3  Measured performance

These figures come from the first stress tests (details in the project’s doc/Tests folder), on old machines: a 2015 Intel Core i7-6700K for the client (Windows, Reaper, an RME ASIO interface at 44.1 kHz and a buffer of 128) and a 2018 AMD Ryzen 5 PRO 2400G for the server (Ubuntu 24.04, four cores). Every track had one FxmeNet instance, and the “full chain” holds all 17 plugins of the FxmeFX collection (FX-Mechanics’ effects).

Tracks

Chain

N×D

Result

24 local

full

(local)

75 % of the client’s CPU.

24 remote

full

256×2

Client at 25 %, server at about 66 %, about 10 concealed blocks in 5 minutes on one track.

24 remote

full

1024×2

Client under 20 %, almost no concealed blocks.

28 remote

full

1024×2

Server above 75 %: no concealed blocks, or very rare ones. Very usable.

32 remote

one equaliser

128×2

Network at 95 Mbit/s each way, no problem.

What these tests show:

7.4  Making the server reliable (Linux)

A generic Linux system works. These are the usual steps for audio on Linux; try them one at a time and check after each whether the concealed count goes down. More testing will be done. Feedback is welcome on the performance you get on other systems and with other optimizations.

1.
Real-time priority for the audio threads. Check with
ps -eLo tid,cls,rtprio,pcpu,comm | grep -i fxme

while a session is open: the audio threads should be in class RR or FF. If they are TS, the system refused real-time priority (the server’s log says so). Create /etc/security/limits.d/audio.conf:

@audio - rtprio 95 
@audio - memlock unlimited

Add the account that runs the server to the audio group, and log in again (or restart the service).

2.
Bigger socket buffers. Under heavy load the kernel can drop replies when the send buffer is full (the server’s log counts them as send errors; nstat -az UdpSndbufErrors shows the system-wide count). Raise the limits, then restart the server:
sudo sysctl -w net.core.rmem_default=4194304 net.core.rmem_max=8388608 
sudo sysctl -w net.core.wmem_default=4194304 net.core.wmem_max=8388608

To keep them after a reboot, put the four lines (without sudo sysctl -w) in /etc/sysctl.d/90-fxmenet.conf.

3.
CPU frequency. Set the governor to performance:
sudo cpupower frequency-set -g performance
4.
Kernel. A low-latency or fully preemptible kernel (linux-lowlatency, or booting with preempt=full) helps the worst cases.

[TODO: When the server asks for large socket buffers itself (todo item 21), step 2 becomes: “the log tells you if the system limits are too low”.]

7.5  Making the client reliable