Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Web Development with Julia and Genie

You're reading from   Web Development with Julia and Genie A hands-on guide to high-performance server-side web development with the Julia programming language

Arrow left icon
Product type Paperback
Published in Nov 2022
Publisher Packt
ISBN-13 9781801811132
Length 254 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ivo Balbaert Ivo Balbaert
Author Profile Icon Ivo Balbaert
Ivo Balbaert
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Part 1: Developing Web Apps with Julia
2. Chapter 1: Julia Programming Overview FREE CHAPTER 3. Chapter 2: Using Julia Standard Web Packages 4. Chapter 3: Applying Julia in Various Use Cases on the Web 5. Part 2: Using the Genie Rapid Web Development Framework
6. Chapter 4: Building an MVC ToDo App 7. Chapter 5: Adding a REST API 8. Chapter 6: Deploying Genie Apps in Production 9. Chapter 7: Adding Authentication to Our App 10. Chapter 8: Developing Interactive Data Dashboards with Genie 11. Index 12. Other Books You May Enjoy

Why Julia is a good fit for web development

Web development using Julia is very popular because of the following:

  • The app needs to be deployed only on the server, not on an unknown number of clients, so the effort to put an application into production is minimal. This is true for all backend programming languages. To execute the app, you have the choice between installing a Julia runtime on your server or building a standalone executable with PackageCompiler.jl.
  • Powerful web frameworks exist. This is certainly the case for main-stream dynamic languages, for example, Ruby on Rails, Django (a Python framework), or Phoenix (an Elixir framework). But Julia also saw the development of powerful web frameworks in recent years (we will discuss this more in Part 2), especially the Genie framework.
  • Data scientists want to show the results of their research online in a visual and interactive fashion. Here, Julia, being a scientific and technical computing language, really shines.

Let’s look at some important app properties and evaluate how Julia performs at these so that it becomes clear why Julia is a nice fit for web backend development and for exposing web services:

  • Speed: Response speed is always of the utmost importance, no matter the kind of app you’re running. Commonly used programming languages to develop web applications, such as PHP, Ruby, and Python, are interpreted languages. Typically, they are compiled to bytecode, which is deployed to a production machine where it is run on a virtual machine (VM). This VM translates the bytecode to machine code. This causes apps written in these languages to fall behind in certain benchmarks, so performance can be an issue.

Julia on the other hand is known for its excellent execution speed, because of its JIT compiler and highly optimized machine code generated through LLVM. That’s why Julia often stays within the 2x range from optimized C code while outperforming dynamic languages with orders of magnitude (see https://julialang.org/benchmarks/ and https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/julia-python3.html).

Because of the JIT compiling stage, the startup of an application takes some time, which is sometimes called the JIT latency. So, often, the first execution of Julia code will take longer because execution waits for the compilation process. While this would be a problem for games or real-time apps, it is not an issue when developing web backends, which is a typically long-running process. Also, you can add a startup phase in which all your important code gets precompiled before exposing the app to users.

  • Garbage collection: The freeing of memory through the GC will be less noticeable on a server. Its effect is spread out over all client processes. See the previous How Julia works section, for some advice here.
  • Scalability: If your web app has an ever-growing number of users, you’ll likely run into problems sooner or later. Julia is designed for concurrent/parallel and distributed execution, which makes it highly scalable and thus particularly suited for running massive apps with many users. If your web application requires heavy calculations or can come under a heavy load, Julia will make a great difference.
  • Platforms: Because LLVM is used under the hood, Julia runs on very diverse platforms (see https://julialang.org/downloads/#currently_supported_platforms).
  • Functional: Julia’s emphasis on functions makes Julia a good choice for developing web services, which are typically function-oriented.

An ecosystem of libraries: Another of Julia’s advantages over competing languages is that libraries can be combined and extended very easily. This allows for more code reuse, which means less time and effort is needed in Julia to develop a web app as in the competing language frameworks. Moreover, all Python libraries can be used via PyCall.jl, so in case no existing Julia package meets your need, you can use an appropriate Python library. The same goes for R with Rcall.jl, and Java/Scala with JavaCall.jl. Also, Julia can call C code directly, without any libraries needed.

We can conclude that Julia’s performance and scalability characteristics and its extensive number of packages for visualizing data make it an excellent fit for the development of web apps, web services, and web dashboards.

You have been reading a chapter from
Web Development with Julia and Genie
Published in: Nov 2022
Publisher: Packt
ISBN-13: 9781801811132
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image