Skip to content

Make calls to the auth server concurrently#38955

Merged
gzdunek merged 3 commits intomasterfrom
gzdunek/concurrent-auth-server-calls
Mar 6, 2024
Merged

Make calls to the auth server concurrently#38955
gzdunek merged 3 commits intomasterfrom
gzdunek/concurrent-auth-server-calls

Conversation

@gzdunek
Copy link
Copy Markdown
Contributor

@gzdunek gzdunek commented Mar 5, 2024

In some places, we were making calls to the auth server sequentially instead of concurrently. This was quite inefficient.

For comparison, GetWithDetails for my cluster:
Sequentially: ~1.4 s
Concurrently: ~0.7s

@gzdunek gzdunek added teleport-connect Issues related to Teleport Connect. no-changelog Indicates that a PR does not require a changelog entry backport/branch/v15 labels Mar 5, 2024
@gzdunek gzdunek requested a review from ravicious March 5, 2024 11:54
@github-actions github-actions Bot requested a review from fspmarshall March 5, 2024 11:55
@github-actions github-actions Bot requested a review from mdwn March 5, 2024 11:55
Copy link
Copy Markdown
Member

@ravicious ravicious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, it starts really damn fast now, especially when connecting from Connect in Europe to a cluster in US.

I left a comment about those pref upserts.

Comment thread lib/teleterm/services/userpreferences/userpreferences.go
@gzdunek gzdunek added this pull request to the merge queue Mar 6, 2024
Merged via the queue into master with commit ddc45a4 Mar 6, 2024
@gzdunek gzdunek deleted the gzdunek/concurrent-auth-server-calls branch March 6, 2024 18:25
@public-teleport-github-review-bot
Copy link
Copy Markdown

@gzdunek See the table below for backport results.

Branch Result
branch/v15 Failed

gzdunek added a commit that referenced this pull request Mar 7, 2024
* Make calls to the auth server concurrently

* Enhance the comment about preferences upsert

* Summarize how `userpreferences.Update` works

(cherry picked from commit ddc45a4)
github-merge-queue Bot pushed a commit that referenced this pull request Mar 7, 2024
* Cache remote clients in Connect  (#38201)

* Add remote client cache

* Add an integration test

* Close all clients when stopping the service

* Move RemoteClientCache to the place where it is used

* Do not check client cert in `Get`

* Fix code style issues

* Prevent potential race condition when removing a cached client

* Test concurrent calls to `Get`

* Add TODO

* `remoteclientcache` -> `clientcache`

* Reduce the `err` scope

* Move `Config` closer to `New` and docs

* Fix lint

* Improve logging and error handling

* Add missing comments

* `Close` -> `Clear`

* Improve the test

* Remove mentions about "remote" client

* Pass `cfg` directly to `Cache`

* `InvalidateForRootCluster` -> `ClearForRootCluster`

* Add docs for the interface

* `ClearForRootCluster` -> `ClearForRoot`

* Add config validation

* Log multiple fields at once

* Improve setting logger

* Use cached remote clients in Connect (#38202)

* Replace all simple `c.clusterClient.ConnectToProxy()` calls

* Use cached proxy client to create gateways

* Use cached proxy client to assume roles

* Invalidate clients when logging in and out

* Gracefully handle expired cert error returned by the server

* Drop `GetRootClusterURI` in headless auth watcher since URIs are already root URIs

* Simplify error check

* Make `auth.ClientI` parameter naming more consistent, use `root` prefix when needed

* Reduce error scope where possible

* Clear cached clients before passwordless login

* Use `fakeClientCache` without pointers

* Move separate `proxyClient` parameter to `CreateGatewayParams` in the gateways code

* Replace checking error string with `client.ErrClientCredentialsHaveExpired`

(cherry picked from commit 39f9951)

* Temporarily disable flaky part of `TestClientCache` (#38798)

(cherry picked from commit 7067a88)

* Make calls to the auth server concurrently (#38955)

* Make calls to the auth server concurrently

* Enhance the comment about preferences upsert

* Summarize how `userpreferences.Update` works

(cherry picked from commit ddc45a4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog Indicates that a PR does not require a changelog entry size/sm teleport-connect Issues related to Teleport Connect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants