InterviewSolution
| 1. |
What is a Ping Thread in Jenkins and how it works? |
|
Answer» Jenkins installs "ping THREAD" on every remote connection, such as Controller/Agent connections, regardless of its transport mechanism (such as SSH, JNLP, etc.). The lower level of the Jenkins Remoting Protocol is a message-oriented protocol, and a ping thread PERIODICALLY sends a ping message that the receiving end will reply to. The ping thread measures the time it TAKES for the reply to arrive, and if it’s taking excessive time (currently 4 minutes and configurable), then it assumes that the connection was lost and initiates the formal close down. This is to avoid an infinite hang, as some of the failure modes in the network cannot be detected otherwise. The timeout is also set to a long enough value so that a temporary surge in the load or a long garbage COLLECTION pause will not trip off the close-down. Ping thread is installed on both controller & agent; each side pings the other and tries to detect the problem from their sides. The ping thread time out is reported through java.util.logging. Besides, the controller will also report this exception in the agent launch log. Note that some agent launchers, most notably SSH agents, writes all stdout/stderr outputs from the agent JVM into this same log file, so you need to be careful. ConclusionThough these are not the complete possibilities of Jenkins, we tried to cover some of the commonly asked interview questions on core Jenkins. We also need to understand that the Jenkins Update Center is enriched with thousands of useful plugins that enhance the supported functionalities of Jenkins. Before appearing for an interview, make sure to install a Jenkins Server on any of the supported platforms - either locally or on the cloud, install the most common plugins (suggested by Jenkins itself & other commonly used plugins). Try creating & building a normal freestyle project with Git or any other SCM integration plugin and try to execute some code from the connected Git Repository. Also, try creating a pipeline project with JenkinsFile and a global shared Jenkins library and build the job successfully. This will help us learn how Jenkins actually works with some hands-on issues. |
|