Fork me on GitHub
Ferdinand Beyer10:02:31

Finally got around to publish to Clojars: v0.0.49 is available now! refx is a port of re-frame without Reagent, bringing re-frame’s elegance to next-generation React wrappers such as Helix or UIx. Thanks to @rome-user (GitHub handle, not sure if they’re in Slack) for fixing a bug in reg-sub!

👍 33
clojure-spin 18
clojars 8
👏 4
🎉 5

Thanks for your work Ferdinand. I've ported some reitit/re-frame examples to refx as well, if anyone is interested in more samples. The port was 1:1 when looking at re-frame vs refx code:

👍 4
❤️ 6

clojure-lsp Released with fixes, performance and behavior improvements 🎉 There are improvements in hover being able to follow :arglists for documentation, support for cljs docs search on clojuredocs, big performance improvement in completion and more improvements! More details in #CPABC1H61 Thank you for all sponsors and ClojuristsTogether clojurists-together💙

🎉 45
clj-kondo 19
clojurists-together 5
clojure-lsp 1
mpenet21:02:46 0.1.13 is updated with the latest Nima release (requires java19+Loom preview)

🎉 11
Tomas Brejla13:02:41

I understand Nima is still relatively new & alpha. But still, I was curious to try apache benchmark against it (or mina). And I was surprised that no matter what value I used for "concurrency" (`-c` ), the benchmark resulted in identical results (total time, requests per second,..) Also the request per second number wasn't too great: ~ 25k req/s on relatively beefy laptop. I've seen better results on "regular old servers" such as httpkit etc. Does benchmarking using ab makes even sense against Nima/Mina? Is is some specific configuration needed in order to get better results?


