Bounding writes on client side


When a client produces events as quickly as it can with AppendToStreamAsync and no event store running It quickly runs out of memory. This results in some weird error messages… I’ve tried setting artificially low limits on the connection via all the Limit* methods to no avail…

Any suggestions?


It seems reasonable as a feature (though please include your "weird
error messages")... to add two things to consider.

First running out of memory is not really something that will happen
quickly. Assuming you are writing 1000 events/second at 1k each it
would take roughly 15 minutes to use a gb of memory. Even if I make
this 30k/second is still 30 seconds. In a modern application going to
2-3 minutes here is not ridiculous.

Second and related to the first. Your code is calling
AppendToStreamAsync and knows how many outstanding operations there
are at any given point. Your code could just limit how many
outstanding appendtostreamasync operations there currently are from
the outside. Hopefully your code would realize within a minutes
timeframe that none of your async calls are returning?



The “weird error messages” was not related to the ES client, but rather how badly my test runner + VS handles out of memory exceptions… I should have made that clear :slight_smile:

I think for now I will do as you suggested in the second part of your post…

What would be a natural way of keeping track of outstanding operations in the client api? By using the task returned from AppendToStreamAsync?

Yes and you get results through the task (e.g. waiting for it to
complete). At any given point in time you know how many outstanding
tasks you have.