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

The secret list page loads slowly #6400

Closed
niusmallnan opened this issue Jul 19, 2022 · 8 comments
Closed

The secret list page loads slowly #6400

niusmallnan opened this issue Jul 19, 2022 · 8 comments

Comments

@niusmallnan
Copy link

niusmallnan commented Jul 19, 2022

Setup

  • Rancher version: v2.6.6
  • Browser type & version: Chrome on Mac

Describe the bug
If the number of these two kinds of secrets is large: svc-account token and TLS certificate.
When using global admin or cluster owner to view the secret list, the UI response time is slow.

To Reproduce
Create hundreds of secrets with the svc-account token or TLS certificate.

Result
Even if ns is specified on the UI, this API interface(/v1/secrets/) will obtain the data of all namespaces, and it will take a long time to download the data.

Expected Result
The UI loads quickly and improves the user experience.

Additional context
I try to think of some solutions.

Option One

Only request the specified ns data, which can avoid loading all secrets with a high probability.

/v1/secrets/ns1
/v1/secrets/ns2
/v1/secrets/ns3

Option II

Secret type filtering is supported on the UI, and only data of type Opaque is queried by default. This may require some enhancements to the steve API.

@richard-cox
Copy link
Member

Thanks for raising this issue. Can you confirm

  • The number of secrets in your system where you see this issue
  • Whether the secrets have values that are large
  • Whether creating 200 secrets as described reproduces the issue

There are a number of performance issues we are currently investigating and this information will greatly help

@niusmallnan
Copy link
Author

@richard-cox Thanks for your reply.

The number of secrets in your system where you see this issue

I have seen from a community user environment that the data download size for the secret interface is about 30MB.
However, I haven't had a chance to see more detailed information on the number of secrets.

Whether the secrets have values that are large

Obviously, yes. However, this may not be their intention. Because the svc-token and tls certificate types in the secret store the x509 certificate, this data will be relatively large.

Whether creating 200 secrets as described reproduces the issue

I try to create 2k svc accounts, these will be created as secrets synchronously and saved as x509 certificates.

Referring to this script, 2k secrets can be generated in the test namespace.

#!/bin/bash

NS=test
NUM=2000

n=1
while [ $n -le $NUM ]; do
    kubectl create serviceaccount test$n -n $NS
    let n++
done

Check one of the secrets and you'll see an x509 certificate.

kubectl get sa test1 -o yaml -n test
apiVersion: v1
kind: ServiceAccount
metadata:
  creationTimestamp: "2022-07-20T07:25:14Z"
  name: test1
  namespace: test
  resourceVersion: "18581"
  uid: 51e11026-f83c-4c70-9831-c9a798d35925
secrets:
- name: test1-token-vm2zh
- 
kubectl get secret test1-token-vm2zh -o yaml -n test
apiVersion: v1
data:
  ca.crt: xxx
  namespace: dGVzdA==
  token: xxx
kind: Secret
metadata:
  annotations:
    kubernetes.io/service-account.name: test1
    kubernetes.io/service-account.uid: 51e11026-f83c-4c70-9831-c9a798d35925
  creationTimestamp: "2022-07-20T07:25:14Z"
  name: test1-token-vm2zh
  namespace: test
  resourceVersion: "18580"
  uid: 8a0fad8a-357d-4c6e-96d8-2d8180a60f00
type: kubernetes.io/service-account-token

Using a browser to access the secret list page, even if I specify the default namespace, I still need to wait for all the secret data to be downloaded.

In my network environment, this API request(/v1/secrets) completed the request in about 5s+:

  • Waiting for server response: 1.25s
  • Content download: 4.03s

@catherineluse
Copy link
Contributor

catherineluse commented Jul 21, 2022

Even if ns is specified on the UI, this API interface(/v1/secrets/) will obtain the data of all namespaces

The UI frequently uses findAll to get all resources of a certain type. https://github.com/rancher/dashboard/blob/master/shell/plugins/dashboard-store/actions.js#L78 One issue with the findAll is that it is not aware of active namespaces. I think it that before findAll fetches all of any resource type, it should check for selected namespaces, preferably using this active namespace cache. #6261 If any are selected, it should fetch the resources one namespace at a time.

Currently the work of filtering by namespace is done in ResourceTable. It would be more efficient if we just fetched less data with findAll.

@gaktive gaktive added this to the v2.7.x milestone Jul 26, 2022
@catherineluse
Copy link
Contributor

Related issue #6515

@gaktive gaktive modified the milestones: v2.7.x, v2.7.1 Oct 12, 2022
@richard-cox
Copy link
Member

Related issue #6483 (which is a workaround, more improvements to come)

@gaktive gaktive modified the milestones: v2.7.next1, v2.7.next2 Dec 2, 2022
@gaktive
Copy link
Member

gaktive commented Dec 2, 2022

The related issues should help sort this out but there are also going to be backend fixes coming in later that should address this.

@nwmac nwmac modified the milestones: v2.7.next2, v2.7.next3 Mar 31, 2023
@nwmac nwmac modified the milestones: v2.7.next3, v2.7.next4 Jun 7, 2023
@gaktive gaktive modified the milestones: v2.8.0, v2.8.next1 Aug 3, 2023
@richard-cox
Copy link
Member

@niusmallnan You might be interested in a feature from 2.7.5 that filters resources via the values in the namespace / project filter in the header. This greatly reduces the number of resources fetched by the UI. To enable please go to burger menu top left --> Global Settings --> Performance --> Require Namespace / Project Filtering and check the box and hit Apply.

@richard-cox
Copy link
Member

This falls in the general 'we shouldn't fetch all resources' sphere. There's a current workaround listed in #6400 (comment) and will be fully resolved via #8527

@richard-cox richard-cox removed this from the v2.8.next1 milestone Nov 2, 2023
@zube zube bot removed the [zube]: Done label Feb 1, 2024
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

5 participants