|
@@ -13,10 +13,10 @@
|
|
(fn [req]
|
|
(fn [req]
|
|
(let [exchange ^HttpServerExchange (:server-exchange req)]
|
|
(let [exchange ^HttpServerExchange (:server-exchange req)]
|
|
(if (.isInIoThread exchange)
|
|
(if (.isInIoThread exchange)
|
|
- (.dispatch exchange ^Runnable ^:once (fn []
|
|
|
|
- (.startBlocking exchange)
|
|
|
|
- (immutant/write-response exchange (handler req))
|
|
|
|
- (.endExchange exchange)))
|
|
|
|
|
|
+ (.dispatch exchange ^Runnable (^:once fn* []
|
|
|
|
+ (.startBlocking exchange)
|
|
|
|
+ (immutant/write-response exchange (handler req))
|
|
|
|
+ (.endExchange exchange)))
|
|
(handler req)))))
|
|
(handler req)))))
|
|
|
|
|
|
(defn random []
|
|
(defn random []
|
|
@@ -25,7 +25,7 @@
|
|
(def query-one (:query-one (p/compile {:row (p/rs->compiled-record)})))
|
|
(def query-one (:query-one (p/compile {:row (p/rs->compiled-record)})))
|
|
|
|
|
|
(defn random-world [ds]
|
|
(defn random-world [ds]
|
|
- (with-open [con (p/get-connection ds)]
|
|
|
|
|
|
+ (let [con (p/get-connection ds)]
|
|
(query-one con ["SELECT id, randomnumber from WORLD where id=?" (random)])))
|
|
(query-one con ["SELECT id, randomnumber from WORLD where id=?" (random)])))
|
|
|
|
|
|
(defn plain-text-handler [_]
|
|
(defn plain-text-handler [_]
|
|
@@ -46,16 +46,14 @@
|
|
|
|
|
|
(defn -main [& _]
|
|
(defn -main [& _]
|
|
(let [ds (hikari/make-datasource
|
|
(let [ds (hikari/make-datasource
|
|
- {:read-only true
|
|
|
|
- :maximum-pool-size 48
|
|
|
|
|
|
+ {:maximum-pool-size 256
|
|
:pool-name "db-pool"
|
|
:pool-name "db-pool"
|
|
:adapter "postgresql"
|
|
:adapter "postgresql"
|
|
:username "benchmarkdbuser"
|
|
:username "benchmarkdbuser"
|
|
:password "benchmarkdbpass"
|
|
:password "benchmarkdbpass"
|
|
:database-name "hello_world"
|
|
:database-name "hello_world"
|
|
:server-name "tfb-database"
|
|
:server-name "tfb-database"
|
|
- :port-number 5432
|
|
|
|
- :register-mbeans false})]
|
|
|
|
|
|
+ :port-number 5432})]
|
|
(web/run
|
|
(web/run
|
|
(ring/ring-handler
|
|
(ring/ring-handler
|
|
(ring/router
|
|
(ring/router
|
|
@@ -67,9 +65,9 @@
|
|
:inject-router? false})
|
|
:inject-router? false})
|
|
{:port 8080
|
|
{:port 8080
|
|
:host "0.0.0.0"
|
|
:host "0.0.0.0"
|
|
- :io-threads (* 2 (.availableProcessors (Runtime/getRuntime)))
|
|
|
|
:dispatch? false
|
|
:dispatch? false
|
|
- :worker-threads 48
|
|
|
|
|
|
+ :io-threads (* 2 (.availableProcessors (Runtime/getRuntime)))
|
|
|
|
+ :worker-threads (* 8 (.availableProcessors (Runtime/getRuntime)))
|
|
:server {:always-set-keep-alive false}})))
|
|
:server {:always-set-keep-alive false}})))
|
|
|
|
|
|
(comment
|
|
(comment
|