{"id":16338917,"url":"https://github.com/vorner/tspam","last_synced_at":"2025-09-02T00:42:55.481Z","repository":{"id":66117431,"uuid":"208551591","full_name":"vorner/tspam","owner":"vorner","description":"Measuring a network link by creating new connections","archived":false,"fork":false,"pushed_at":"2022-06-08T14:28:23.000Z","size":45,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-23T01:15:43.830Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vorner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-15T06:24:25.000Z","updated_at":"2022-07-28T22:30:41.000Z","dependencies_parsed_at":"2023-02-20T18:00:44.466Z","dependency_job_id":null,"html_url":"https://github.com/vorner/tspam","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vorner/tspam","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vorner%2Ftspam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vorner%2Ftspam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vorner%2Ftspam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vorner%2Ftspam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vorner","download_url":"https://codeload.github.com/vorner/tspam/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vorner%2Ftspam/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273213950,"owners_count":25065059,"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","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-10T23:53:05.055Z","updated_at":"2025-09-02T00:42:55.473Z","avatar_url":"https://github.com/vorner.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TCP Spammer\n\nThis tool allows measuring link performance by torturing it with huge numbers of\nnew connections.\n\nThere are tools that allow measuring link throughput in terms of throughput in\nbytes, like iperf. However, if the link contains something *smart*, not just a\ndumb wire (eg. a stateful firewall, router with NAT), there's a big difference\nbetween making a single TCP connection and sending a lot of data through it\nand creating a lot of new connections, each transferring only little bit of\ndata. I was interested in the latter.\n\nThere probably are tools for that too, but I wanted to play, so I wrote this.\n\n## Maturity, maintenance, contributing...\n\nIt gets the job done. It isn't something you would want in production, but the\npurpose is obviously not production, but testing and it's fine for that.\n\nAs it gets done what I needed, I don't expect to be extending or maintaining it\nmuch.\n\nThat being said, if you find it useful, need a little feature or want to take it\nover, feel free to open an issue or a pull request. I'll try to respond and\ndiscuss the needs.\n\n## Working principle\n\nThere's a server and there's a client. The client connects to the server, sends\na bit of data, closes its half of connection, then the server sends bit of data\nand closes the other half of the connection. That's it.\n\nHowever, all this can be done massively in parallel.\n\nThe server has only one mode, where it simply listens and answers connections as\nfast as it can.\n\nThe client has two modes. One with manual setting of rate. Rate is how many new\nconnections are made per second ‒ they are created and latency statistics of the\nwhole connection turn around is measured (minimum, maximum, mean and 90th\npercentile).\n\nIn the second mode the client tries to find at which rate the link gets\nsaturated. It increases the rate in steps and tries to detect significant rise\nin the latency median.\n\nAll the parameters are configurable on command line.\n\n## Performance\n\nWhen dry-testing, the tool was able to saturate a gigabit ethernet link with 3kB\npayloads on ordinary commodity hardware. It was around 25k connections per\nsecond. This is expected to be enough to flood any kind of ordinary *smart*\ndevice.\n\nHowever, to do so, it is necessary to tweak some OS settings. The problem is the\nexistence of too many parallel and new connections.\n\n* Raise the limit of number of file descriptors, eg. `ulimit -n 100000`, both on\n  the server and client side.\n* Allow as many ports usable on the client side as possible:\n  `echo 1024 65535 \u003e /proc/sys/net/ipv4/ip_local_port_range`.\n* Allow reusing of ports in `TIME_WAIT` state:\n  `echo 1 \u003e /proc/sys/net/ipv4/tcp_tw_reuse`.\n* Raise the maximum number of waiting TCP connections on the server side:\n  `echo 20480 \u003e /proc/sys/net/ipv4/tcp_max_syn_backlog`.\n\nEven in these settings, weird things were sometimes happening, eg:\n* Some connections were getting resetted.\n* Sometimes, the OS still run out of available ports. Use of the `--cooldown`\n  parameter might help a bit, or using a shorter `--length` of the test.\n* Sometimes, *something* in the kernel switches and starts consuming a lot of\n  CPU while dropping the performance significantly. I didn't manage to find out\n  what exactly, but I believe it is related to running out of the available\n  local ports on the client, or nearly so.\n\n## Installation\n\nCompile with Rust version 1.39 or newer (or nightly, if 1.39 is not released yet\n😇).\n\n```\ncargo +nightly install --git https://github.com/vorner/tspam\n```\n\nOr simply run it:\n\n```\ncargo +nightly run --release -- --help\n```\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvorner%2Ftspam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvorner%2Ftspam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvorner%2Ftspam/lists"}