Live data from Hacker News

What happens when you make a move in lichess.org?

davidreis.me

21–30 of 162 posts

Re: What happens when you make a move in lichess.org?

#21
post #20

I wonder why this protocol needs an ack? a websocket wrapped in a tls should be perfectly capable of guaranteeing the integrity of the message

You can verify this with ten lines of code and clumsy (a tool for simulating packet loss).

I tried this and not all the messages I sent arrived.

Re: What happens when you make a move in lichess.org?

#22
post #21
post #20

I wonder why this protocol needs an ack? a websocket wrapped in a tls should be perfectly capable of guaranteeing the integrity of the message

You can verify this with ten lines of code and clumsy (a tool for simulating packet loss). I tried this and not all the messages I sent arrived.

What do you mean? If you open a web socket connection it should behave like a normal TCP connection. All sent data guaranteed to be delivered complete and in order, unless the connection fails.

Re: What happens when you make a move in lichess.org?

#23
post #20

I wonder why this protocol needs an ack? a websocket wrapped in a tls should be perfectly capable of guaranteeing the integrity of the message

So that the client knows the message has been delivered and handled by the server, which can make the UI indicate the state of the connection.

Re: What happens when you make a move in lichess.org?

#24

Beautiful architecture. Startups and companies like Netflix should learn from this instead of cargo culting microservices.

And what exactly do you think lila, lila-ws, and redis are if not microservices (or as they should be called, “services”)? Lichess could easily be implemented as a single monolithic process but it is not.

Re: What happens when you make a move in lichess.org?

#25

what happens to those websocket connections when the API is updated or redeployed?

It's pretty easy to build auto reconnect capability in the client. The server will drop all its connections and go out of rotation, and the client will start a new connection and find the new one. If the switch happens fast enough then the user shouldn't even notice.

Re: What happens when you make a move in lichess.org?

#26
post #22
post #21

Earlier quoted context omitted.

You can verify this with ten lines of code and clumsy (a tool for simulating packet loss). I tried this and not all the messages I sent arrived.

What do you mean? If you open a web socket connection it should behave like a normal TCP connection. All sent data guaranteed to be delivered complete and in order, unless the connection fails.

Unless the connection fails, at which point you have no idea when it failed. You know that the other side received all stream offsets within [initial, X] with X ≥ last received ACK, but other than that you have no idea what X is. Even getting the last received ACK value out of whatever API or upper-level protocol you’re using could be nontrivial, because people rarely bother.

Re: What happens when you make a move in lichess.org?

#28
post #20

I wonder why this protocol needs an ack? a websocket wrapped in a tls should be perfectly capable of guaranteeing the integrity of the message

Maybe authorization, illegal moves? Don't know the full protocol to know how they handle edge cases. They might just return a NACK

Re: What happens when you make a move in lichess.org?

#30

Earlier quoted context omitted.

Overly complicated with microservices. Can be made 10x simpler.

Sometimes simplicity is not the best goal. Redundancy, scalability, decoupling, resilience, best possible handling of errors, cost optimization, etc. may be more important at the scale Netflix operates at.

> Redundancy, scalability, decoupling, resilience, best possible handling of errors, cost optimization, etc. may be more important at the scale Netflix operates at.

So much that they built a tool to intentionally make things difficult (read: it arbitrarily stops production system processes/containers/etc.) and help inform what decisions to make in favor of fault tolerance.

> Exposing engineers to failures more frequently incentivizes them to build resilient services.

https://github.com/Netflix/chaosmonkey

https://en.wikipedia.org/wiki/Chaos_engineering

Post reply on HN