Jetty/winstone connector configuration in Jenkins

3.7k views Asked by At

I am experiencing slow download times over WAN links from JENKINS. Not going into details of the problem i would like to configure Jetty apparently used by Jenkins to add the following connector:

<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
 <Set name="host"><Property name="application-host"/></Set>
 <Set name="port"><Property name="application-port"/></Set>
 <Set name="forwarded">true</Set>
 <Set name="responseBufferSize">16777216</Set>
 <Set name="responseHeaderSize">1048576</Set>
</New>

but i am not sure what is the right spot to do it. I cannot find jetty.xml file anywhere in my installation. I am using Jenkins on Windows so i guess i am just launching it using java -jar jenkins.war which is supposed to use Jetty/Winstone.

EDIT: Looks like this cannot be done by just changing configuration. At least not in SSL context: https://github.com/J-cztery/winstone/blob/master/src/java/winstone/HttpsConnectorFactory.java hardcodes creation of ServerContext.

1

There are 1 answers

0
Alex O On

If you don't use a custom servlet container like Tomcat, then Jenkins uses a built-in "Jetty/Winstone" container indeed. To be more precise: Jenkins uses a wrapper around Jetty that implements the Winstone command line interface (motivation was to switch from the old Winstone to Jetty without changing the interface).

The Jetty container can be customized by adding options directly on the Jenkins command line (that is, in your Windows case, by adding them to the <arguments> tag in the jenkins.xml file.

The available options (like, --httpPort or --sessionTimeout) are documented in the Jenkins winstone repository on github.

If those options are not sufficient, then you might be able to further customize the container by modifying this section in pom.xml:

      <connectors>
        <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
            <port>${port}</port>
        </connector>
      </connectors>

...or by editing the web.xml file. At least the latter can be modified without changing the war file by editing the unpacked $JENKINS_HOME/war/WEB-INF/web.xml. I didn't try either yet, though.