{"id":51083046,"url":"https://github.com/kanutocd/cdc-concurrent","last_synced_at":"2026-06-23T20:01:08.420Z","repository":{"id":362381683,"uuid":"1255101784","full_name":"kanutocd/cdc-concurrent","owner":"kanutocd","description":"Provides optional Async-backed I/O-concurrent execution for  cdc-core. It accelerates I/O-bound Change Data Capture (CDC)  event processing while preserving the cdc-core programming model.","archived":false,"fork":false,"pushed_at":"2026-06-11T17:15:42.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-11T18:23:59.575Z","etag":null,"topics":["async","cdc","change-data-capture","concurrency","data-pipeline","event-processing","fiber-scheduler","io-concurrency","logical-replication","pgoutput","postgres","postgresql","ruby","ruby-gem","wal"],"latest_commit_sha":null,"homepage":"https://github.com/kanutocd/cdc-concurrent","language":"Ruby","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/kanutocd.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-31T12:07:02.000Z","updated_at":"2026-06-11T17:13:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/kanutocd/cdc-concurrent","commit_stats":null,"previous_names":["kanutocd/cdc-concurrent"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/kanutocd/cdc-concurrent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanutocd%2Fcdc-concurrent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanutocd%2Fcdc-concurrent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanutocd%2Fcdc-concurrent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanutocd%2Fcdc-concurrent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kanutocd","download_url":"https://codeload.github.com/kanutocd/cdc-concurrent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanutocd%2Fcdc-concurrent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34704748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"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":["async","cdc","change-data-capture","concurrency","data-pipeline","event-processing","fiber-scheduler","io-concurrency","logical-replication","pgoutput","postgres","postgresql","ruby","ruby-gem","wal"],"created_at":"2026-06-23T20:01:07.366Z","updated_at":"2026-06-23T20:01:08.412Z","avatar_url":"https://github.com/kanutocd.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cdc-concurrent\n\n[![Gem Version](https://badge.fury.io/rb/cdc-concurrent.svg)](https://badge.fury.io/rb/cdc-concurrent)\n[![CI](https://github.com/kanutocd/cdc-concurrent/workflows/CI/badge.svg)](https://github.com/kanutocd/cdc-concurrent/actions)\n[![Ruby Version](https://img.shields.io/badge/ruby-%3E%3D%203.4-ruby.svg)](https://www.ruby-lang.org/en/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nOptional I/O-concurrent runtime adapter for `cdc-core`.\n\n`cdc-concurrent` executes `CDC::Core::Processor` objects with Fiber-scheduler-based I/O concurrency using `async`. It is the I/O-bound twin of `cdc-parallel`.\n\n## Requirements\n\n- Ruby 3.4+\n- `cdc-core`\n- `async`\n\n## Purpose\n\n```text\ncdc-core\n   |\n   |-- cdc-parallel\n   |      CPU-bound parallelism\n   |\n   `-- cdc-concurrent\n          I/O-bound concurrency\n```\n\nUse `cdc-concurrent` for processors that spend most of their time waiting on fiber-scheduler-compatible I/O:\n\n- HTTP webhooks\n- external API enrichment\n- Redis publishing\n- OpenSearch or Elasticsearch indexing\n- S3 or object-storage writes\n- async sink fanout\n- database writes through compatible drivers\n\nUse `cdc-parallel` for CPU-bound work such as pgoutput parsing, OID decoding, JSON parsing, diff computation, compression, and analytics calculations.\n\n## Installation\n\n```ruby\ngem \"cdc-concurrent\"\n```\n\n## Usage\n\n```ruby\nrequire \"cdc/core\"\nrequire \"cdc/concurrent\"\n\nclass WebhookProcessor \u003c CDC::Core::Processor\n  concurrent_safe!\n\n  def process(event)\n    # Perform fiber-scheduler-compatible I/O here.\n    CDC::Core::ProcessorResult.success(event)\n  end\nend\n\nruntime = CDC::Concurrent::Runtime.new(\n  processor: WebhookProcessor.new,\n  concurrency: 100,\n  timeout: 5.0\n)\n\nresult = runtime.process(event)\nruntime.shutdown\n```\n\n## Batch Processing\n\n```ruby\nresults = runtime.process_many(events)\n```\n\nResults preserve input order by default. Set `preserve_order: false` when completion order is acceptable.\n\nFor I/O-bound throughput, `process_many` is the primary path. Repeated\nsingle-event `process` calls still pay one Async dispatch per event, while\n`process_many` lets the runtime overlap waits across the submitted batch.\n\n## Transaction Processing\n\n```ruby\nresult = runtime.process_transaction(transaction)\n```\n\nTransactions are processed event-by-event. The returned `ProcessorResult#event` contains the per-event results. If any event fails, the transaction result fails and carries the first error.\n\n## Processor Safety\n\nOnly processors that declare `concurrent_safe!` can run in this runtime.\n\n```ruby\nclass SinkProcessor \u003c CDC::Core::Processor\n  concurrent_safe!\nend\n```\n\nUnsafe processors raise:\n\n```ruby\nCDC::Concurrent::UnsafeProcessorError\n```\n\nA concurrent-safe processor should avoid unsafe shared mutable instance state. This runtime runs tasks concurrently in one Ruby process; it does not isolate mutable objects like Ractors do.\n\n`concurrent_safe!` is a declaration of processor intent, not a proof. The\nruntime cannot verify that a processor avoids unsafe shared mutable state or\nuses scheduler-compatible I/O.\n\n## Important Limits\n\n`cdc-concurrent` improves throughput only for I/O that cooperates with Ruby's Fiber scheduler. Blocking libraries that do not yield to the scheduler will still block the process.\n\nTimeouts are applied per event task. They are not whole-batch or\nwhole-transaction deadlines.\n\nFor CPU-bound processing, use `cdc-parallel`.\n\n## Roadmap\n\n- Move `concurrent_safe!` into `cdc-core`\n- Retry and backoff policies\n- Dead-letter handling\n- Async HTTP webhook helpers\n- Sink abstractions\n- Async Redis/OpenSearch integrations\n\n## Test Organization\n\nThe test suite is grouped by intent so the same structure can be reused across CDC ecosystem gems.\n\n```text\ntest/unit/          focused class and branch coverage\ntest/integration/   component interaction and runtime integration\ntest/behavior/      ecosystem contracts and guardrails\ntest/performance/   opt-in smoke benchmarks\n```\n\nRun the default quality suite:\n\n```bash\nbundle exec rake test\n```\n\nRun a specific group:\n\n```bash\nbundle exec rake test:unit\nbundle exec rake test:integration\nbundle exec rake test:behavior\nbundle exec rake test:performance\n```\n\nThe default `test` task runs unit, integration, and behavior tests. Performance tests are intentionally separate because they are environment-sensitive.\n\n## Benchmarking\n\n`cdc-concurrent` includes reproducible benchmarks that compare serial processor execution against the Async-backed processor pool.\n\nThe benchmark focuses on three workload categories:\n\n| Workload | Purpose                                      |\n| -------- | -------------------------------------------- |\n| tiny     | Measure dispatch overhead                    |\n| io       | Measure scheduler-friendly I/O concurrency   |\n| batch    | Measure batched CDC event I/O fanout         |\n\nSee [benchmark/README.md](benchmark/README.md) for the full benchmark methodology,\nconfiguration reference, report schema, and interpretation guidance.\n\n`cdc-parallel` and `cdc-concurrent` benchmark different bottlenecks.\n`cdc-parallel` measures CPU parallelism; `cdc-concurrent` measures I/O wait\noverlap. Their speedup ratios are not directly comparable.\n\n### Quick Start\n\nDefault I/O workload:\n\n```bash\nbundle exec rake benchmark:processor_pool\n```\n\nTiny overhead workload:\n\n```bash\nBENCHMARK_WORKLOAD=tiny \\\nbundle exec rake benchmark:processor_pool\n```\n\nBatch workload:\n\n```bash\nBENCHMARK_WORKLOAD=batch \\\nBENCHMARK_BATCH_SIZE=1000 \\\nbundle exec rake benchmark:processor_pool\n```\n\nConcurrency sweep:\n\n```bash\nBENCHMARK_WORKLOAD=io \\\nBENCHMARK_CONCURRENCY_COUNTS=1,10,50,100 \\\nbundle exec rake benchmark:processor_pool\n```\n\nCredibility controls:\n\n```bash\nBENCHMARK_TRIALS=7 \\\nBENCHMARK_MIN_DURATION=0.25 \\\nBENCHMARK_ITERATIONS=1000 \\\nbundle exec rake benchmark:processor_pool\n```\n\n### Benchmark Docker Image\n\nBuild and run the reusable Docker image:\n\n```bash\nbundle exec rake benchmark:docker_build\nbundle exec rake benchmark:docker_run\n```\n\nOr run the image directly after it is published to GitHub Container Registry:\n\n```bash\ndocker run --rm ghcr.io/kanutocd/cdc-concurrent-benchmark:main\n```\n\nThe benchmark image is intended to follow the shared performance validation\npattern across CDC Ecosystem gems, enabling reproducible benchmark execution\nlocally, in CI, and across different development environments.\n\n## License\n\n[MIT](LICENSE.txt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkanutocd%2Fcdc-concurrent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkanutocd%2Fcdc-concurrent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkanutocd%2Fcdc-concurrent/lists"}