{"id":19589425,"url":"https://github.com/spray/connection-test","last_synced_at":"2025-10-30T07:12:50.310Z","repository":{"id":2990037,"uuid":"4006434","full_name":"spray/connection-test","owner":"spray","description":"C50K test for spray-can","archived":false,"fork":false,"pushed_at":"2012-04-12T15:56:28.000Z","size":100,"stargazers_count":12,"open_issues_count":0,"forks_count":5,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-03-25T22:12:35.952Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spray.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-12T15:56:01.000Z","updated_at":"2021-09-07T11:20:46.000Z","dependencies_parsed_at":"2022-09-07T09:51:33.246Z","dependency_job_id":null,"html_url":"https://github.com/spray/connection-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spray%2Fconnection-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spray%2Fconnection-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spray%2Fconnection-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spray%2Fconnection-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spray","download_url":"https://codeload.github.com/spray/connection-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224069648,"owners_count":17250509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-11T08:18:24.336Z","updated_at":"2025-10-30T07:12:45.289Z","avatar_url":"https://github.com/spray.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Connection Test\n\nThis is a small project for testing the spray-can HttpServer and HttpClient implementations in a C50K scenario on\nlocalhost.\n\nThe project consists of three parts:\n\n1. A spray-can HttpServer with a very simple echo handler acting as test-fixture.\n\n2. A load-generation application using a spray-can HttpClient that opens 50'000 connections against the server\n   and runs simple ping/pong messages across these for some time before shutting down again.\n\n3. A very simple [Gatling][1] simulation that fires 50'000 long-running requests to the server, which only complete\n   after all connections have been established.\n\n\nThe goal of this project is to verify the feasibily of opening 50K outgoing client connections from one machine using\nthe spray-can HttpClient and to (very coarsely) compare against doing the same with Gatling.\n\n\n### Running on your machine\n\nIn order to run the tests on your machine follow these steps:\n\n1. \"Loosen the belts\" of your OS by increasing the limits on open file count (per process) as well as port availability.\n   Check the respective section further down for details.\n\n2. Clone this repository.\n\n3. Make sure you have SBT installed and your launcher script gives SBT at least 1.5 GB of memory.\n\n4. Start the server with `sbt \"run-main Server\"`\n\n5. In another terminal run `sbt \"run-main SprayCanClient\"`\n\n6. Lean back and watch the log.\n   If everything is well the test will run through an the client will exit normally while the server keeps running.\n\n\nInstead of generating the load with the `SprayCanClient` you can also use the included Gatling simulation.\nHere is how to do it:\n\n1. Follow steps 1 - 4 from above.\n\n2. Download and unpack the gatling distribution ZIP.\n\n3. Move the `GatlingSimulation.scala` file into the `user-files/simulations` directory underneath your gatling\n   installation directory.\n\n4. Increase the `gatling.http.connectionTimeout` and `gatling.http.requestTimeout` setting in the `conf/gatling.conf`\n   config file underneath your gatling installation directory to `90000`.\n\n5. Run the `bin/gatling.sh` file underneath your gatling installation directory.\n\n6. Watch the gatling log output as well as the log on the server side.\n\n\n### Differences between the SprayCanClient and Gatling tests\n\nDue to limitations in Gatling the two tests are not directly comparable.\nThe SprayCanClient opens connections and regularly (every 5 seconds) fires ping messages across them, expecting the\nserver to respond with a respective response. With 50K connections open this means that ca. 10`000 requests are\nfired and responded to every second.\n\nSince Gatling has no way of directly using persistent connections for more than one request (connection pooling helps\nbut still offers too little control over connection management) the approach for this test is different:\nGatling fires 50K requests in 50 seconds that are responded to by the server 60 seconds after the request has come in.\nThis means that, after 50 s, 50K connections will be open with their requests pending. 10 seconds after the last\nconnection has been opened the first response goes out, with the other ones following behind thereby closing all\nconnections over time.\n\n\n### Configuring your OS\n\nYou can easily run the tests on your machine, but you need to make sure that you increase certain limits with regard\nto open file handles as well as port range in your OS.\n\nUnder Mac OS/X Lion you need to run the following commands in order to \"unbuckle the belts\":\n\n    sudo sysctl -w kern.maxfilesperproc=200000\n    sudo sysctl -w kern.maxfiles=200000\n    sudo sysctl -w net.inet.ip.portrange.first=1024\n\nUnder Windows or Linux there will be similar tweaks required.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspray%2Fconnection-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspray%2Fconnection-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspray%2Fconnection-test/lists"}