All Projects → metosin → Pohjavirta

metosin / Pohjavirta

Fast & Non-blocking Clojure wrapper for Undertow

Programming Languages

clojure
4091 projects
ring
36 projects

Projects that are alternatives of or similar to Pohjavirta

Beetlex
high performance dotnet core socket tcp communication components, support TLS, HTTP, HTTPS, WebSocket, RPC, Redis protocols, custom protocols and 1M connections problem solution
Stars: ✭ 802 (+476.98%)
Mutual labels:  non-blocking, http-server
Aiohttp
Asynchronous HTTP client/server framework for asyncio and Python
Stars: ✭ 11,972 (+8512.95%)
Mutual labels:  http-server
Owindog
Owin Web Server(base on libuv) for asp.net or netcore
Stars: ✭ 123 (-11.51%)
Mutual labels:  http-server
R2dbc Mssql
R2DBC Driver for Microsoft SQL Server using TDS (Tabular Data Stream) Protocol
Stars: ✭ 128 (-7.91%)
Mutual labels:  non-blocking
Watsonwebserver
Watson is the fastest, easiest way to build scalable RESTful web servers and services in C#.
Stars: ✭ 125 (-10.07%)
Mutual labels:  http-server
Fs2 Http
Http Server and client using fs2
Stars: ✭ 132 (-5.04%)
Mutual labels:  http-server
Raxx kit
Get started with Raxx + Elixir
Stars: ✭ 120 (-13.67%)
Mutual labels:  http-server
Arduino Timer
Non-blocking library for delaying function calls
Stars: ✭ 133 (-4.32%)
Mutual labels:  non-blocking
Http4k
The Functional toolkit for Kotlin HTTP applications. http4k provides a simple and uniform way to serve, consume, and test HTTP services.
Stars: ✭ 1,883 (+1254.68%)
Mutual labels:  http-server
Apollo
Java libraries for writing composable microservices
Stars: ✭ 1,632 (+1074.1%)
Mutual labels:  http-server
Hapttic
⏩ Hapttic is a simple HTTP server that forwards all requests to a shell script.
Stars: ✭ 128 (-7.91%)
Mutual labels:  http-server
Java Express
🧪 HTTP Framework based on expressjs, no dependencies, simple usage. Can be used to quickly spin up an API or serve local files.
Stars: ✭ 125 (-10.07%)
Mutual labels:  http-server
Robohydra
Testing tool for HTTP-based-API clients
Stars: ✭ 133 (-4.32%)
Mutual labels:  http-server
Qtnetworkng
QtNetwork Next Generation. A coroutine based network framework for Qt/C++, with more simpler API than boost::asio.
Stars: ✭ 125 (-10.07%)
Mutual labels:  http-server
Octane
A web server modeled after express in Rust.
Stars: ✭ 136 (-2.16%)
Mutual labels:  http-server
Socket
Non-blocking socket and TLS functionality for PHP based on Amp.
Stars: ✭ 122 (-12.23%)
Mutual labels:  non-blocking
Dasynq
Thread-safe cross-platform event loop library in C++
Stars: ✭ 127 (-8.63%)
Mutual labels:  non-blocking
Cheroot
Cheroot is the high-performance, pure-Python HTTP server used by CherryPy. Docs -->
Stars: ✭ 128 (-7.91%)
Mutual labels:  http-server
Pure Http
✨ The simple web framework for Node.js with zero dependencies.
Stars: ✭ 139 (+0%)
Mutual labels:  http-server
Vex
Easy-to-use, modular web framework built for V
Stars: ✭ 135 (-2.88%)
Mutual labels:  http-server

pohjavirta

Fast & Non-blocking Clojure wrapper for Undertow.

STATUS: Pre-alpha, in design and prototyping phase.

Latest version

Clojars Project

Usage

(require '[pohjavirta.server :as server])
(require '[jsonista.core :as j])

(defn handler [_]
  {:status 200
   :headers {"Content-Type" "application/json"}
   :body (j/write-value-as-bytes {:message "hello"})})

;; create and start the server
(-> #'handler server/create server/start)

By default, the server listens to localhost on port 8080. Trying with HTTPie:

➜  ~ http :8080
HTTP/1.1 200 OK
Content-Length: 19
Content-Type: application/json
Date: Sun, 29 Sep 2019 17:50:17 GMT
Server: pohjavirta

{
    "message": "hello"
}

Let's run some load with wrk:

➜  ~ wrk -t2 -c16 -d10s http://127.0.0.1:8080
Running 10s test @ http://127.0.0.1:8080
  2 threads and 16 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   106.47us   52.47us   3.20ms   98.73%
    Req/Sec    70.89k     2.49k   75.84k    79.21%
  1424471 requests in 10.10s, 199.70MB read
Requests/sec: 141036.08
Transfer/sec:     19.77MB

Async responses, using promesa:

(require '[promesa.core :as p])

(defn handler [_]
  (-> (a/promise {:message "async"})
      (a/then (fn [message]
                {:status 200,
                 :headers {"Content-Type" "application/json"}
                 :body (j/write-value-as-bytes message)}))))

We redefined the handler, so no need to restart the server:

➜  ~ http :8080
HTTP/1.1 200 OK
Content-Length: 19
Content-Type: application/json
Date: Sun, 29 Sep 2019 18:00:35 GMT
Server: pohjavirta

{
    "message": "async"
}

Performance is still good:

➜  ~ wrk -t2 -c16 -d10s http://127.0.0.1:8080
Running 10s test @ http://127.0.0.1:8080
  2 threads and 16 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   106.86us   33.93us   2.15ms   94.69%
    Req/Sec    70.41k     2.38k   78.25k    76.24%
  1414188 requests in 10.10s, 198.26MB read
Requests/sec: 140017.14
Transfer/sec:     19.63MB

Status

WIP. See issues for Roadmap.

License

Copyright © 2019 Metosin Oy

Distributed under the Eclipse Public License, the same as Clojure.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].