-
Notifications
You must be signed in to change notification settings - Fork 22
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
Conversation
667dd93
to
da51afe
Compare
public R execute(T request, Function<T, R> processingFunc) { | ||
if (!semaphore.tryAcquire()) { | ||
throw new PluginRpcEndpointException( | ||
RpcErrorType.INVALID_REQUEST, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
arithmetization/src/main/java/net/consensys/linea/plugins/rpc/Requests.java
Outdated
Show resolved
Hide resolved
arithmetization/src/main/java/net/consensys/linea/plugins/rpc/Requests.java
Outdated
Show resolved
Hide resolved
...etization/src/main/java/net/consensys/linea/plugins/rpc/linecounts/GenerateLineCountsV2.java
Outdated
Show resolved
Hide resolved
...src/main/java/net/consensys/linea/plugins/rpc/tracegeneration/GenerateConflatedTracesV2.java
Outdated
Show resolved
Hide resolved
2fb9f5c
to
f03a980
Compare
f334011
to
12d8961
Compare
arithmetization/src/main/java/net/consensys/linea/plugins/rpc/RequestLimiter.java
Outdated
Show resolved
Hide resolved
dcf9f96
to
eeb384e
Compare
eeb384e
to
210de3d
Compare
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(); |
There was a problem hiding this comment.
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
No description provided.