News for hackers. Stuff that matters.
Re:Cap'n Proto 1.0 by jayd16 on Friday July 28, 2023 @12:47PM (#36909642)
As neat as it is I guess it's hard optimize the backend for it compared to explicitly grouping the queries. I imagine a bespoke RPC call that results in a single SQL query is better than several pipelined but separate RPC calls, for example.

But even still, you would think it would be more popular.

Re:Cap'n Proto 1.0 by kentonv on Friday July 28, 2023 @03:06PM (#36911688)
If you're thinking strictly about stateless backends that just convert every request into a SQL query, then yeah, promise pipelining might not be very helpful.

I think where it shines is when interacting with stateful services. I think part of the reason everyone tries to make everything stateless is because we don't have good protocols for managing state. Cap'n Proto RPC is actually quite good at it.

Re:Cap'n Proto 1.0 by cmrdporcupine on Friday July 28, 2023 @03:38PM (#36912159)
The issue is that having per-session/transaction state on the server makes load balancing requests more difficult; especially when that state is long-lived.
Re:Cap'n Proto 1.0 by kentonv on Friday July 28, 2023 @04:04PM (#36912537)
While it's true that load-balancing long-lived resources is harder than short-lived, a lot of the difficulty of load balancing with stateful servers is actually in the protocol, because you somehow have to make sure subsequent requests for the same state land on the correct server.

Cap'n Proto actually does really well with this basic difficulty, because it treats object references as a first-class thing. When you create some state, you receive back a reference to the state, and you can make subsequent requests on that reference. The load balancer can see that this has happened, even if it doesn't know the details of the application, because object references are marked as such at the RPC layer independent of schema. Whereas in a system that returns some sort of "object ID" as a string, and expects you to pass that ID back to the server on subsequent requests, the load balancer is not going to have any idea what's going on, unless you do extra work to teach the load balancer about your protocol.

Re:Cap'n Proto 1.0 by parkerduckworth on Friday July 28, 2023 @11:37PM (#36916616)
Wow that is super interesting. Thanks for sharing.
Re:Cap'n Proto 1.0 by TOGoS on Saturday July 29, 2023 @12:45AM (#36917030)
If it's the same backend handling multiple chained requests that happen to use the same database, it could in turn build a single big SQL query to generate the result(s). I used to write stuff like this all the time (not specifically Cap'n Proto servers, but general functional expression -> SQL -> here's your answer engines).