{"id":21310617,"url":"https://github.com/jtanza/dashi","last_synced_at":"2026-04-16T11:02:10.917Z","repository":{"id":39569798,"uuid":"210953904","full_name":"jtanza/dashi","owner":"jtanza","description":"a simple embedded http server","archived":false,"fork":false,"pushed_at":"2021-06-04T02:14:48.000Z","size":182,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-30T19:57:06.505Z","etag":null,"topics":["http","java","nio","socket-io","webserver"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jtanza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-25T22:44:51.000Z","updated_at":"2022-06-24T15:55:50.000Z","dependencies_parsed_at":"2022-08-29T10:50:25.025Z","dependency_job_id":null,"html_url":"https://github.com/jtanza/dashi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jtanza/dashi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtanza%2Fdashi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtanza%2Fdashi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtanza%2Fdashi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtanza%2Fdashi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jtanza","download_url":"https://codeload.github.com/jtanza/dashi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtanza%2Fdashi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31882886,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T09:23:21.276Z","status":"ssl_error","status_checked_at":"2026-04-16T09:23:15.028Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http","java","nio","socket-io","webserver"],"created_at":"2024-11-21T17:14:12.552Z","updated_at":"2026-04-16T11:02:10.898Z","avatar_url":"https://github.com/jtanza.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dashi\n\nDashi is a small, embedded HTTP server running on the JVM. It is single-threaded, event-driven, asynchronous and simple to use. It is not for production use (yet!) but lends itself quite nicely to rapid prototyping and usage in test environments.\n\nGetting a server up and running is as quick as:\n\n```\nRequestHandler handler = new RequestHandler(\"/ping\", r -\u003e Response.ok(\"pong\"));\nHttpServer.builder(new RequestDispatcher().addHandler(handler)).build().serve();\n```\n\n### Installation\n\nDashi requires Java 8 or greater. It is packaged with Maven and is built as an uber-jar. Dependencies in Dashi are pretty minimal. After the following you're ready to go:\n\n```\n$ git clone https://github.com/jtanza/dashi.git \u0026\u0026 cd dashi\n$ mvn clean install\n```\n\n### API\n\nThe Dashi API is built around the `RequestDispatcher`. Its design allows for users to quickly generate an HTTP server from a collection of self contained handlers. Below are a few examples of the features offered.  \n\nPlease note that this project is still **a work in progress**, and as such the API may be subject to change. Be sure to refer to the [wiki](https://github.com/jtanza/dashi/wiki) for the full project documentation. Any and all feedback is welcomed!\n\n### Examples\n\nInstantiating `RequestDispatcher`s is pretty straight forward and concise with chained method invocation:\n\n```\nString resourcePath = \"/your-path\";\nRequestDispatcher requestDispatcher = new RequestDispatcher()\n\t.addHandler(new RequestHandler(GET,    resourcePath, r -\u003e Response.ok().build()))\n\t.addHandler(new RequestHandler(DELETE, resourcePath, r -\u003e Response.from(GONE).build()));\n```\n\nPath variables are easily configurable:\n\n```\nRequestDispatcher dispatcher = new RequestDispatcher()\n    .addHandler(new RequestHandler(Method.PUT, \"/users/{userId}\", r -\u003e {\n        String userId = r.getPathVariable(\"userId\");\n        // do work\n        return Response.ok().build();\n    }));\n```\n\nServing static files is as simple as providing a path to resources:\n\n```\nHttpServer.builder(new RequestDispatcher().addResourcePath(\"/web\")).build().serve();\n```\n\nDashi delegates the servicing of client requests to a stand alone worker pool, by default a `cachedThreadPool` is used, but this resource is easily overridable to suit client needs:\n\n```\nHttpServer.builder(dispatcher).workerPool(Executors.newSingleThreadExecutor()).build().serve();\n```\n\n### Design\n \nDashi is built heavily around `java.nio` and strives to be as resource efficient as possible. The thread-per-socket-connection model is abandoned in favor of readiness selection to multiplex requests from all client connections within a single thread. The servicing of ready requests however is assigned to a separate pool of worker threads, decoupling network I/O from the processing of received data. The handling of incoming HTTP requests from a user's perspective is intentionally simple however: user's receive a `Request` and are expected to return a `Response`. It is contained entirely in a method of the form `Function\u003cRequest, Response\u003e`.\n\n### Benchmarking \n\nA few `ab` tests have been run against Dashi with the output provided below. All tests were run on a ~2015 3.1 GHz Intel Core i7 MacBook Pro. Benchmarking on memory footprint for Dashi will be soon to follow.\n\n\n4000 requets over 4000 concurrent connections\n\n```\njtanza @ ~/dev/dashi (master) $ ab -n 4000 -c 4000 localhost/ping\n[...]\nServer Software:        Dashi/0.0.1\nServer Hostname:        localhost\nServer Port:            80\n\nDocument Path:          /ping\nDocument Length:        5 bytes\n\nConcurrency Level:      4000\nTime taken for tests:   0.541 seconds\nComplete requests:      4000\nFailed requests:        0\nTotal transferred:      404000 bytes\nHTML transferred:       20000 bytes\nRequests per second:    7393.74 [#/sec] (mean)\nTime per request:       540.998 [ms] (mean)\nTime per request:       0.135 [ms] (mean, across all concurrent requests)\nTransfer rate:          729.27 [Kbytes/sec] received\n\nConnection Times (ms)\n              min  mean[+/-sd] median   max\nConnect:        0  149  38.2    146     223\nProcessing:   133  218  18.1    224     240\nWaiting:        0  185  45.4    204     234\nTotal:        222  367  24.0    367     426\n\nPercentage of the requests served within a certain time (ms)\n  50%    367\n  66%    375\n  75%    382\n  80%    387\n  90%    400\n  95%    413\n  98%    419\n  99%    421\n 100%    426 (longest request)\n\n```\n\n15000 requests over 50 concurrent connections\n\n```\njtanza @ ~/dev/dashi (master) $ ab  -n 15000 -c 50 localhost/ping\n[...]\nServer Software:        Dashi/0.0.1\nServer Hostname:        localhost\nServer Port:            80\n\nDocument Path:          /ping\nDocument Length:        5 bytes\n\nConcurrency Level:      50\nTime taken for tests:   1.561 seconds\nComplete requests:      15000\nFailed requests:        0\nTotal transferred:      1515000 bytes\nHTML transferred:       75000 bytes\nRequests per second:    9608.28 [#/sec] (mean)\nTime per request:       5.204 [ms] (mean)\nTime per request:       0.104 [ms] (mean, across all concurrent requests)\nTransfer rate:          947.69 [Kbytes/sec] received\n\nConnection Times (ms)\n              min  mean[+/-sd] median   max\nConnect:        0    1   1.2      1      12\nProcessing:     0    4   2.5      3      24\nWaiting:        0    3   2.5      3      24\nTotal:          2    5   2.5      4      24\n\nPercentage of the requests served within a certain time (ms)\n  50%      4\n  66%      5\n  75%      5\n  80%      6\n  90%      7\n  95%     10\n  98%     14\n  99%     17\n 100%     24 (longest request)\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtanza%2Fdashi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjtanza%2Fdashi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtanza%2Fdashi/lists"}