Tuning Apache Kafka

The configuration is shipped with some defaults, but depending on the size and network topology you might need to tune the Apache Kafka environment to meet certain needs. Set Apache Kafka options directly in the org.opennms.core.ipc.rpc.kafka.cfg and org.opennms.core.ipc.sink.kafka.cfg file.

Alternatively, you can set Kafka producer/consumer options can be set by defining additional system properties prefixed with org.opennms.core.ipc.rpc.kafka and org.opennms.core.ipc.sink.kafka.

Find available configuration parameters for Kafka here:

Multi-tenancy with Horizon and Kafka

Topics will be automatically created and are prefixed by default with OpenNMS. If you want to use an Apache Kafka cluster with multiple Horizon instances, customize the topic prefix by setting the org.opennms.instance.id system property on Horizon and all its Minions and Sentinels to a string value that identifies your instance.

${OPENNMS_HOME}/etc/opennms.properties.d/instance-id.properties
org.opennms.instance.id=MyNMS

Update the Minion’s instance ID accordingly to match the Horizon instance.

${MINION_HOME}/etc/custom.system.properties.
org.opennms.instance.id=MyNMS

Tips for Kafka

  • For Kafka RPC, the number of partitions should always be greater than the number of Minions at a location. When there are multiple locations, partitions >= max number of minions at a location.

  • By default, Kafka RPC supports buffers greater than >1MB by splitting them into chunks of 900KB. Configure max buffer size (900KB, by default) by setting org.opennms.core.ipc.rpc.kafka.max.buffer.size to the desired size in bytes.

  • Default time to live (time at which request will expire) is 20000 msec (20sec). To change it, configure the system property org.opennms.core.ipc.rpc.kafka.ttl in msec.

Disable Single Topic for Kafka RPC

By default OpenNMS uses single topic structure. One request topic is created for each location and one response topic is created for all modules, regardless of location.

Note that all Minions at any location must be running the same features in order to make use of single topic.

For any reason, if you need to have different topic for each module or need different features on each minion, you can disable single-topic as below.

Disabling Single topic must be configured on both Minion and OpenNMS.

Disable single topic on ${MINION_HOME}/etc/org.opennms.core.ipc.rpc.kafka.cfg
single-topic=false

On Horizon, disable single topic by setting the org.opennms.core.ipc.rpc.kafka.single-topic system property to false with your Kafka settings in ${OPENNMS_HOME}/etc/opennms.properties.d/.