Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cf cli slow in large space due to page size of 50 when calling CF API #2733

Open
4 tasks done
stephanme opened this issue Jan 11, 2024 · 0 comments
Open
4 tasks done

Comments

@stephanme
Copy link
Contributor

Please fill out the issue checklist below and provide ALL the requested information.

  • I reviewed open and closed github issues that may be related to my problem.
  • I tried updating to the latest version of the CF CLI to see if it fixed my problem.
  • I attempted to run the command with CF_TRACE=1 to help debug the issue.
  • I am reporting a bug that others will be able to reproduce.

Describe the bug and the command you saw an issue with

cf a in a space that contains ~800 apps takes ~5min which is very slow.

What happened

cf a -v logged the following CF API requests in order to list the apps in a space:

GET /v3/apps?order_by=name&space_guids=<guid>
GET /v3/apps?order_by=%2Bname&page=2&per_page=50&space_guids=<guid>
GET /v3/apps?order_by=%2Bname&page=3&per_page=50&space_guids=<guid>
...

i.e. the apps of a space are read with a page size (per_page) of 50 which results in many roundtrips. per_page=50 is the default page size of the cloud controller: https://github.com/cloudfoundry/cloud_controller_ng/blob/main/lib/cloud_controller/paging/pagination_options.rb

Expected behavior

Use a larger page size, e.g. per_page=5000 (the max possible) for list-resource requests to reduce the number of round trips.

Exact Steps To Reproduce
Steps to reproduce the behavior; include the exact CLI commands and verbose output:

  1. Run cf a -v
  2. Observe missing per_page query parameter in the first GET /v3/apps?order_by=name&space_guids=<guid> request which results in per_page=50 (the default).

Provide more context

  • platform and shell details: Mac OS
  • version of the CLI you are running: cf version 8.7.6+a659013.2023-12-14
  • version of the CC API Release you are on: 3.153.0

Notes regarding V6 and V7 CLI support:

  • V6:
    • Minimum supported version of CF Deployment: v7.0.0 (CAPI Release: 1.74.0 (APIs 2.128.0 and 3.63.0))
    • Maximum supported version of CF Deployment: v13.4.0 (CAPI Release: 1.94.0 (APIs 2.149.0 and 3.84.0))
  • V7:
    • Minimum supported version of CF Deployment: v13.5.0 (CAPI Release: 1.95.0 (APIs 2.150.0 and 3.85.0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants