{"id":28941514,"url":"https://github.com/metosin/pohjavirta","last_synced_at":"2025-07-12T18:35:28.466Z","repository":{"id":39755573,"uuid":"187453911","full_name":"metosin/pohjavirta","owner":"metosin","description":"Fast \u0026 Non-blocking Clojure wrapper for Undertow","archived":false,"fork":false,"pushed_at":"2023-04-13T17:19:32.000Z","size":747,"stargazers_count":168,"open_issues_count":18,"forks_count":8,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-05-08T19:09:50.390Z","etag":null,"topics":["clojure","http-server","metosin-experimental","non-blocking","ring"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/metosin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-19T08:50:41.000Z","updated_at":"2024-04-28T15:52:36.000Z","dependencies_parsed_at":"2022-09-20T11:24:25.715Z","dependency_job_id":null,"html_url":"https://github.com/metosin/pohjavirta","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/metosin/pohjavirta","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metosin%2Fpohjavirta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metosin%2Fpohjavirta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metosin%2Fpohjavirta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metosin%2Fpohjavirta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metosin","download_url":"https://codeload.github.com/metosin/pohjavirta/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metosin%2Fpohjavirta/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261397487,"owners_count":23152492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","http-server","metosin-experimental","non-blocking","ring"],"created_at":"2025-06-23T02:10:48.765Z","updated_at":"2025-07-12T18:35:28.445Z","avatar_url":"https://github.com/metosin.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pohjavirta\n\nFast \u0026 Non-blocking Clojure wrapper for [Undertow](http://undertow.io/).\n\n**STATUS:** Pre-alpha, in design and prototyping phase.\n\n\u003ca href=\"https://www.techempower.com/benchmarks/#section=test\u0026runid=42f65a64-69b2-400d-b24e-20ecec9848bc\u0026hw=ph\u0026test=json\"\u003e\u003cimg src=\"docs/img/tfb_json.png\"\u003e\u003c/a\u003e\n\n## Latest version\n\n[![Clojars Project](http://clojars.org/metosin/pohjavirta/latest-version.svg)](http://clojars.org/metosin/pohjavirta)\n\n## Usage\n\n```clj\n(require '[pohjavirta.server :as server])\n(require '[jsonista.core :as j])\n\n(defn handler [_]\n  {:status 200\n   :headers {\"Content-Type\" \"application/json\"}\n   :body (j/write-value-as-bytes {:message \"hello\"})})\n\n;; create and start the server\n(-\u003e #'handler server/create server/start)\n```\n\nBy default, the server listens to `localhost` on port `8080`. Trying with [HTTPie](https://httpie.org/):\n\n```bash\n➜  ~ http :8080\nHTTP/1.1 200 OK\nContent-Length: 19\nContent-Type: application/json\nDate: Sun, 29 Sep 2019 17:50:17 GMT\nServer: pohjavirta\n\n{\n    \"message\": \"hello\"\n}\n```\n\nLet's run some load with [wrk](https://github.com/wg/wrk):\n\n```bash\n➜  ~ wrk -t2 -c16 -d10s http://127.0.0.1:8080\nRunning 10s test @ http://127.0.0.1:8080\n  2 threads and 16 connections\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\n    Latency   106.47us   52.47us   3.20ms   98.73%\n    Req/Sec    70.89k     2.49k   75.84k    79.21%\n  1424471 requests in 10.10s, 199.70MB read\nRequests/sec: 141036.08\nTransfer/sec:     19.77MB\n```\n\nAsync responses, using [promesa](http://funcool.github.io/promesa/latest/):\n\n```clj\n(require '[promesa.core :as p])\n\n(defn handler [_]\n  (-\u003e (a/promise {:message \"async\"})\n      (a/then (fn [message]\n                {:status 200,\n                 :headers {\"Content-Type\" \"application/json\"}\n                 :body (j/write-value-as-bytes message)}))))\n```\n\nWe redefined the handler, so no need to restart the server:\n\n```bash\n➜  ~ http :8080\nHTTP/1.1 200 OK\nContent-Length: 19\nContent-Type: application/json\nDate: Sun, 29 Sep 2019 18:00:35 GMT\nServer: pohjavirta\n\n{\n    \"message\": \"async\"\n}\n```\n\nPerformance is still good:\n\n```bash\n➜  ~ wrk -t2 -c16 -d10s http://127.0.0.1:8080\nRunning 10s test @ http://127.0.0.1:8080\n  2 threads and 16 connections\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\n    Latency   106.86us   33.93us   2.15ms   94.69%\n    Req/Sec    70.41k     2.38k   78.25k    76.24%\n  1414188 requests in 10.10s, 198.26MB read\nRequests/sec: 140017.14\nTransfer/sec:     19.63MB\n```\n\n## Status\n\nWIP. See [issues](https://github.com/metosin/pohjavirta/issues) for Roadmap.\n\n## License\n\nCopyright © 2019 [Metosin Oy](http://www.metosin.fi)\n\nDistributed under the Eclipse Public License, the same as Clojure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetosin%2Fpohjavirta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetosin%2Fpohjavirta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetosin%2Fpohjavirta/lists"}