Bug 1613075 - Significant delay when switching projects
Summary: Significant delay when switching projects
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 3.6.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 3.11.0
Assignee: Juan Vallejo
QA Contact: Xingxing Xia
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-08-06 23:52 UTC by Luke Stanton
Modified: 2021-09-09 15:18 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-11 07:24:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3894771 0 None None None 2019-02-07 20:00:01 UTC
Red Hat Product Errata RHBA-2018:2652 0 None None None 2018-10-11 07:24:21 UTC

Description Luke Stanton 2018-08-06 23:52:30 UTC
Description of problem:
Project switching is very slow when a large kube config file is being used to track context.

How reproducible:
Consistently.

Steps to Reproduce:
1. Run the 'oc project' command on a machine tracking a large number of contexts in the kube config file

Actual results:
A significant amount of time is required to switch projects.

Expected results:
The project change should happen in a reasonably short amount of time.

Additional info:

Here's an example of the time discrepancy...

--------------------------------------
time oc project op-platform-kit-ci
Now using project "op-platform-kit-ci" on server "https://vh-*****io:8443".

real    0m19.215s
user    0m21.837s
sys     0m0.465s

Compared with:
time oc project op-platform-auth-service
Now using project "op-platform-auth-service" on server "https://vh-*****.io:8443".

real    0m2.242s
user    0m2.521s
sys     0m0.121s
--------------------------------------

Comment 2 Juan Vallejo 2018-08-07 19:02:24 UTC
The reason why this happens, is because we are modifying your kubeconfig any time you switch to a new project [1] in order to update context information. When we do this, we are reading [2] and writing [3] to and from the config file once for _every_ context that you have. This in turn, causes an increasing delay for every context present in your config.

Origin PR: https://github.com/openshift/origin/pull/20566/files

1. https://github.com/openshift/origin/blob/master/pkg/oc/cli/project/project.go#L268

2. https://github.com/kubernetes/client-go/blob/master/tools/clientcmd/config.go#L231

3. https://github.com/kubernetes/client-go/blob/master/tools/clientcmd/config.go#L237

Comment 3 Juan Vallejo 2018-08-14 22:10:02 UTC
Origin PR has merged. Moving to MODIFIED

Comment 5 Xingxing Xia 2018-08-24 03:31:00 UTC
We met this issue in which case the config size is 321K. Verifying with v3.11.0-0.20.0, the issue disappears.

Comment 7 errata-xmlrpc 2018-10-11 07:24:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:2652


Note You need to log in before you can comment on or make changes to this bug.