http-kit:http-kit是具有WebSocket和异步支持的极简,事件驱动的高性能Clojure HTTP服务器客户端

  • T1_161643
  • 219KB
  • zip
  • 0
  • VIP专享
  • 0
  • 2022-04-17 13:08
HTTP工具包 用于Clojure的简单,高性能,事件驱动的HTTP客户端+服务器 | | 当前的: [http-kit " 2.5.1 " ] ; Published by contributors, see CHANGELOG for details [http-kit " 2.1.19 " ] ; Legacy, published by @shenfeng 项目状态 不幸的是,http-kit的作者( )最近没有太多时间来维护http-kit。 为了帮助我,我将进行基本的问题分类,接受次要/明显的PR等。 非常感谢进行该项目! 欢迎其他贡献者:如果您有兴趣向我伸出援手,请与我联系。 有关原始文档,示例,基准等信息,请参见(未维护,已过时)。 - 产品特点 符合Ring要求:HTTP Kit 是标准Ring Jetty适配器的直接替代品。 因此,您可以将其与所有当前的库(例如 )和中间件一起使用。 高性能:使用Nginx这样的事件驱动架构,HTTP-kit。 它甚至可以在中端硬件上轻松处理每秒数以万计的请求。 是关于它如何与他人堆叠的另一项测试。 高并发性:
# HTTP Kit ### A simple, high-performance event-driven HTTP client+server for Clojure **[CHANGELOG][]** | [API][] | current [Break Version][]: ```clojure [http-kit "2.5.1"] ; Published by contributors, see CHANGELOG for details [http-kit "2.1.19"] ; Legacy, published by @shenfeng ``` ## Project status http-kit's author ([@shenfeng][]) unfortunately hasn't had much time to maintain http-kit recently. To help out I'll be doing basic issue triage, accepting minor/obvious PRs, etc. A big thank you to the **[current contributors](** for keeping the project going! **Additional contributors welcome**: please ping me if you'd be interested in lending a hand. See the (unmaintained, outdated) [project website][] for original documentation, examples, benchmarks, etc. \- [@ptaoussanis][] ## Features - **Ring compliant**: HTTP Kit is an [(almost)]( drop-in replacement for the standard Ring Jetty adapter. So you can use it with all your current libraries (e.g. [Compojure]( and middleware. - **High performance**: Using an event-driven architecture like Nginx, HTTP-kit is [very, very fast]( It comfortably handles tens of thousands of requests/sec on even midrange hardware. [Here]( is another test about how it stacks up with others. - **High concurrency**: It's not only fast, but [efficient](! Each connection costs nothing but a few kB of memory. RAM usage grows O(n) with connections. - **Clean, simple, small**: Written from the ground-up to be lean, the entire client/server is available as a single ~90kB JAR with zero dependencies and [~3k lines]( of (mostly Java) code. - **Sync or async**: Synchronous is simple. Asynchronous is fast & flexible. With HTTP Kit you get the best of both with a [simple API]( that lets you mix & match to best fit your use case. - **WebSockets and Comet**: With great out-the-box support for both [WebSockets]( and efficient handling of [long-held HTTP requests](, realtime web applications are a breeze to write. ## Enabling client SNI support (DISABLED BY DEFAULT) To retain backwards-compatibility with JVMs < 8, http-kit client's **SNI support is DISABLED by default**. > Common cause of: ` Received fatal alert: handshake_failure` This default may be changed in a future breaking release. In the meantime, manually enabling support is easy: ```clojure (:require [org.httpkit.sni-client :as sni-client]) ; Needs Java >= 8, http-kit >= 2.4.0-alpha6 ;; Change default client for your whole application: (alter-var-root #'org.httpkit.client/*default-client* (fn [_] sni-client/default-client)) ;; or temporarily change default client for a particular thread context: (binding [org.httpkit.client/*default-client* sni-client/default-client] <...>) ``` See `org.httpkit.client/*default-client*` docstring for more details. ## Hack locally Hacker friendly: zero dependencies, written from the ground-up with only ~3.5k lines of code (including java), clean and tidy. ```sh # Modify as you want, unit tests back you up: lein test # May be useful (more info), see `server_test.clj`: ./scripts/start_test_server # Some numbers on how fast can http-kit's client can run: lein test :benchmark ``` ### Contact & Contribution Please use the [GitHub issues page]( for feature suggestions, bug reports, or general discussions. Current contributors are listed [here]( The [project website][] is also on GitHub. ## License Copyright &copy; 2012-2020 [@shenfeng][] and contributors. Distributed under the [Apache License Version 2.0]( [CHANGELOG]: [API]: [@shenfeng]: [@ptaoussanis]: [project website]: [Break Version]: