我尝试运行http-kit clojure基准测试,但是没有成功地运行它。所有的源代码都可以在here上找到。
正如您所看到的(在下面整个原始代码的一部分中),我已经连接了mysql数据库并设置了db_host=localhost和8080端口。我得到的输出是: http-kit服务器监听:8080 (没有任何错误)。我认为我在app-routes的https "GET“或处理程序(wrap-json-response app-routes)语法中犯了一些错误。有人能给我一些建议吗?
(defn start-server [{:keys [port db-host]}]
(db/use-database! (str "jdbc:mysql://"db-host"/movies?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true")
"root"
"")
;; Format responses as JSON
(let [handler (wrap-json-response app-routes)
cpu (.availableProcessors (Runtime/getRuntime))]
;; double worker threads should increase database access performance
(run-server handler {:port port :thread (* 2 cpu)})
(println (str "http-kit server listens at :" port))))
;; Define route handlers
(defroutes app-routes
(GET "http://localhost/http-kit/" [] "Hello, World!")
(GET "http://localhost/http-kit/json" [] (response {:message "Hello, World!"}))
(GET "http://localhost/http-kit/db" []
(response (first (run-queries 1))))
(GET "http:/localhost/http-kit/db/2" [queries]
(response (run-queries (get-query-count queries))))
(route/not-found "Not Found"))发布于 2015-04-25 16:03:48
更多关于你是如何运行它的信息将会有所帮助。这个过程适用于我,使用the guide here
$ git clone https://github.com/TechEmpower/FrameworkBenchmarks.git
$ cd FrameworkBenchmarks/deployment/vagrant-development/
$ vagrant up
<snip log messages>
$ vagrant ssh
$ cd FrameworkBenchmarks
$ toolset/run-tests.py --install server --test http-kit --mode verify
<snip log messages>
Verification Summary
| Test: http-kit
| fortune : PASS
| plaintext : PASS
| db : PASS
| update : PASS
| json : PASS
| query : WARN
================================================================================https://stackoverflow.com/questions/25020177
复制相似问题