aleph

dottedmag 2017-07-02T12:14:46.933596Z

Is there a way to apply backpressure to the WebSocket handler in Aleph? I have a network server, and one kind of network messages it serves is bottlenecked on a shared resource. I'd like to make sure the producers of WebSocket messages are paused somehow when the server is not keeping up with the demand.

dottedmag 2017-07-02T12:15:49.937702Z

The protocol is "fire-and-forget", and I can't change it, so there is not much possibility to do a backpressure on protocol level, so it has to be something lower-level, e.g. TCP backpressure.

dottedmag 2017-07-02T12:18:25.947430Z

I don't care about proxies, as it's a server-to-server communication with no proxies in between.

dm3 2017-07-02T13:39:41.258436Z

@dottedmag, taking Aleph out of the equation, what is your expected outcome in the client-server interaction when the server can’t handle the load? What does fire-and-forget mean - does the client not wait for any response?

dottedmag 2017-07-02T14:34:31.490523Z

@dm3 The expected outcome is that clients slow down until the server can handle the load. Clients do not wait for a WebSocket-level response, but every client uses only one WebSocket connection for communication.

dottedmag 2017-07-02T14:42:59.526418Z

If I were starting from scratch, I'd do something like this: a bounded small queue, one thread reading from it and working on a shared resource, request handlers in a pool submitting jobs to this queue synchronously. If a queue is full, request handlers block, and no data is read from the network sockets.

dottedmag 2017-07-02T14:43:41.529227Z

However I'd like to have other kinds of requests, not bottlenecked on this shared resource, to proceed.

dm3 2017-07-02T15:18:23.685625Z

I’m afraid I don’t know enough about Aleph to help here. I’d try to separate the handlers serving the two types of clients (bottlenecked/non-bottlenecked) though so that you don’t have to solve this problem generically.

dottedmag 2017-07-02T15:33:05.752568Z

I can do that once the connection is established – the first message carries the kind of connection. But I don't think I have an option to say to Aleph "from now on use this pool to handle the WebSocket messages from this connection"

dottedmag 2017-07-02T15:33:12.753134Z

All right, I'll go dig into source code a little.

dm3 2017-07-02T15:42:38.796887Z

on the Manifold side you have stream/onto which will put all of the callbacks onto the specified pool

dm3 2017-07-02T15:43:04.799178Z

however that’s probably not what you are looking for

dottedmag 2017-07-02T17:53:25.403816Z

Actually it might be the thing I'm looking for.

dottedmag 2017-07-02T17:53:31.404307Z

@dm3 Thanks, I'll give it a try.