A very unscientific benchmark of Crystal HTTP Server vs Deno http Server

Both use the standard library, compiled to a unix executable & ran on a $5 VPS (1 cpu core, 1gb ram) using pm2 for the delivery & wrk to test. Completely unscientific, but there you go. Could probably be faster, Kemal might make it faster?

Simply delivers ‘Hello World’ in the test.

I have found pm2 works well with Crystal I have not tried ‘cluster mode’, which I believe is Node specific.

Port 3000 is Crystal, Port 8000 is Deno.

TLDR: Crystal is about 4x faster for a very basic unscientific test & uses about 8mb ram vs 50mb-80mb ram for Deno.

All below are 1gb 1v cpu on Vultr $5.

Deno HTTP 8000 Crystal HTTP 3000

Deno HTTP 8000 Crystal HTTP 3000

Kemal HTTP only

1 Like

Crystal $5 Vultr VPS using to_json

A Vultr 8 CPU/16GB Ram machine running Debian

require "http"
require "http/server"
require "json"

server = HTTP::Server.new do |context|
  method = context.request.method
  path = context.request.path
    if path == "/"
      context.response << "
      <html><body><h1>Hello world</h1><p>This is a html reply</p></body></html>
    if path == "/json"
      context.response << "Hello World".to_json

The code for the below test. I only ran Crystal in this test.

6 core 32gb ram dedicated machine E-2286G - Crystal code only

1 Like

8 core 32gb ram dedicated machine -

Deno is far slower in this pretty useless test. Both Deno & Crystal were compiled on the server and ran with PM2.

Deno using Deno HTTP

Crystal using HTTP server

Before running

After running

1 Like

If you wrote this with HTTP::Server, Kemal won’t be faster. It is also implemented in terms of HTTP::Server. The performance difference is pretty impressive, though[1], considering Deno’s HTTP server (which is presumably most of the code in the Deno benchmark) is written in Rust.

[1] I’d caution against posting benchmarks with concurrency settings that high in wrk making requests to localhost. It goes beyond simply “unscientific” and diminishes the impact of the point you’re trying to make. The default -c10 is usually enough and your benchmarks show the steeply diminishing returns you’ll get when you exceed a reasonable concurrency for the workload.

1 Like

I did a Kemal test it’s in the very first post, it was just faster than the Deno server. This thread is a bit of a mess, I was just sorta popping whatever came out into a comment :sweat_smile:

I think Deno is actually slower than Node right now (from what I have seen), uses more memory too, but I believe the Deno focus is more on short lived serverless functions and quick boot times.

Really useless test, I would want to test one server flooding another server that had the HTTP servers, if that is possible.

1 Like