RSS Amplifier

Blog

Nitely's blog

Nitely's blog about programming topics, algorithms and then some

nitely.github.ioRSS feed ↗5 posts

Latest posts

HTTP/2 zero latency write coalescing

Write coalescing is an I/O optimization technique where multiple small writes are merged into a single larger write before sending data to the underlying system. In Http/2, we can batch multiple frames from one or more streams and send them all at once. This reduces the number of syscalls, and avoids sending tiny TCP packets under load. Nagle’s Algorithm Most OSes implement Nagle’s Algorithm,...

HTTP/2 in-depth server design

This is a high-level description of nim-hyperx, an HTTP/2 server & client. It may be useful for HTTP/2 implementers and the curious. The core of nim-hyperx is ~1K LoC and can be read alongside this post. This is not an overview of the HTTP/2 protocol. I won’t go over frame types, stream states, flow-control, nor the spec in general. Axioms Frames must be read and processed as soon as...

HTTP/2 flow control deadlock

This is a high-level description of HTTP/2 flow control, potential deadlocks, delays, and how to prevent them. It may be useful for HTTP/2 implementers and the curious. HTTP/2 allows full-duplex communication over a single stream, along with stream multiplexing. This means a peer can send and receive data simultaneously on a single stream and do the same on multiple streams at the same time. ...

HTTP/2 the missing state

There is a missing state in the HTTP/2 spec. Lets look at the closed state carefully: An endpoint that sends a RST_STREAM frame on a stream that is in the “open” or “half-closed (local)” state could receive any type of frame. The peer might have sent or enqueued for sending these frames before processing the RST_STREAM frame. An endpoint MUST minimally process and then discard any frames it...

Regex literals optimization

The regex literals optimization avoids running the regex engine on parts of the input text that cannot possibly ever match the regex. An example of a regex this can be applied to is \w+@\w+\.\w+, where the algorithm quickly finds the first @, then matches \w+ backwards to find the start of the match, and then matches \w+\.\w+ forward to find the end of the match. It then finds the second @, st...