I was looking into the performance of the page rendering for upcoming 1.458, and made some improvements to the way plugins access static resources. Taking advantages of this requires help from plugin developers, so here is a call for action.

In short, you should be using ${resURL} and not ${rootURL} for accessing static files in your plugin. Or in code, it'd be "Jenkins.getResourcePath()".

[1] and [2] shows the concrete examples of those changes. If respective plugin developers can make those changes in their plugins, we'd collectively improve the user experience.

This is especially high priority for plugins that provide PageDecorator extension points, as they inject some stuff into every single page.


For Jenkins 1.458 and later, this change will make those static resources served with long Expires header, enabling the browser to cache them (and use them without contacting the server again with the "If-Modified-Since" header). These URLs will look like "/static/..../plugin/git/abc.png" where "...." portion changes for each server reboot. This ensures that the browser never uses a stale file when plugins are updated.

For Jenkins 1.457 and earlier, "/static/.../" will serve the intended resource but without any "Expires" header. So it degrades nicely.

The reason this change is important is because it saves browsers from making pointless GET requests with an "If-Modified-Since" header, only to get "304 Not Modified" response from the server. Each such request/response pair costs a packet round trip (which can be easily in the order of 100ms if you access ci.jenkins-ci.org from Europe or Asia.) And because most browsers do not implement HTTP pipelining or have it disabled by default, this latency gets multiplied by the number of such resources.

This issue gets even worse by x3 to x4 for some deployments that utilizes HTTP intermediaries that do not support keep alive (including http://ci.jenkins-ci.org/ until a few hours ago), resulting in slow down that can be measured in the order of second.


This is a part of the UI enhancement drive, and performance is a feature. Thanks in advance for helping making Jenkins faster, and let me know if there's any questions.



[1] https://github.com/jenkinsci/translation-plugin/commit/d0731c366a6829d2a120e24642b31336810e6eb0 [2] https://github.com/jenkinsci/git-plugin/commit/53ffd3bd4e78269a8c9c9a786ad0321d7542150d
--
Kohsuke Kawaguchi | CloudBees, Inc. | http://cloudbees.com/
Try Nectar, our professional version of Jenkins

Reply via email to