Skip to content

Enforce worker capacity limit across both client and server tcp connections#1448

Merged
jfallows merged 7 commits intoaklivity:developfrom
akrambek:tcp-client-counter-bound
Apr 3, 2025
Merged

Enforce worker capacity limit across both client and server tcp connections#1448
jfallows merged 7 commits intoaklivity:developfrom
akrambek:tcp-client-counter-bound

Conversation

@akrambek
Copy link
Contributor

@akrambek akrambek commented Apr 3, 2025

No description provided.

@akrambek akrambek changed the title Make capacity global Make connection capacity global Apr 3, 2025
TcpConfiguration config,
EngineContext context)
{
this.capacity = new AtomicInteger(ENGINE_WORKER_CAPACITY.getAsInt(config));
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not shared across cores, so doesn't need to be atomic.
Perhaps MutableInteger instead?

final class TcpBindingContext implements BindingContext
{
private final Map<KindConfig, TcpStreamFactory> factories;
private final AtomicInteger capacity;
Copy link
Contributor

Choose a reason for hiding this comment

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

This can just be a local variable, no need to store as a field, right?

Comment on lines +91 to +94
if (capacity.get() <= 0)
{
//No capacity
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Label the try resolve: and then break resolve; if no capacity (instead of empty if-block).

jfallows
jfallows previously approved these changes Apr 3, 2025
@jfallows jfallows changed the title Make connection capacity global Enforce worker capacity limit across both client and server tcp connections Apr 3, 2025
@jfallows jfallows merged commit c078c7b into aklivity:develop Apr 3, 2025
36 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants