{"id":21004788,"url":"https://github.com/halfzebra/rust-ingress","last_synced_at":"2026-01-17T18:38:25.117Z","repository":{"id":73688831,"uuid":"501444621","full_name":"halfzebra/rust-ingress","owner":"halfzebra","description":"🚶🚶🚶 Kafka ingress using Rust","archived":false,"fork":false,"pushed_at":"2022-06-09T20:49:33.000Z","size":134,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-15T01:37:40.200Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","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/halfzebra.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-08T23:46:23.000Z","updated_at":"2024-08-03T09:21:58.000Z","dependencies_parsed_at":"2023-02-24T01:16:07.108Z","dependency_job_id":null,"html_url":"https://github.com/halfzebra/rust-ingress","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/halfzebra/rust-ingress","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfzebra%2Frust-ingress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfzebra%2Frust-ingress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfzebra%2Frust-ingress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfzebra%2Frust-ingress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/halfzebra","download_url":"https://codeload.github.com/halfzebra/rust-ingress/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfzebra%2Frust-ingress/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28516195,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T18:28:00.501Z","status":"ssl_error","status_checked_at":"2026-01-17T18:28:00.150Z","response_time":85,"last_error":"SSL_read: 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":[],"created_at":"2024-11-19T08:37:56.524Z","updated_at":"2026-01-17T18:38:25.055Z","avatar_url":"https://github.com/halfzebra.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚶🚶🚶 rust-ingress\n\nThis is a POC for ingress solution using Apache Kafka with two services for [ingressing](./ingress/) and [storing](./worker/) messages into Postgres.\nThe code is a happy-path spaghetti to test whether this is even going to work.\n\n![Blank diagram](https://user-images.githubusercontent.com/3983879/172737556-8266fab6-f2b5-4181-993f-c924ea832c9f.png)\n\n## Running\n\nPrerequisites: _Docker_\n\n```bash\ndocker-compose up\n```\n\n## Testing\n\nFor a simple test:\n\n```bash\ncurl --location --request POST 'http://0.0.0.0:8000/api/v1/message' \\\n    --header 'Content-Type: application/json' \\\n    --data-raw '{\n        \"ts\": \"1530228282\",\n        \"sender\": \"testy-test-service\",\n        \"message\": {\n            \"foo\": \"bar\",\n            \"baz\": \"bang\"\n        },\n        \"sent-from-ip\": \"1.2.3.4\",\n        \"priority\": 2\n    }'\n```\n\nPrerequisites: _Node.js_\n\n```bash\n# install load testing tooling\nnpm install -s artillery@latest\n\n# start blasting\nartillery run load-test.yaml\n```\n\nHere's resourse usage for a run sending 20k requests over 60 seconds on WSL2(probably the most inefficient):\n\n```\nCONTAINER ID   NAME                          CPU %     MEM USAGE / LIMIT     MEM %     NET I/O           BLOCK I/O   PIDS\n08e0e50ea4b9   rust-axum-kafka-ingress-1     0.12%     101.8MiB / 12.44GiB   0.80%     21MB / 16.6MB     0B / 0B     17\nd3af0d3e5b91   rust-axum-kafka-worker-1      1.68%     15.89MiB / 12.44GiB   0.12%     12.8MB / 11.1MB   0B / 0B     17\n1448a81750a8   rust-axum-kafka-kafka-1       1.61%     424.3MiB / 12.44GiB   3.33%     10.4MB / 8.59MB   0B / 0B     86\n3c6f10adab04   rust-axum-kafka-db-1          0.88%     24.11MiB / 12.44GiB   0.19%     7.44MB / 6.32MB   0B / 0B     8\n46f32ebaa1be   rust-axum-kafka-zookeeper-1   0.07%     94.45MiB / 12.44GiB   0.74%     81.9kB / 65.2kB   0B / 0B     70\n```\n\n## Why Apache Kafka?\n\nHigh performance(proven 100k RPS) and fault tolerance.\nNote: Fault tolerance is _not really_ explored in this project as it is not even using a Kafka cluster.\n\n\n## Why Rust?\n\nI stumbled upon [fede1024/rust-rdkafka](https://github.com/fede1024/rust-rdkafka) which promised a pretty good [performance.](https://github.com/fede1024/kafka-benchmark)\n\nThe [ingres](./ingress/) service is using a relatively new [tokio-rs/axum](https://github.com/tokio-rs/axum) framework, which is [speculated](https://github.com/piaoger/webframework-bench) to have better performance than Go and offers slightly better ergonomics over the previous HTTP Server frameworks.\n\n## Why Dockerfile is so complicated?\n\nIt contains a build optimization from [Packaging a Rust web service using Docker.](https://blog.logrocket.com/packaging-a-rust-web-service-using-docker/)\n\n## TODO:\n\n- the [worker](./worker/) needs to batch inserts as it is getting pretty slow\n- run Kafka as a cluster\n- the [ingress](./ingress/) is okay CPU-wise, but suspiciously high memory usage(needs investigation)\n- add processing result output in the worker\n- run load tests on a better hardware on Linux\n- organize code better, add tests","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalfzebra%2Frust-ingress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhalfzebra%2Frust-ingress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalfzebra%2Frust-ingress/lists"}