Skip to content

Commit d2086c1

Browse files
authored
Merge pull request #587 from ruroru/main
Update /static to return InputStream in aleph
2 parents 1ba3957 + a0f9165 commit d2086c1

5 files changed

Lines changed: 28 additions & 34 deletions

File tree

frameworks/aleph/src/aleph_bench/core.clj

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,6 @@
135135
compression-body (when large-dataset
136136
(let [items (mapv #(process-item % 1) large-dataset)]
137137
(json/write-value-as-string {:items items :count (clojure.core/count items)})))
138-
static-cache (let [dir (io/file static-dir)]
139-
(when (.isDirectory dir)
140-
(into {}
141-
(map (fn [^java.io.File f]
142-
[(.getName f)
143-
{:ct (get-content-type (.getName f))
144-
:body (java.nio.file.Files/readAllBytes (.toPath f))}]))
145-
(.listFiles dir))))
146138
adapter (->NextJdbcAdapter)
147139
sqlite-tag-parser #(json/read-value % json/keyword-keys-object-mapper)
148140
sqlite-active #(== 1 (long %))
@@ -229,9 +221,11 @@
229221
dfd)
230222
empty-db-response)))]
231223
"/static/:filename" [(GET (fn [req]
232-
(let [name (get-in req [:params :filename])]
233-
(if-let [entry (and static-cache (get static-cache name))]
234-
{:status 200 :headers {hdr-ct (:ct entry) hdr-server server-name} :body (:body entry)}
224+
(let [name (get-in req [:params :filename])
225+
path (str "/data" (:uri req))
226+
f (io/file path)]
227+
(if (.isFile f)
228+
{:status 200 :headers {hdr-ct (get-content-type name) hdr-server server-name} :body (java.io.FileInputStream. path)}
235229
{:status 404 :body not-found-body}))))]
236230
"/" [(GET (fn [_] (text-response server-name)))]})]
237231

site/data/current.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"date": "2026-04-22",
2+
"date": "2026-04-21",
33
"cpu": "AMD Ryzen Threadripper PRO 3995WX 64-Cores",
44
"cores": "64",
55
"threads": "128",
@@ -10,7 +10,7 @@
1010
"docker": "29.3.0",
1111
"docker_runtime": "runc",
1212
"governor": "performance",
13-
"commit": "0a2fa3fb",
13+
"commit": "accb8f6b",
1414
"tcp": {
1515
"lo_mtu": "1500",
1616
"congestion": "cubic",

site/data/static-1024.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
{
2222
"framework": "aleph",
2323
"language": "Clojure",
24-
"rps": 30139,
25-
"avg_latency": "36.44ms",
26-
"p99_latency": "36.44ms",
27-
"cpu": "7462.7%",
28-
"memory": "4.1GiB",
24+
"rps": 23645,
25+
"avg_latency": "45.31ms",
26+
"p99_latency": "45.31ms",
27+
"cpu": "6616.2%",
28+
"memory": "13.7GiB",
2929
"connections": 1024,
3030
"threads": 64,
3131
"duration": "5s",
3232
"pipeline": 1,
33-
"bandwidth": "530.33MB",
33+
"bandwidth": "422.04MB",
3434
"reconnects": 0,
35-
"status_2xx": 153694,
35+
"status_2xx": 120596,
3636
"status_3xx": 0,
3737
"status_4xx": 0,
3838
"status_5xx": 0

site/data/static-4096.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
{
2222
"framework": "aleph",
2323
"language": "Clojure",
24-
"rps": 29468,
25-
"avg_latency": "123.77ms",
26-
"p99_latency": "123.77ms",
27-
"cpu": "7207.9%",
28-
"memory": "3.6GiB",
24+
"rps": 22631,
25+
"avg_latency": "171.14ms",
26+
"p99_latency": "171.14ms",
27+
"cpu": "6629.0%",
28+
"memory": "14.3GiB",
2929
"connections": 4096,
3030
"threads": 64,
3131
"duration": "5s",
3232
"pipeline": 1,
33-
"bandwidth": "518.63MB",
33+
"bandwidth": "407.26MB",
3434
"reconnects": 0,
35-
"status_2xx": 151751,
35+
"status_2xx": 117076,
3636
"status_3xx": 0,
3737
"status_4xx": 0,
3838
"status_5xx": 0

site/data/static-6800.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
{
2222
"framework": "aleph",
2323
"language": "Clojure",
24-
"rps": 29226,
25-
"avg_latency": "203.09ms",
26-
"p99_latency": "203.09ms",
27-
"cpu": "7079.6%",
28-
"memory": "4.0GiB",
24+
"rps": 22125,
25+
"avg_latency": "244.44ms",
26+
"p99_latency": "244.44ms",
27+
"cpu": "6599.8%",
28+
"memory": "15.2GiB",
2929
"connections": 6800,
3030
"threads": 64,
3131
"duration": "5s",
3232
"pipeline": 1,
33-
"bandwidth": "514.37MB",
33+
"bandwidth": "401.07MB",
3434
"reconnects": 0,
35-
"status_2xx": 150627,
35+
"status_2xx": 114687,
3636
"status_3xx": 0,
3737
"status_4xx": 0,
3838
"status_5xx": 0

0 commit comments

Comments
 (0)