cli icon indicating copy to clipboard operation
cli copied to clipboard

cf s command very slow since 6.35

Open choffm opened this issue 8 years ago • 19 comments

Hello, the cf s command is much slower in version 6.35.2, compared to 6.34.1.

Command

cf s

What occurred

With version 6.34.1: cf s 0.18s user 0.04s system 4% cpu 4.647 total With version 6.35.2: cf s 0.26s user 0.10s system 1% cpu 30.341 total

CLI Version

cf version 6.34.1+bbdf81482.2018-01-17 cf version 6.35.2+88a03e995.2018-03-15

CC API Endpoint Version

api version: 2.101.0

Platform & Shell Details

MacOS 10.13.3 (also occured on Windows 10 x64)

Any other relevant information

Also occurred with CF CLI version 6.35.0, however the command resulted in an error message (see https://github.com/cloudfoundry/cli/issues/1342).

choffm avatar Mar 23 '18 14:03 choffm

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/156227967

The labels on this github issue will be updated when the story is started.

cf-gitbot avatar Mar 23 '18 14:03 cf-gitbot

Yup! In CF 6.35.0, the CF CLI switched from using a single /spaces/summary API call to individual /service, /service_instance, etc. API calls. Due to the increased number of API calls, the services request is much slower.

Why did it switch? The /services/summary API call breaks when there are more than 50 services or apps. Additionally, the break returns back a successful status code, so the CLI can't tell the difference between 51+ services/apps and 0 services/apps. So it would appear that all your services are gone!

There might be a way to cache some of these requests if they happen to be looking up duplicate objects, but overall the speed increase may be negligible.

XenoPhex avatar Mar 23 '18 16:03 XenoPhex

Hi @choffm thanks for creating this issue. We are closing this issue but please do not hesitate to reach out if this issue becomes too problematic. Thanks.

abbyachau avatar Jun 01 '18 16:06 abbyachau

Reopening because we've received feedback that this command was actually returning the correct number of services/apps if there are more than 50. And the change we made introduced higher latency.

abbyachau avatar Aug 02 '18 21:08 abbyachau

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/159509618

The labels on this github issue will be updated when the story is started.

cf-gitbot avatar Aug 02 '18 21:08 cf-gitbot

Hi,

as @abbyachau stated, the change which slowed down the cf s command wasn't even necessary, but it is a real pain for people who use the cli on a daily basis. In some of my spaces, it takes up to 90 seconds for the command to return the list of services.

Can you please revert the changes or provide another fix for the performance degradation?

Thanks

choffm avatar Dec 29 '18 11:12 choffm

Hi @choffm thanks for your note! For now, we're planning to fix this (and cf m which can also become quite slow) in V3 of the API and not V2.

laurzca avatar Jan 02 '19 15:01 laurzca

Following up on this - we've decided to take a look at how much effort would be required to improve the performance for cf s in V2. We'll update with what we find.

laurzca avatar Jan 07 '19 10:01 laurzca

We have noticed this recently as well. Cannot track it to a particular cli change or CF upgrade. But we did notice that cf s is significantly slower for non admins when compared with users who are cloud_controller.admins.

youngm avatar Jan 09 '19 17:01 youngm

Should be caused by this commits, it's the only one service command related changes from 6.34.1 to 6.35.0 which changes its behavior:

https://github.com/cloudfoundry/cli/commit/951e73f02cf2e3e74aeb1a0e2b74f8165b0553a4

choffm avatar Jan 09 '19 19:01 choffm

@tcdowney @ssisil @mkenyon for reference (CLI will be discussing implications of moving away from the summary endpoint)

abbyachau avatar Jan 09 '19 21:01 abbyachau

@abbyachau : We've currently working on re-introducing the use of summary endpoint to speed up the cf s command cc: @laurzca

AartiKriplani avatar Jan 10 '19 09:01 AartiKriplani

I am also very much interested in a fast cf s command and I really like the measured performance boost recorded in the story.

Some examples for our 130 service instances. The cf s (version 6.42.0+0cba12168.2019-01-10) cmd took about 8 minutes whereas the `cf curl "/v2/spaces/a22e76f9-e2a5-4f22-b8a2-2bc21be6a2c3/summary" took about 8-12 seconds.

Did you think about a command to basically show a list of service instances without all the additional binding information?

How about actually using /v2/service_instances API? This turned out to be even faster since it only focuses on service instances and ignores the apps which are also in the space summary. Imagine we have 114 apps in one space. cf curl "/v2/service_instances?q=space_guid:a-guid&order-direction=asc" took about <1-2 seconds. Additionally, you need the /v2/user_provided_service_instances API which takes also about 1 second (tested with 30 UPS) cf curl "/v2/user_provided_service_instances?q=space_guid:a22e76f9-e2a5-4f22-b8a2-2bc21be6a2c3"

One of the advantages of those API endpoints is the pagination which might come in handy compared to the "full summary". I am not sure when or if this will break.

Wdyt? I saw that the story is already accepted.

Btw. using the new build cf-cli attached to the story (version 6.42.0+dad6a8e3f.2019-01-24) (time cf s), I get a wide range of result times. Between 7 and 27 seconds. I guess very much dependent on the usage of the cloud foundry system below.

Kiemes avatar Jan 30 '19 12:01 Kiemes

@Kiemes : Thank you for trying the new implementation out and giving us feedback. The new implementation uses the /v2/spaces/:guid/summary endpoint. We do not have it on our roadmap to add a new endpoint to just show a list of instances. If you have a use-case for that feature please submit an issue so we can track it separately from this one.

Thanks, Aarti & @williammartin

AartiKriplani avatar Jan 30 '19 15:01 AartiKriplani

Just to be sure we're on the same page here. @Kiemes You see performance improvement from the old CLI version and the new edge binary. For the old version 6.42.0+0cba12168.2019-01-10 it took 8 minutes to list all services in your space, while with the new version 6.42.0+dad6a8e3f.2019-01-24 it took between 7-27 seconds?

You'd like to improve the performance even further by omitting some of the payload of the command(f.e. bound apps to a service instance)?

georgi-lozev avatar Jan 31 '19 09:01 georgi-lozev

@georgi-lozev you got it. But as I said, I am aware that the "new cf services command without bound apps" would be a breaking change. That's why I created the feature request for a new option.

Kiemes avatar Jan 31 '19 12:01 Kiemes

I'll close this out for now. :)

henryaj avatar Feb 08 '19 10:02 henryaj

Are you planning to release this soon?

Kiemes avatar Feb 13 '19 15:02 Kiemes

Hi @Kiemes this is slated for the next release which we hope to release soon.

abbyachau avatar Feb 13 '19 18:02 abbyachau