Soloplan / whatson

Build status monitoring for Windows with support for Jenkins, Travis-CI, CC.NET (alternative to CCTray)
MIT License
19 stars 4 forks source link

Optimize network traffic for Jenkins plugin #25

Closed steffen-wilke closed 4 years ago

steffen-wilke commented 4 years ago

Currently the Jenkins Plugin is calling the API on every tick (every 10 sec) for every build project. However, projects that are not building, usually don't update any of their data. An update is typically only required if the state changed or while the build is running.

For projects on the same Jenkins server, we could improve the current implementation by asking the Jenkins API first about the current states of the projects (i.e. "which jobs are building"). Only for the projects that are actually building or that changed their state, we would then need to retrieve detailed information.

Imagine a WhatsON configuration with 50 projects on the same Jenkins server. Typically only a fraction of the projects is building simultaneously: let's say 5 jobs are building.

Current = 50 calls to the Jenkins API Suggested = 1 + 5 calls to the Jenkins API

The only restriction on this optimization is when folders are used to structure the Jenkins instance. The API needs to know the depth of the call it should perform.

API call for depth 3:

https://{MY_JENKINS_URL}/api/json?tree=jobs[name,lastBuild[building],jobs[name,lastBuild[building],jobs[name,lastBuild[building]]]]&pretty

I'd suggest a default depth of 3 and if projects are located deeper in the folder hierarchy, we could query them explicitly like we currently do.

dominikgolda commented 4 years ago

12f51fed causes change notifications to be shown on application startup.

dominikgolda commented 4 years ago

Changing some settings (I tried with Open minimized) and applying configuration also causes notifications to appear. 12f51fe is also to blame.