Skip to content

Conversation

@bbernays
Copy link
Contributor

@bbernays bbernays commented Dec 10, 2023

Summary

This pr introduces a rate semaphore that limits the number of simultaneous go routines that can be resolving the same table + client to just 10. Prior to this a single table could be using all of the available concurrency to resolve a single table. This alleviates the problem where nested tables get throttled because the load is not spread across all client/table pairs but is concentrated on a single client and table.

I will update this PR with a benchmark case once #1410 gets merged

@github-actions
Copy link

github-actions bot commented Dec 10, 2023

⏱️ Benchmark results

Comparing with f5a0d47

  • Glob-8 ns/op: 90.63 ⬇️ 0.52% decrease vs. f5a0d47

logger zerolog.Logger
concurrency int
singleTableConcurrency sync.Map
singleTableMaxConcurrency int
Copy link
Contributor

Choose a reason for hiding this comment

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

just use int64 here?

Copy link
Contributor

Choose a reason for hiding this comment

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

also, maybe use negative to disable the code?

Copy link
Member

@erezrokah erezrokah left a comment

Choose a reason for hiding this comment

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

Added a few comments/questions mostly. The blocking one is on making this a non breaking change

@bbernays bbernays linked an issue Dec 12, 2023 that may be closed by this pull request
1 task
@kodiakhq kodiakhq bot merged commit 4d13b18 into main Dec 13, 2023
@kodiakhq kodiakhq bot deleted the resource-rate-limit branch December 13, 2023 13:48
kodiakhq bot pushed a commit that referenced this pull request Dec 13, 2023
🤖 I have created a release *beep* *boop*
---


## [4.21.0](v4.20.0...v4.21.0) (2023-12-13)


### Features

* Individual Table and Client rate limit ([#1411](#1411)) ([4d13b18](4d13b18))


### Bug Fixes

* **deps:** Update module github.com/cloudquery/cloudquery-api-go to v1.6.2 ([#1413](#1413)) ([f5a0d47](f5a0d47))
* **deps:** Update module github.com/cloudquery/plugin-pb-go to v1.14.4 ([#1408](#1408)) ([7544967](7544967))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Better Concurrency Controls for nested tables

5 participants