[HN Gopher] GenieFramework - Build web applications with Julia
       ___________________________________________________________________
        
       GenieFramework - Build web applications with Julia
        
       Author : msravi
       Score  : 196 points
       Date   : 2022-04-06 08:45 UTC (14 hours ago)
        
 (HTM) web link (genieframework.com)
 (TXT) w3m dump (genieframework.com)
        
       | blindseer wrote:
       | I would caution someone interested in this to consider some of
       | the ramifications of using Julia / Genie. When I last used it, it
       | was a extremely painful development experience because of the
       | time it took to for Julia to reload when "live reload" was
       | enabled. Further more, many features like authetication were
       | nowhere to be found. Also, startup time for the server was SO
       | large that it just does not work on heroku, even with
       | PackageCompiler. And forget about using AWS Lambdas or Cloudflare
       | pages or something like that. IMO, Rust, Go, Javascript or even
       | Python is a waaayyy better option for this.
       | 
       | Kudos to the devs for continuing this work though. I'm sure it'll
       | get there some day.
       | 
       | If you absolutely want to use Julia because you have an existing
       | Julia code, you can use HTTP.jl instead. It's more lightweight
       | and you can build routes using that into your application.
        
         | sundarurfriend wrote:
         | Adding a couple of responses from Genie's creator [1], when
         | parent commenter mentioned these issues a few months ago, for
         | visibility in case it's helpful to someone here:
         | 
         | > startup time for the server was SO large that it just does
         | not work on heroku
         | 
         | Response: The solution (which granted should be maybe better
         | documented) is to set the `EARLYBIND` env variable to `true` -
         | this will allow Genie to bind to the port very early so Heroku
         | will love it.
         | 
         | > many features like authetication were nowhere to be found.
         | 
         | Response: Genie has built in support for handling (encrypted)
         | cookies and sessions and plugins like GenieAuthentication (or
         | GenieAuthorisation) and SearchLight provide straightforward
         | features. Have you used these?
         | 
         | ----
         | 
         | With that said, I myself do think of Genie as (currently)
         | something to be used when (a) you already have Julia code and
         | need a web front-end for it, or (b) you want to experiment and
         | possibly break things for the potential of expanding horizons.
         | 
         | [1] https://news.ycombinator.com/item?id=29830003
        
       | svnpenn wrote:
       | In regards to startup time, isn't Julia an order of magnitude
       | slower than everything, even Ruby? Why would anyone want this?
        
         | freemint wrote:
         | A webserver spends a minuscule amount of its time in startup.
        
           | freedomben wrote:
           | Startup time in a big Spring Boot or Rails project can easily
           | be two minutes or more. Sadly I speak from experience.
        
         | adgjlsfhk1 wrote:
         | For this use-case, PackageCompiler (for dependencies) + Revise
         | (for your code) fixes that.
        
           | blindseer wrote:
           | This is just not true. Even with PackageCompiler I was
           | getting 30 seconds or more startup time for a medium size
           | codebase with Genie.
        
       | NeutralForest wrote:
       | Good stuff! I think it's important that analyses done in Julia
       | can be presented in dashboard form with Julia tools as well.
       | Having a one language stack is just that much less work.
        
       | melkael wrote:
       | To Genie users, what is your workflow ? I love Julia for
       | scientific computing but the compilation time is a bit of an
       | issue. I would imagine I would need to compile a lot more when
       | doing web dev. How do you work around this ?
       | 
       | If there is a solution to this, Genie would be awesome as I could
       | directly put into production my Julia models without using a
       | third party language.
        
         | huijzer wrote:
         | Have you tried PackageCompiler.jl?
        
           | abstracto wrote:
           | Honestly, this is an area where the op would be far better
           | served by using go/rust/c++ or another backend language. Can
           | launch a server with microsecond latency, and if it grows get
           | good elastic behavior. No awkward route precompilation or
           | thirty minute build times... Julia sure is neat, but this
           | isn't an area where it's strong.
        
             | 0des wrote:
             | I do webdev in Go, and freely recompile as it takes a
             | second or less on my hardware which consists of a rock, a
             | rubber band and two sesame seeds on 20x2 liquid crystal.
             | Its no struggle to recompile 100x in a day just iterating.
        
             | jjtheblunt wrote:
             | microsecond latency? on what exact hardware are you seeing
             | that?
        
               | mirekrusin wrote:
               | Must be new M1 Ultra or something.
        
         | [deleted]
        
         | andyferris wrote:
         | I haven't used Genie (though after this post I am tempted!) but
         | I imagine compilation overhead would only occur once (e.g. the
         | first time each route is used) and that you could pretty easily
         | use precompile statements and/or PackageCompiler.jl to do the
         | compilation before the service goes live. After that point,
         | Julia should have produced fast code and provides a good
         | runtime for these kinds of async/multithreaded applications
         | with built-in M:N scheduling (perhaps a
         | concurrent/multithreaded GC might help reduce tail latency but
         | I imagine it should already be competitive with everything but
         | well-written Rust/C++/C).
        
         | alhirzel wrote:
         | Revise.jl[1] is very helpful for development, as it allows for
         | seamless recompilation without restarts. Cold start can also
         | take a long time, so sometimes it helps to add options[2] such
         | as -O0 when developing. Two paths forward for AOT compilation
         | are PackageCompiler.jl[3] mentioned already in this thread
         | (things like RelocatableFolders.jl[4] come in handy) and the
         | possibility of GPUCompiler.jl[5] some day.
         | 
         | [1]: https://github.com/timholy/Revise.jl
         | 
         | [2]: https://docs.julialang.org/en/v1/manual/command-line-
         | options...
         | 
         | [3]: https://github.com/JuliaLang/PackageCompiler.jl
         | 
         | [4]: https://github.com/JuliaPackaging/RelocatableFolders.jl
         | 
         | [5]: https://github.com/JuliaGPU/GPUCompiler.jl/issues/3
        
         | zorked wrote:
         | I only use Genie slightly to add a simple UI to my projects -
         | I'm no web dev. Time to first request is as terrible as you
         | would expect, but one can then dynamically iterate on a running
         | interpreter by changing and adding pieces, and then it's not
         | that bad as only the new bits need recompilation.
         | 
         | I never tried the fancy to speed up compilation.
        
       | white_dragon88 wrote:
       | This looks utterly bananas. I mean... why. Because variety is the
       | spice of life? How are also those companies using this framework?
        
         | cmrdporcupine wrote:
         | Julia is a fairly elegant nice language and multiple dispatch
         | makes a lot of sense in all sorts of places.
         | 
         | I don't really get why Julia is pigeon-holed for numerics. I
         | prefer its syntax to Python and would consider it for scripting
         | applications where I use Julia now.
        
           | open-source-ux wrote:
           | I also think Julia is a very nice language and I prefer its
           | syntax over Python.
           | 
           | However, I can understand why Julia is "pigeon-holed for
           | numerics". It started as a language for scientific computing.
           | Today, it promotes itself as a general-purpose language
           | suitable for any task - not just for scientific tasks. Only
           | time will tell if perception of the language will shift. As
           | this discussion shows though, the association with scientific
           | computing remains strong.
        
         | qualudeheart wrote:
         | Single language stacks are simpler. For heavy duty webdev tasks
         | you should use a real web language. For simple sites this looks
         | fine.
        
         | clarkevans wrote:
         | Frameworks are helpful when a community would benefit by having
         | a bit less variety in how things are done. Even if it's sub-
         | optimal for most individual use cases, having a standard way of
         | building applications in a community makes it easier to
         | construct and maintain projects.
        
         | FieryTransition wrote:
         | Imagine spending a lot of time on learning Julia, then imagine
         | you want to do web dev, then imagine your favorite language is
         | Julia, and you don't want to use time on learning something
         | else? So why not I guess. From reading the landing page, I
         | don't see a compelling reason to use it unless you are already
         | in the ecosystem, which is fair.
        
         | lf-non wrote:
         | why not ?
         | 
         | People are free to use their time & energy to develop
         | interesting things in whatever language/toolchain/techstack
         | they like and share with the community.
         | 
         | That is how ecosystems evolve, expand, and new ecosystems
         | emerge.
         | 
         | We don't want to be locked into incumbent solutions forever.
         | 
         | Not everything needs to have corporate support or large scale
         | use from day one. It doesn't even have to be useful at all on
         | day one, or ever for that matter.
        
       | epolanski wrote:
       | I'm curious about this project.
       | 
       | Web development benefits a lot from near-instant recompilations,
       | which I heard aren't possible with the Julia programming language
       | as codebases grow. Is that still the case?
        
         | clarkevans wrote:
         | Revise.jl is used to provide incremental runtime recompilation;
         | and Genie now has Revise built-in.
        
           | NeutralForest wrote:
           | Good to know, thanks for pointing it out.
        
       | nancarrow wrote:
       | why? i like Julia but it's not a great general purpose language
       | IMO.
        
       | clarkevans wrote:
       | I'm curious if Julia's multiple dispatch could work naturally for
       | server-side web development. In many content management problems,
       | you often run into pages that are parameterized in multiple ways:
       | the kind of data object being viewed, role based permission, and
       | display capabilities, among others. In object oriented systems
       | this often leads to double dispatch in one way or another. With
       | Julia, it may instead result with an "just ahead of time" compile
       | for each permutation; once that's done, page rendering should be
       | snappy. One could use PackageCompiler to build an image with
       | commonly needed permutations so that each computational unit's
       | startup time is reasonable. During development, Revise.jl
       | provides incremental updates to pages affected via code
       | dependency graph.
        
         | pjmlp wrote:
         | If it works for Common Lisp and C++ [0], it certainly does for
         | Julia as well.
         | 
         | [0] - In C++ you can emulate it via a mix of function
         | overloading and template metaprogramming.
        
         | freemint wrote:
         | > With Julia, it may instead result with an "ahead of time"
         | compile for each permutation;
         | 
         | This would be an odd approach, just have the first person who
         | hits a new combination of function and type pay a few ms of
         | compile time. That should work fine.
        
           | clarkevans wrote:
           | Oh dear. I meant to write " _just_ ahead of time " (I
           | corrected the post above). This is the Julia community's take
           | on "just in time", but taking into account that there isn't
           | an interpreted fallback. Exactly when a new type
           | specialization is used, it is compiled then and there.
        
             | dTal wrote:
             | >there isn't an interpreted fallback
             | 
             | julia --compile=no
        
       | logankilpatrick wrote:
       | Folks might be interested in:
       | https://www.freecodecamp.org/news/how-to-build-web-apps-in-j...
        
       ___________________________________________________________________
       (page generated 2022-04-06 23:01 UTC)