I have a small homelab running a few services, some written by myself for small tasks - so the load is basically just me a few times a day.

Now, I’m a Java developer during the day, so I’m relatively productive with it and used some of these apps as learning opportunities (balls to my own wall overengineering to try out a new framework or something).

Problem is, each app uses something like 200mb of memory while doing next to nothing. That seems excessive. Native images dropped that to ~70mb, but that needs a bunch of resources to build.

So my question is, what is you go-to for such cases?

My current candidates are Python/FastAPI, Rust and Elixir, but I’m open for anything at this point - even if it’s just for learning new languages.

  • Ben Matthews@sopuli.xyz
    link
    fedilink
    arrow-up
    5
    arrow-down
    1
    ·
    9 days ago

    Scala compiles either to native, js or jvm - obviously the IO / interface options vary between these envs, but the lang is the same. Recently Scala 3.5 incorporates a simple-to-use CLI which makes it easier to compile to native (or just run a small file as a script, or experiment with a repl), native binaries are small and fast, and there are some simple io libraries. Since you can also compile to jvm to interop with java, that might help with transition.

    • leisesprecher@feddit.orgOP
      link
      fedilink
      arrow-up
      1
      ·
      9 days ago

      But that would mean either using Graal/native image or going full Scala, right?

      I only used Scala for Gatling, where it’s obviously very java-y.

      • Ben Matthews@sopuli.xyz
        link
        fedilink
        arrow-up
        3
        ·
        9 days ago

        Indeed to use scala-native you’d need pure-scala libraries, but the core lib re-implements most java lib, and there are now small simple external libs available for common tasks like file management, database, etc. - for example check out the lihaoyi suite.
        I mainly use scala-js (to make this) which was formerly a java app - as it compiles to both js and jvm (cross-project) can gradually convert stuff you already wrote. I’ve tried native for stuff like pre-processing data files.