Open RCasatta opened 1 month ago
Should we limit the number of requests per batch?
Should we limit the number of requests per batch?
Do we have limits for "new-line separated" batch requests? Is it different here? How much do you propose as the limit here?
Do we have limits for "new-line separated" batch requests? Is it different here?
We don't, but it is different here. New-lines separated requests are streamed, and individual responses are sent as they become available. We only hold up to 10 pending requests in the queue, then block and stop reading from the TCP socket until a pending request gets processed to free room (a bounded mpsc::sync_channel
).
With array batching all the requests and all the response has to be buffered in-memory at once, which could use significant resources and be a DoS vector if there are no limits in place.
How much do you propose as the limit here
Do you think we can afford 20 as the limit for batch requests? I think it's common number because is used as gap limit...
20 seems fine, yes :+1:
However it seems the tests are failing. The failure isn't directly related to the batching but to the TestRunner used to test it.
I didn't realize locally because i launched the test singularly, I think we don't support having multiple concurrent tests. My solution is to make the test ignored by default and test it specifically.
Currently electrs support batching by separating requests via new lines, however, other impls support it also via json array as explained in the cited issue. This add support for batching requests via json array
close https://github.com/Blockstream/esplora/issues/516