A 1.5MB Java Container App? Yes you can! by Shaun Smith

Поделиться
HTML-код
  • Опубликовано: 14 окт 2024
  • Containers are increasing the way Java applications are packaged and deployed. There are lots of qualities desirable in a containerized application like fast startup and low memory and CPU requirements, but size and security are also important considerations. Moving big container images around a network will increase the time it takes to start up a new K8s pod or launch a container, and "just enough operating system" container images with reduced attack surface area are also preferable. So what’s the smallest possible Java container image? In this session we’ll demonstrate how to build containerized Java applications small as a mere 1.5MB! Using GraalVM Native Image ahead-of-time compilation and static linking with musl libc we can shrink down and strip out all the unnecessary bits that bloat a typical Java apps and deploy them in lightweight and security focused container images like Alpine and distroless-even scratch!
    SHAUN SMITH
    Shaun leads product management of GraalVM at Oracle Labs where he focuses on Java Cloud Native technologies and frameworks. He’s participated in a number of open source projects including the Fn Project, various Eclipse Foundation projects, and GraalVM. He is an experienced speaker who has presented at JavaOne/CodeOne, Devoxx, QCon, JAX, EclipseCon, and many other developer conferences and user groups around the world.
    ------------------------------------------------------------
    INTRO
    visuals & editing by @Mercator
    music : Avocado by Ephixa

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

  • @LewisCowles
    @LewisCowles 2 года назад +6

    1.5MB container 🙀 pretty amazing, but also

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

    Very informative. Thank you for the amazing talk.

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

    Amazing and very expiring,
    thank you!

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

    This was super interesting. Thank you very much for the talk.

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

    IT'S ALWAYS THE UNDERRATED VID THAT'S LEGIT! THANK YOU!

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

    Great video! Thanks!

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

    can this means embedded can now run containerized apps?

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

    Thank you so much ❤

  • @drac.96
    @drac.96 2 года назад

    Nice intro!

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

    There is a balance to be struck between reusable layers in container image vs a single small blob which is not reusable. If you are trying to optimize for total storage space and network io for 100s of Java app container images then buildpacks built containers would be more efficient. Put another way, for your company's internal apps, which can all use a homogeneous stack, buildpacks based approach is better suited.

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

      Container images are layered. If a particular layer is present in multiple images, it is stored on disk just once. When you are pulling a container image from remote registry, the registry first sends the list of layers in that image along with their hash. Based on the hash, you know which layers you already have and only download the layers you don't have.
      In a company, you typically have many variants of the same app (different versions with slight difference) and different apps with similar stack. In both bases there is a huge opportunity for layer reuse. The OS and JVM layer can be same across all apps. The Library layer would be different across apps but it does not change very often across different versions of the same app. So that leaves just classes layer which changes across app versions. The classes layer is very small anyway. So when pulling a new version of an image you are only spending storage and network I/O for the classes layer which is very small - few KBs to single digit MBs
      On the other hand, with Graal VM, JVM + lib + user code is all condensed into blob of several 10s of MBs. This blob is going to have a different hash for slightest of change. Hence, the blob layer cannot be reused. If you have CI/CD, every commit is going to cost several 10s of MB of storage in the container registry.
      For this reason, optimizing for size of individual container image is short sighted.

  • @savire.ergheiz
    @savire.ergheiz Год назад +3

    Years ago hello world app size no more than a few KB 😁
    Yet they feels like they reach holy grail of coding here 😁

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

      A few kb hello world in a language that compiles to a certain arquiteture is not hard. A few mb in java that runs in java virtual machine which runs in a container is pretty amazing. When you see that a small contained s.o. usually is 80 mb, you can see why this is an achievement.

    • @savire.ergheiz
      @savire.ergheiz Год назад

      @@RonaldoTalison Nah its still a hello world app no matter how you sees it.
      It will be bloated once they add deps into it. You can sugar coated it as much as you want but no sane dev will use it as a comparison in real world apps measurement its just useless.

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

    👌 👏

  • @AliBigdeli
    @AliBigdeli 2 года назад +4

    What is the problem with C, I’m not a C developer but all these optimizations can be done just with GCC capabilities …

    • @BartoszRybacki0
      @BartoszRybacki0 2 года назад +15

      The problem is that you have a big java ecosystem, and now you have a special need to create a small container (function as a service or something like that). If you have Java developers, working with java, and using with nice java libraries doing real stuff then you will not create a C program to access this java library. But this is only needed for some special cases. Most of the time you start java once, give it many cores, big memory and it runs, faster and faster.
      BTW: I would choose "go" over "C" when in need of something simple and with small footprint. No need to use a language that is just a syntax sugar for assembler (I mean C).

    • @keyboard_toucher
      @keyboard_toucher 2 года назад +8

      The problem with C is that it's a much worse language than Java for high-level applications

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

      Gazillion of lines of code has been written for big businesses. They won't invest money because another language is better. There is always something better. So Java evolves with time.

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

      C was too OP. They had to invent bloat to then debloat over time making you think things were getting faster.

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

    First comment ¯\_(ツ)_/¯

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

    Where is it on github ?

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

    nice speech but i havent got graalvm working on any of my machine.... pretty useless ....

    • @terribleprogrammer
      @terribleprogrammer 6 месяцев назад

      Use docker. That's the easiest way to get these running.