The NetworkOptions allows the user to set knobs using the setKnob API: https://javadoc.io/static/org.foundationdb/fdb-java/7.4.6/com/apple/foundationdb/NetworkOptions.html#setKnob(java.lang.String)
The formatting for that is a little weird. You have to take the knob name (lower-case), an =, and the knob value, and then concatenate them together. So, something like:
tls_client_handshake_threads=3
To set the TLS_CLIENT_HANDSHAKE_THREADS knob to 3: https://github.com/apple/foundationdb/blob/a6233ad8a9ebfd99d37ce9e20db97dbcf726ab1b/flow/Knobs.cpp#L149
More details on how the knob values are parsed here: https://github.com/apple/foundationdb/blob/a6233ad8a9ebfd99d37ce9e20db97dbcf726ab1b/flow/Knobs.cpp#L423
There are some API challenges. For example, it would be nice to be able to use some kind of enum that listed all of the knobs that we think clients should want to change. But we also want to have some flexibility here so that we can allow users to set these knobs in the future as soon as they are available.
In general, it would be a good idea to set knobs before initializing the client, though they may actually be mutable, based on how the knob setting logic in the client works: https://github.com/apple/foundationdb/blob/a6233ad8a9ebfd99d37ce9e20db97dbcf726ab1b/fdbclient/NativeAPI.actor.cpp#L706 Note that if the network has started, it calls setClientKnob on the running g_network; otherwise, it writes the knob into a map, and then calls setClientKnob on all of the values from that map. Still, it may be a good idea to be skeptical of setting a knob on a running process.
The
NetworkOptionsallows the user to set knobs using thesetKnobAPI: https://javadoc.io/static/org.foundationdb/fdb-java/7.4.6/com/apple/foundationdb/NetworkOptions.html#setKnob(java.lang.String)The formatting for that is a little weird. You have to take the knob name (lower-case), an
=, and the knob value, and then concatenate them together. So, something like:To set the
TLS_CLIENT_HANDSHAKE_THREADSknob to 3: https://github.com/apple/foundationdb/blob/a6233ad8a9ebfd99d37ce9e20db97dbcf726ab1b/flow/Knobs.cpp#L149More details on how the knob values are parsed here: https://github.com/apple/foundationdb/blob/a6233ad8a9ebfd99d37ce9e20db97dbcf726ab1b/flow/Knobs.cpp#L423
There are some API challenges. For example, it would be nice to be able to use some kind of enum that listed all of the knobs that we think clients should want to change. But we also want to have some flexibility here so that we can allow users to set these knobs in the future as soon as they are available.
In general, it would be a good idea to set knobs before initializing the client, though they may actually be mutable, based on how the knob setting logic in the client works: https://github.com/apple/foundationdb/blob/a6233ad8a9ebfd99d37ce9e20db97dbcf726ab1b/fdbclient/NativeAPI.actor.cpp#L706 Note that if the network has started, it calls
setClientKnobon the runningg_network; otherwise, it writes the knob into a map, and then callssetClientKnobon all of the values from that map. Still, it may be a good idea to be skeptical of setting a knob on a running process.