Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-24069

Improve performance by caching and reducing number of github api calls

      Github pull request #27

      On jenkins instances with a large number of jobs the previous implementation got very slow because it made a github api call per job & did not do a great job of caching. This pull reduces the chatter with the github api by asking which repos the user has access to and caching the results.

      There are 2 big changes in this pull

      1. The algorithm now builds and caches a list of "my repositories"

      It makes these api calls to github:
      1. Get list of the non-organization repos user has access to /api/v3/user/repos
      2. Get list of organizations with repos user has access to /api/v3/user/orgs. For each organization

      Get a list of repos in that org user has access to /api/v3/orgs/XXX/repos
      Because of pagination it sometimes makes several calls to get the full list of repos.

      2. Cache list of public repositories for read-only access.

      For this it still makes an api call per repository but caches the results for all users.

      On my jenkins instance with ~400 projects this has improved performance from unusable (minutes to load the home page) to pretty fast (~4 seconds as it builds the cache and faster after that).

            sag47 Sam Gleske
            alexrothenberg alex rothenberg
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: