A Load Balancer from scratch - Liz Rice, Isovalent

Поделиться
HTML-код
  • Опубликовано: 3 окт 2024
  • Let's see how an eBPF Load Balancer works by writing one in a few lines of C code

Комментарии • 30

  • @DucNguyen-l7f
    @DucNguyen-l7f Месяц назад

    IT WAS ACTUALLY AMAZING, KEEP ON THE GOOD WORK
    FROM A STUDENT FROM VIET

  • @GlassFamFishing
    @GlassFamFishing Год назад +4

    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.

  • @dincerbeken5761
    @dincerbeken5761 10 месяцев назад +2

    absolutely fantastic

  • @sandeepkulambi7924
    @sandeepkulambi7924 8 месяцев назад

    Excellent video, packing wealth of information in 17mins.

  • @ahahTl
    @ahahTl 2 года назад +2

    Very interesting and helpful. thank you.

    • @eBPFCilium
      @eBPFCilium  2 года назад

      We are glad you like it :)

  • @DanCave
    @DanCave 3 года назад +4

    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_ 3 года назад +3

      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 3 года назад

      @@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
    @46september 4 месяца назад

    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.

  • @malbolgee
    @malbolgee 2 года назад +3

    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

  • @TianLi-q5v
    @TianLi-q5v Год назад

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

  • @kafirboysrock
    @kafirboysrock 2 месяца назад

    Which ide is this?

    • @LnX53
      @LnX53 Месяц назад

      visual studio code

  • @dces4212
    @dces4212 3 года назад

    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 года назад +4

      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 2 года назад

      @@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.

    • @GlassFamFishing
      @GlassFamFishing Год назад

      @@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.

    • @GlassFamFishing
      @GlassFamFishing Год назад

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

  • @perfectalgos9641
    @perfectalgos9641 2 года назад

    Can you please share the code or repo?

    • @eBPFCilium
      @eBPFCilium  2 года назад +1

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

  • @QueLastima
    @QueLastima 2 года назад

    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 Год назад +6

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

    • @GlassFamFishing
      @GlassFamFishing Год назад +2

      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 Год назад +1

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

    • @QueLastima
      @QueLastima Год назад +1

      @@GlassFamFishing 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 5 месяцев назад +2

      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