I recall one benchmark showing 800k req/s on an early nima release, matching the netty impl. of helidon. So I suppose that's likely a config issue and maybe some system level tweaks needed to get there. I haven't run any benchmarks yet myself, but I try to make the code not be wasteful (there are more low hanging fruits, but I don't want to focus on that right now, while in alpha).


if you look at the code involved for reading a req and writing a response it's very thin, I doubt mina is very far from Nima. One thing I will introduce at some point is some "lazy" maps a bit like in aleph to cut down this further, field access would just defer to the underlying method calls and potentially cache values upon access. But not right now.

Tomas Brejla14:02:05

it's definitely a problem in mina, I got same results with some nima example project (maven + java)


what do you mean? same result with Nima and Mina? or very different ones

Tomas Brejla14:02:26

same results 1. (need one more dependency to be added to pom.xml to work) 2. example hello world server using mina both gave me ~25k req/s using ab, at both cases it made no difference when I increased concurrency level


right. well, that could be caused by many things, some config tweaks needed in mina/nima itself or OS level (ulimit & co)

Tomas Brejla14:02:04

I tried checking ulimits and stuff as well, but nothing fishy there. I'll check that TexhEmpower link you mentioned above. Thanks.


I could try to ask the authors to give me some hints on how they achieved 800k for their presentation, they are quite responsive/helpful

👍 2

(there's a helidon slack fyi)

👍 4
Tomas Brejla14:02:46

I'll also try using different tools than ab - or at least check if my distro has the up-to-date version


well ab should be able to go further than 20k r/s, I strongly suspect it's not the issue 🙂

Tomas Brejla14:02:52

it's strange, here's a quick "repro"

(ns httpkitserver.httpkitserver
  (:require [org.httpkit.server :as http]
            [s-exp.mina :as mina]))

(defn app [_req]
  {:status  200
   :headers {"Content-Type" "text/html"}
   :body    "hello HTTP!"})

  ;; httpkit start/stop
  (def server
    (http/run-server app {:port 8080}))
  ;; ab -c 8 -k -n 100000 
  ;;Requests per second:    230394.04 [#/sec] (mean)

  ;; mina start/stop
  (def server-mina
    (mina/start! app {:port 8080}))
  (mina/stop! server-mina)
  ;; ab -c 8 -k -n 100000 
  ;; Requests per second:    20098.54 [#/sec] (mean)


I would guess it could be the config defaults that are more conservative


something like that


just using wrk instead of ab I get 72k r/s, but maybe that would also bump the numbers of httpkit


I just spent 5min on it.

Tomas Brejla08:03:50

➜  ~ # httpkit

➜  ~ wrk -c 30 -t 10 
Running 10s test @ 
  10 threads and 30 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    73.09us   62.46us   4.10ms   95.73%
    Req/Sec    43.06k     5.28k   57.13k    65.15%
  4326476 requests in 10.10s, 536.39MB read
Requests/sec: 428387.33
Transfer/sec:     53.11MB
➜  ~ # mina

➜  ~ wrk -c 30 -t 10 
Running 10s test @ 
  10 threads and 30 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    99.78us  116.17us   8.24ms   96.01%
    Req/Sec    32.07k     1.03k   34.64k    74.36%
  3223260 requests in 10.10s, 421.13MB read
Requests/sec: 319140.63
Transfer/sec:     41.70MB


like I said yesterday, there are still some low hanging fruits for perfs, and I suppose with some tweaks of the server options that would also push it a bit further

Tomas Brejla08:03:42

Both numbers are quite high, but again, suprisingly, mina/nima is not winning at this game. There might be some important setting somewhere in the options that will change this situation. Or perhaps the virtual threads approach way doesn't necessarily bring better raw performance, but scales to high number of concurrent users in more friendly way (?)


here's a report from a nima dev using the example repo: Requests/sec: 1018686.05


he's trying httpkit to compare

Tomas Brejla08:03:24

I might check some nima docs or slack later. Perhaps they'll mention what settings need to be used / configured.


I don't think it's surprising, I am actually quite pleased we're not so far off httpkit, given how early it is and with the default options

👍 3

that's what he uses:


wget -nc 

wrk -d 15 -c 512 -t 8 --latency \
      -H 'Accept: text/plain,text/html;q=0.9,application/xhtml+xml;q=0.9,application/xml;q=0.8,*/*;q=0.7' \
      -H 'Connection: keep-alive' \
      -s pipeline.lua
      -- 16


same as techempower bench setup


the full output was:

File 'pipeline.lua' already there; not retrieving.

Running 15s test @ 
  8 threads and 512 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   438.78us  663.85us  31.01ms   98.82%
    Req/Sec   128.64k    13.27k  197.85k    66.89%
  Latency Distribution
     50%  377.00us
     75%  476.00us
     90%  541.00us
     99%    1.25ms
  15381870 requests in 15.10s, 2.35GB read
Requests/sec: 1018686.05
Transfer/sec:    159.33MB


I just landed a tiny optimisation for request map creation/access that should work towards closing the gap with httpkit, more of the same can be done on other things (like request headers access)



Tomas Brejla09:03:05

Nice speed bump 👍 wrk -c 30 -t 10 previous run with mina 0.1.13

3223260 requests in 10.10s, 421.13MB read
Requests/sec: 319140.63
Transfer/sec:     41.70MB
mina 0.1.14
3777539 requests in 10.10s, 493.55MB read
Requests/sec: 374019.28
Transfer/sec:     48.87MB


yeah, there are plenty more things like that to be done


the nima dev that reported the numbers before got 307896.83 r/s with httpkit

Tomas Brejla09:03:07

btw using that pipeline.lua bench script you sent, mina is already winning 🙂 (the response is always a simple static hello world response)

httpkit : Requests/sec: 482222.91
mina:     Requests/sec: 564992.41

Alex Miller (Clojure team)23:02:01

Clojure CLI is now available • Added env var that can be set to temporarily allow support for http repos: CLOJURE_CLI_ALLOW_HTTP_REPO • Remove deprecated support for -R and -C • Clean up help text around repl supporting init-opts

🎉 14
clojure-spin 21

hi @U064X3EF3 thanks for the new release. could you direct me to where i can find more information on CLOJURE_CLI_ALLOW_HTTP_REPO? can't find it in either cli or tools repos, nor on the TDEPS jira. wondering what it is? thanks

Alex Miller (Clojure team)12:02:32

I haven’t doc’ed it yet, but it’s exactly what it says above - an env var that can be set to allow use of Maven repos with http urls (which are disallowed otherwise)

👍 2