Mehdi Akiki

Posts tagged "python"

  • Published on

    Investigation · Part 9 of 10 · Following a TCP connection

    What a TLS Handshake Costs

    On loopback a TCP connect costs tens of microseconds and a TLS 1.3 handshake costs about one to three milliseconds. I counted the records, the bytes and the CPU on both sides, compared an RSA and an ECDSA certificate, measured resumption, and found 42 ms that were not TLS at all.
  • Published on

    Investigation · Part 4 of 10 · Following a TCP connection

    Why recv() Returns Less Than You Asked: TCP Is a Byte Stream

    Three send() calls arrived in one recv(), and one send() of 1 MiB arrived in seventeen. TCP keeps the bytes and their order, not the boundaries between your writes. I broke a small JSON reader with two inputs and fixed it with a length prefix and with lines.
  • Published on

    Investigation · Part 1 of 10 · Following a TCP connection

    What Happens When Your Program Calls connect()

    On my laptop connect() returns in about 8 microseconds, and the same call can also block for 133 seconds. I followed it with strace and ss: the handshake that the kernel does alone, a port where nobody listens, and a server that never answers.
  • Published on
    The right way to learn Kafka is to build a tiny log broker — not a fake queue with ack/delete. One topic, one log file, one offset per consumer group. That is the whole model.
  • Published on
    Exploring Python's dataclasses module - a decorator that automatically generates boilerplate code for classes that primarily store data, making them perfect for clean, readable data structures.