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

feat(req-limit): implement request limiting for trace generation and line counting #1241

Merged
merged 8 commits into from
Sep 23, 2024

Conversation

powerslider
Copy link
Contributor

No description provided.

public R execute(T request, Function<T, R> processingFunc) {
if (!semaphore.tryAcquire()) {
throw new PluginRpcEndpointException(
RpcErrorType.INVALID_REQUEST,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe we should use another error type, the request is valid, it's just the server which is busy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could not find a better error code, so I am open to suggestions.

this.semaphore = new Semaphore(concurrentRequestsCount);
}

public R execute(T request, Function<T, R> processingFunc) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

where is the associated test?

@powerslider powerslider force-pushed the feat/issue-1240/req-limiting branch 3 times, most recently from 2fb9f5c to f03a980 Compare September 20, 2024 06:37
@powerslider powerslider force-pushed the feat/issue-1240/req-limiting branch 9 times, most recently from f334011 to 12d8961 Compare September 20, 2024 16:49
@powerslider powerslider force-pushed the feat/issue-1240/req-limiting branch 2 times, most recently from dcf9f96 to eeb384e Compare September 23, 2024 09:09
@lu-pinto
Copy link
Collaborator

LGTM, I cannot ship it yet. Might be because I'm still not a maintainer for Besu

RequestLimiterDispatcher.getLimiter(
RequestLimiterDispatcher.SINGLE_INSTANCE_REQUEST_LIMITER_KEY);

return !requestLimiter.isNodeAtMaxCapacity() && synchronizationService.isInitialSyncPhaseDone();
Copy link
Collaborator

Choose a reason for hiding this comment

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

just as a side note to not forget isInitialSynchPhaseDone will not give what you are looking after but there's no other option right now.
I open up the isInSynch check that if the head of the chain is out of synch here: hyperledger/besu#7665

@powerslider powerslider merged commit cf6cef9 into arith-dev Sep 23, 2024
5 checks passed
@powerslider powerslider deleted the feat/issue-1240/req-limiting branch September 23, 2024 11:38
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.

3 participants