cf cli slow in large space due to page size of 50 when calling CF API
Please fill out the issue checklist below and provide ALL the requested information.
- [x] I reviewed open and closed github issues that may be related to my problem.
- [x] I tried updating to the latest version of the CF CLI to see if it fixed my problem.
- [x] I attempted to run the command with
CF_TRACE=1to help debug the issue. - [x] 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:
- Run
cf a -v - 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))