Building Jack for JackTrip Studio Servers

JackTrip uses version 2 of the Jack Audio Connection Kit (jackdmp). With a few patches described in this article, we've been able to run synthetic scale tests of up to 500 stereo clients using a single 96 vCPU server. This page documents how we build Jack for our servers.

First, clone the jack2 repository:

git clone https://github.com/jackaudio/jack2.git
cd jack2
git checkout v1.9.19

Next, apply this patch to increase limits:

diff --git a/common/JackConstants.h b/common/JackConstants.h
index 0cf62ebc..7f9525f6 100644
--- a/common/JackConstants.h
+++ b/common/JackConstants.h
@@ -44,11 +44,11 @@
#define REAL_JACK_PORT_NAME_SIZE JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE // full name like "client_name:short_port_name"

#ifndef PORT_NUM
-#define PORT_NUM 2048
+#define PORT_NUM 8192
#endif

#ifndef PORT_NUM_MAX
-#define PORT_NUM_MAX 4096 // The "max" value for ports used in connection manager, although port number in graph manager is dynamic
+#define PORT_NUM_MAX 8192 // The "max" value for ports used in connection manager, although port number in graph manager is dynamic
#endif

#define DRIVER_PORT_NUM 256
@@ -62,7 +62,7 @@
#define CONNECTION_NUM_FOR_PORT PORT_NUM_FOR_CLIENT

#ifndef CLIENT_NUM
-#define CLIENT_NUM 64
+#define CLIENT_NUM 1024
#endif

#define AUDIO_DRIVER_REFNUM 0 // Audio driver is initialized first, it will get the refnum 0
diff --git a/common/shm.h b/common/shm.h
index 3e3276dc..27559fa4 100644
--- a/common/shm.h
+++ b/common/shm.h
@@ -49,7 +49,7 @@ extern "C"
#endif

#define MAX_SERVERS 8 /* maximum concurrent servers */
-#define MAX_SHM_ID 256 /* generally about 16 per server */
+#define MAX_SHM_ID 4096 /* generally about 16 per server */
#define JACK_SHM_MAGIC 0x4a41434b /* shm magic number: "JACK" */
#define JACK_SHM_NULL_INDEX -1 /* NULL SHM index */
#define JACK_SHM_REGISTRY_INDEX -2 /* pseudo SHM index for registry */

Configure, build and install:

./waf configure --clients=1024 --ports-per-application=8192
sudo ./waf install

Finally, create a tarball for installation in the VM images:

tar cvzf jack2-1.9.19-patched.tar.gz /usr/local/include/jack/* /usr/local/lib/libjack* /usr/local/lib/jack/* /usr/local/bin/jack* /usr/local/share/man/man1/jack* /usr/local/share/man/man1/alsa_* /usr/local/lib/pkgconfig/jack.pc