What's the Best RESTful Web API Framework – Part 2

By
Tim Gray
July 21, 2016
APIBlogBanner


Welcome to Part 2 of the great RESTful framework showdown! You can read Part 1 here. I’m your host Tim Gray. Today our framework requirements. Then we will get to know the frameworks a little better. These frameworks run on the platforms so we’ll have a look at those too. Let’s get straight into it!

Framework Requirements

There are a number of core functions that are required for an OptimalBI API. These functions are mostly about gathering data to a single access point, and providing data in an easy, accessible, and secure way of accessing data across distributed systems. We will also be using the API as an abstraction point so that the versioning of back-end and front-end systems are not coupled together. This in mind we have a number of services that we use and that the web API framework must connect to:

  • Optimal Data Engine (ODE) running under SQL Server 2014.
  • DynamoDB
  • Redshift
  • S3 via the AWS SDK
  • AWS Lambda
  • Neo4J
  • Other HTTP Endpoints

If a framework connects to all these services it will work for us. There is also one other concern that must be addressed with a public facing service; security. We have blogged about using a SAML single sign-on system as one of the options to secure web facing applications. Our web framework should also support this security system.
The other requirement is for local system resources. The framework must work under the limitation of a t2.nano (although this will be bigger in production), which means a limit of 512mb of ram and 1 vCpu (burstable). The target OS is the Ubuntu 14.04 x64 AWS AMI.

A Closer Look at the Frameworks

In the last blog, we listed the frameworks that we will be taking a closer look at over the duration of this research. We will now take a closer look at the frameworks and what they claim to do.

ASP.Net Core

Since 2002 developers have had access to ASP.Net to develop web software using Microsoft’s .Net framework and any supported .Net language. There is a problem with ASP.Net now that the software development world uses the cloud to support most web services hosting, that problem is Windows. Most cloud systems are clusters of smaller machines that get jobs distributed to them and work together to provide a highly available system. This is a problem if your server’s operating system has a high overhead or a pricier license fee. These are issues for Windows and Windows Server.
Microsoft’s solution to this is to start moving the .Net Framework to .Net Core, a multi-platform open-source framework that allows ASP.Net and other .Net programs to be built to run on Linux. This has put ASP.Net Core in our sights and now is the time to look closer at what ASP.Net Core can offer us.

AWS API Gateway with AWS Lambda

AWS API Gateway is an offering from Amazon Web Services. It allows developers to create a web service layer independent of any servers. We will have access to a powerful compute layer thanks to AWS Lambda which is now available in Sydney. This will allow us to create serverless API’s that scale automatically, which is very cool.

Spring (Java)

Spring is an open-source framework that allows Java developers to create web services in a bunch of different ways using a selection of modules that provide different functionality. Technically Spring is an inversion of control framework but it is often used to create modern web based applications. First released in October 2002 it is one of the most mature frameworks we are looking at.

Express (Node.js)

Express is quickly becoming one of the most popular frameworks to quickly build dynamic web applications. Node.js provides web developers with a language they understand for server-side development (JavaScript). It was a very easy framework to adopt and a quick one to develop in.

Loopback (Node.js)

Loopback is one of the more dynamic node.js based web frameworks. It is currently being built by StrongLoop and IBM. They are aiming to provide a full feature web framework that is well tested and ready to drop straight into a production stack. It will be able to work in either a self-hosted or hosted in a managed environment.

Restify (Node.js)

Restify aims to be a cut-back, well-formed version of Express. Express has many features in regards to rendering HTML and providing dynamic pages to users. Restify aims to provide a very clean and lightweight tool to create RESTapi’s and web socket based applications.

Django (Python)

Django is an open source web-framework for python developers. It is designed to create complex database driven web pages and has a principle of reusable code in modules. It has many features including data and caching tools.

Flask (Python)

Flask is the lightweight choice for developing RESTapi’s in python. It has very little impact on system resources and provides very easy methods to provide information as HTTP endpoints in a format easy to read by the recipient. It also includes HTML templating but no other features (out of the box).

Ruby on Rails

Ruby on Rails is a web application framework for ruby developers. It is a model view controller based framework to render webpages and web services. Using the RubyGems system, it can have one of several thousand of packages added to it easily providing many functions for little development.

Stage One – Platform Analysis

In this section we will look at each framework and its functionality on the desired platform, AWS EC2 t2.nano running AWS AMI Ubuntu 14.04

ASP.Net

The only reason that ASP.Net made it onto the initial list was because dotnet core 1.0 was released in late June of 2016. While ASP.Net 4.6 is the mature iteration of ASP.Net it does not run on Linux. ASP.Net Core 1.0 does run on Linux. The difference is that it is not considered a mature framework. Running a quick test in on the test environment machine shows that ASP.Net runs just fine (using a little more memory than I would have liked) so ASP.Net passes this stage.
Result: Pass

AWS API Gateway

AWS API Gateway is platform-less (or as much as we care) and uses Lambda as an execution engine (again the platform is abstracted away from us).
Result: Pass

Spring (Java)

Java works well on Linux and has no problem here.
Result: Pass

Node.js Frameworks (Express, Restify, Loopback)

Node.js works fine on Ubuntu 14.04 so is an easy pass here.
Result: Pass

Python Frameworks (Django, Flask)

Python is working well on Ubuntu 14.04.
Result: Pass

Ruby on Rails

Installing ruby is annoying on Ubuntu due to Ruby not existing in the package manager system. Even so, this works fine.
Result: Pass

Results

Framework

Pass/Fail

ASP.NetPassAWS API GatewayPassJava on SpringPassNode.js on ExpressPass Node.js on LoopbackPassNode.js on RestifyPassPython on DjangoPassPython on FlaskPassRuby on RailsPass

All our frameworks pass with very little trouble! Stay tuned to see if they will survive the next stages – Functionality Analysis and Development Resource Analysis!
Coffee to Code – Tim Gray
Tim blogs about the sharp end of code and the languages it is written in.
You can read What’s The Best Restful Web API Framework Part 1, Part 3, Part 4, Part 5 and Part 6 to get the whole picture

Tim works on a lot of things here at optimal and writes blogs on a wide range of topics.

Connect with Tim on LinkedIn or read his other blogs here.

Copyright © 2019 OptimalBI LTD.