首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Http-kit Clojure框架基准测试

Http-kit Clojure框架基准测试
EN

Stack Overflow用户
提问于 2014-07-30 00:21:07
回答 1查看 272关注 0票数 1

我尝试运行http-kit clojure基准测试,但是没有成功地运行它。所有的源代码都可以在here上找到。

正如您所看到的(在下面整个原始代码的一部分中),我已经连接了mysql数据库并设置了db_host=localhost和8080端口。我得到的输出是: http-kit服务器监听:8080 (没有任何错误)。我认为我在app-routes的https "GET“或处理程序(wrap-json-response app-routes)语法中犯了一些错误。有人能给我一些建议吗?

代码语言:javascript
复制
(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"))
EN

回答 1

Stack Overflow用户

发布于 2015-04-25 16:03:48

更多关于你是如何运行它的信息将会有所帮助。这个过程适用于我,使用the guide here

代码语言:javascript
复制
$ 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
================================================================================
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25020177

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档