A friendly introduction to Serverless Architecture and Why we built jerverless?

Image for post
Image for post

Earlier most of cloud applications were designed by following the monolithic architectural pattern which simply means all components(let’s say some common app modules like authentication , dashboard services..) of a specific cloud software are packaged in to a big single module. And that big module was deployed to a bare metal server, or later in to virtual machines.

So people were thinking more about maintainability, expandability and of course resiliency. Microservice architecture got popularity instantly. They have decomposed business logic in to several microservices and deployed (Remember Docker) those and managed scaling (Remember Kubernetes). Simply microservice is a running container (not a VM but somewhat similar ) also holding the module logic. So serverless computing is an approach to decompose microservice’s app module further. But we cannot say clearly it is an approach to decompose microservice’s execution environment further.

The name, because we don’t think too much about infrastructure, whereas we consider too much about its source code. Serverless function is just like normal function in a specific programming language but it can be triggered via a HTTP request.

Image for post
Image for post
Serverless architecture example

Working with serverless functions is very easy. There are popular infrastructure providers who are offering serverless computing for your needs,

  • AWS — offers AWS Lambda
  • Google — offers cloud functions
  • Azure — offers Azure functions

If you are having your own servers (We usually tell a “private cloud”) there is no need to rely on above third party providers. Something like OpenFaas gives a good solution for on-premise Kubernetes based serverless environment.

Why Jerverless

Jerverless (Java Serverless) is simply a serverless function runner written in Java (without any third party dependencies) with highlighted features as per below.

  • Seriously! you can write an on-premise serverless functions using even bash scripting, any executable or a script of course.
  • Bidirectional piping — So your serverless function is completely independent from jerverless runtime.
  • Containerizable — Able to deploy function regardless of abstraction level. Deploy in to docker, Kubernetes or even in to a machine.
  • Testing is easy — Since your function is having normal STDIN and STDOUT. Can you test in termial?
Image for post
Image for post
Jerverless architecture

In jerverless there is a multi threaded web server which will pipe POST data in to STDIN and which will send back STDOUT as the response.

Let’s write a simple function

Write greet.py

Download python Dockerfile and jerverless.properties configuration file.

Add your file name to config file

exec = python greet.py
port = 8080

Build docker image

sudo docker build --no-cache -t jerverless .

Run docker image

sudo docker run -it -p 8080:8080 jerverless

This will start jerverless function runner with a shell. Enter help and see supported commands

Image for post
Image for post
Jerverless shell

We know now jerverless is running. Let’s hit curl and check!

curl -d Apple localhost:8080/function

You will see obviously Hello Apple!

Also when there is an error with the given program. it will show up in the shell

Image for post
Image for post


Jerverless is open source and there are only two contributors right now. If you feel interesting Please keep eye on issue tracker and send us a pull request. You will be added to jerverless organization.

Happy Coding!

Written by

Software Engineer at 99x | Apache PMC member | Open Source Contributor (Author of Neutralinojs) | Technical Writer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store