Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Reduce API calls needed to discover apps & services #29

Merged
merged 2 commits into from
Jun 17, 2019

Commits on Jun 17, 2019

  1. Add tests for the cf client

    These tests demonstrate the client's current behaviour of making one API
    call per application and per service.
    
    I've used jarcoal/httpmock for the tests here - we could use httptest's
    Server instead, but the mock one makes our life marginally easier.
    
    Future commits will refactor the code so it makes fewer API calls.
    richardTowers committed Jun 17, 2019
    Configuration menu
    Copy the full SHA
    f6c647f View commit details
    Browse the repository at this point in the history
  2. Reduce API calls needed to discover apps & services

    Previously this made two API calls for every application the user was
    able to see:
    
    - 1 to get the Space
    - 1 to get the Org
    
    Some orgs have large numbers of apps (65 apps in one org -> 130 API
    calls).
    
    Because there are no sleeps between calls, this ends up putting a lot of
    traffic through the API all at once, which then gets queued.
    
    Once API requests start getting queued, the healthcheck starts failing
    (because the healthcheck requests time out while they're in the queue).
    
    Once the healthcheck starts failing the API servers start getting taken
    out of the load balancer, at which point we start having Bad Vibes.
    
    This commit changes the API calls we make so that there's one call to
    get all the orgs the user can see, one to get all the spaces the user
    can see, and one to get all the apps the user can see. Because this
    doesn't vary with the number of apps the performance should be much more
    predictable.
    richardTowers committed Jun 17, 2019
    Configuration menu
    Copy the full SHA
    5325814 View commit details
    Browse the repository at this point in the history