A Load Balancer from scratch - Liz Rice, Isovalent

Ғылым және технология

Let's see how an eBPF Load Balancer works by writing one in a few lines of C code

Пікірлер: 28

  • @GlassHouseAdventures
    @GlassHouseAdventures Жыл бұрын

    I’ve watched this a few times now. It was great and was a huge help for me getting started with my XDP/BPF adventures.

  • @eBPFCilium

    @eBPFCilium

    Жыл бұрын

    Glad you like it!

  • @dincerbeken5761
    @dincerbeken57617 ай бұрын

    absolutely fantastic

  • @sandeepkulambi7924
    @sandeepkulambi79246 ай бұрын

    Excellent video, packing wealth of information in 17mins.

  • @jeremyko1765
    @jeremyko17652 жыл бұрын

    Very interesting and helpful. thank you.

  • @eBPFCilium

    @eBPFCilium

    2 жыл бұрын

    We are glad you like it :)

  • @user-jx8zx3yn2u
    @user-jx8zx3yn2u Жыл бұрын

    Can I use iph_csum to recalculate the ICMP/TCP/UDP's checksum?

  • @malbolgee
    @malbolgee2 жыл бұрын

    Amazing! Is it possible to redirect TCP paackets from a port X to another port Y in the same machine using eBPF?

  • @eBPFCilium

    @eBPFCilium

    2 жыл бұрын

    Yes, you could have an XDP program that checks if the packet is TCP, then updates the port before directly in the packet before it reaches the kernel stack

  • @DanCave
    @DanCave2 жыл бұрын

    This is very cool.. I had often wondered how difficult it would be to do this in code. I am presuming that writing the same code using GoLang would be similar and easier?

  • @lizrice_

    @lizrice_

    2 жыл бұрын

    The golang compiler doesn't currently support building BPF objects - at the moment the choices are C and (pretty recently) Rust. (I'd imagine that it would be a challenge to get Go's runtime past the eBPF verifier, too.)

  • @omarmihilmy

    @omarmihilmy

    2 жыл бұрын

    @@lizrice_ but you should be able to attach the complied BFP XDP program from the Go user space to the netlink socket?

  • @kamran1992

    @kamran1992

    Жыл бұрын

    Diplomatic

  • @46september
    @46september2 ай бұрын

    I understand that this a basic implementation, but for a large HTTP request, do we not need to forward all the packets to the same backend ? With this implementation, it will randomly distribute packets among the backends. So we need some stickiness to map a particular HTTP request to a particular backend server.

  • @dces4212
    @dces42122 жыл бұрын

    15:15 It seems that the long waiting for reply is caused by packet being unintentionally dropped. Does anyone know the root cause of this? Thanks!

  • @aarondesouza75

    @aarondesouza75

    2 жыл бұрын

    I believe this is caused by the simple load balancing algorithm that is being used (remember it's only a demo). The algorithm decides which backend to send a packet to based on the time the packet is being processed. So imagine when the client makes it's request, it starts by sending a SYN which is forwarded by the load balancer to, say, backend A. Backend A will send a SYN-ACK which the load balancer will forward to the client. The client will then respond with an ACK. Now depending on the time the load balancer processes this packet it may send it to backend A or backend B, if it decided to send it to backend B then the TCP connection won't have been established and retransmissions will occur. The same when the client sends the HTTP request, it may go to backend A or backend B.

  • @QueLastima

    @QueLastima

    Жыл бұрын

    @@aarondesouza75 Do people really need to code at this level anymore? It's interesting, but I wouldn't want to start writing a load balancer.

  • @GlassHouseAdventures

    @GlassHouseAdventures

    Жыл бұрын

    @@QueLastima it just depends on what you are into. There are several people still coding at this level building on top of current load balancers or working on building “better” ones that implement various integrations that their company may need or would like.

  • @GlassHouseAdventures

    @GlassHouseAdventures

    Жыл бұрын

    @@QueLastima if you look at libbpf, people are updating that all the time. And that was built to try and make bcc more portable.

  • @kafirboysrock
    @kafirboysrockКүн бұрын

    Which ide is this?

  • @perfectalgos9641
    @perfectalgos96412 жыл бұрын

    Can you please share the code or repo?

  • @eBPFCilium

    @eBPFCilium

    2 жыл бұрын

    It's here: github.com/lizrice/lb-from-scratch

  • @QueLastima
    @QueLastima Жыл бұрын

    This was made in... 2021. ...And you need to code a load balancer in C? Something is terribly wrong here. Aren't there already mature tools for this? Ugh.

  • @LizRice

    @LizRice

    Жыл бұрын

    This is a demonstration to illustrate eBPF / XDP - it's not intended to be a production-ready tool!

  • @GlassHouseAdventures

    @GlassHouseAdventures

    Жыл бұрын

    I like c. I don’t see anything wrong with using it to write a load balancer. Especially since you are looking for speed.

  • @QueLastima

    @QueLastima

    Жыл бұрын

    @@LizRice Noted. Sorry - it is an interesting exercise.

  • @QueLastima

    @QueLastima

    Жыл бұрын

    @@GlassHouseAdventures It is an interesting exercise, but I'd be really wary of putting my own load balancer in a production environment I cared about without a lot of QA testing.

  • @ChuppaChuck

    @ChuppaChuck

    3 ай бұрын

    Load ballancers are not the only use for EBFs... It's just an example to show what you can do with EBF running in the kernel

Келесі