Remoting Kafka Plugin 1.0: A new method to connect agents
I am very excited to announce that we have recently released 1.0 version of Remoting Kafka Plugin under Jenkins Plugin. You can check the CHANGELOG to see the features included in this release.
About me
My name is Pham Vu Tuan, I am a final year undergraduate student from Singapore. This is the first time I participate in Google Summer of Code and contribute to an open-source organization.
Mentors
I have GSoC mentors who help me in this project Oleg Nenashev and Supun Wanniarachchi. Besides that, I also receive great support from developers in remoting project Devin Nusbaum and Jeff Thompson.
Overview
Current versions of Jenkins Remoting are based on the TCP protocol. If it fails, the agent connection and the build fails as well. There are also issues with traffic prioritization and multi-agent communications, which impact Jenkins stability and scalability.
This project aims to develop a plugin in order to add support of a popular message queue/bus technology (Kafka) as a fault-tolerant communication layer in Jenkins.
Benefits to the community
-
Provide a new method to connect agent to master using Kafka besides existing methods such as JNLP or ssh-slaves-plugin.
-
Help to resolve the existing issues with the TCP protocol between master and agent communication in Jenkins.
-
Help to resolve traffic prioritization and multi-agent communications issue in Jenkins.
Why Kafka?
When planning for this project, we want to use traditional message queue system such as ActiveMQ or RabbitMQ. However, after some discussion, we decided to have a try with Kafka with more suitable features with this project:
-
Kafka itself is not a queue like ActiveMQ or RabbitMQ, it is a distributed, replicated commit log. This helps to remove message delivery complexity we have in traditional queue system.
-
We need to support data streaming as a requirement, and Kafka is good at this aspect, which RabbitMQ is lack of.
-
Kafka is said to have a better scalability and good support from the development community.
Architecture Overview
The project consists of multiple components:
-
Kafka Client Library - new command transport implementation, producer and consumer client logic.
-
Remoting Kafka Plugin - plugin implementation with KafkaGlobalConfiguration, KafkaComputerLauncher and KafkaSecretManager.
-
Remoting Kafka Agent - A custom JAR agent with remoting JAR packaged together with a custom Engine implementation to setup a communication channel with Kafka. The agent is also packaged as a Docker image in DockerHub.
-
All the components are packaged together with Docker Compose.
The below diagram is the overview of the current architecture:
With this design, master is not communicating with agent using direct TCP communication anymore, all the communication commands are transfered with Kafka.
Features
The project is now under the third coding phase and we have some features available in 1.0 release.
How to run demo
We have setup a ready-to-fly demo for this plugin. You can try to run a demo of the plugin by following this instruction. Features in the demo:
-
Docker Compose starts preconfigured Master and agent instance, they connect automatically using Kafka launcher.
-
Kafka is secured and encrypted with SSL.
-
There few demo jobs in the instance so that a user can launch a job on the agent.
-
Kakfa Manager supported in localhost:9000 to support monitoring of Kafka cluster.