{"id":28412215,"url":"https://github.com/electric-sql/client-load-benchmarking","last_synced_at":"2025-09-21T00:36:02.722Z","repository":{"id":267487745,"uuid":"901386607","full_name":"electric-sql/client-load-benchmarking","owner":"electric-sql","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-12T11:16:28.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-08-21T11:12:18.825Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/electric-sql.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-10T15:05:57.000Z","updated_at":"2024-12-12T11:16:31.000Z","dependencies_parsed_at":"2024-12-10T17:33:42.026Z","dependency_job_id":null,"html_url":"https://github.com/electric-sql/client-load-benchmarking","commit_stats":null,"previous_names":["electric-sql/client-load-benchmarking"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/electric-sql/client-load-benchmarking","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electric-sql%2Fclient-load-benchmarking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electric-sql%2Fclient-load-benchmarking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electric-sql%2Fclient-load-benchmarking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electric-sql%2Fclient-load-benchmarking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/electric-sql","download_url":"https://codeload.github.com/electric-sql/client-load-benchmarking/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electric-sql%2Fclient-load-benchmarking/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276179685,"owners_count":25598568,"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-20T02:00:10.207Z","response_time":63,"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":"2025-06-02T20:15:29.719Z","updated_at":"2025-09-21T00:36:02.695Z","avatar_url":"https://github.com/electric-sql.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Electric Load Generation\n\nCode to load test an Electric instance by simulating any number of concurrently connected clients.\n\n## Running Locally\n\nThis repo has a docker compose setup that allows for running a full end-to-end\ntest of the electric stack on your local machine.\n\n1.  `make clients=1000` - builds and launches a self-contained electric\n    instance, fronted by a Varnish proxy with 1000 clients connected over HTTP\n\n    Options:\n\n    - `clients=N` set the number of clients to launch and connect. Default `1000`.\n\n          make clients=2000\n\n2.  `make txns duration=60 tps=8` - generates 8 database transactions per second for 60 seconds\n\n    Options:\n\n    - `duration=S` run for `S` seconds, default `300`\n\n          make txns duration=60\n\n    - `tps=N` insert `N` rows per second, default `1`\n\n          make txns tps=4\n\nAs the clients receive the db transactions, you will see messages from the client coordinator.\n\n- `[start: [id: ID, ...` - the row with id `ID` has been received by a client\n\n- `[complete: [id: ID, ...` - the row with id `ID` has been received by all\n  clients. The `duration` value here is the time in milliseconds between the\n  receipt of the first `start` message and the last.\n\n### Statistics\n\nIf you connect to the stack's pg database:\n\n    psql \"postgresql://postgres:password@127.0.0.1:5555/electric\"\n\nYou can see some views that show the latency statistics, i.e. the time between the transaction write and receipt by the electric clients:\n\nTo see overall statistics for latencies for all sampled transactions:\n\n     select * from latency_overview;\n\nAnd for the latencies of the first receipt:\n\n     select * from latency_overview1;\n\nAll latencies are in milliseconds.\n\nSee [postgres/init.sql](./postgres/init.sql) for the full set of views and db schema.\n\n## Deploying Using Fly\n\nYou can also generate client connections to a real Electric instance (running\nbehind a CDN) using Fly to bring up a geo-distributed set of client load\ninstances.\n\nThe `client_load` directory has a `fly.toml` file suitable for deploying any\nnumber of instances.\n\nAssuming that your (CDN fronted) electric instance is running at\n`https://cdn.electric.my-app.com` and is connected to some database at\n`postgresql://usr:password@pg.electric.my-app.com`:\n\n- Make sure your Postgres instance has the right schema as defined in\n  [postgres/init.sql](./postgres/init.sql)\n\n- Edit the [fly config](./client_load/fly.toml):\n\n  Set:\n\n  - `ELECTRIC_URL` to e.g. `https://cdn.electric.my-app.com`\n  - `DATABASE_URL` to e.g. `postgresql://user:password@pg.electric.my-app.com`\n  - `CLIENT_COUNT` this defaults to `5000` but, depending on your workload, as\n    in the number of transactions per second you're generating, can be pushed to\n    `10000` or `15000`.\n\n- Deploy it to your fly account:\n\n      cd client_load\n      fly deploy --ha=false\n\n  And scale it to the number of active connections you want:\n\n      cd client_load\n      fly scale count 10 --region ams,lhr,mad,fra,cdg,arn,otp\n\n  Fly recommends spreading your machines across various regions. The above\n  example uses Fly's European data centres. Every machine will create\n  `CLIENT_COUNT` connections.\n\n- Generate some database transactions:\n\n      DATABASE_URL=\"postgresql://usr:password@pg.electric.my-app.com\" make txns\n\n- Monitor your clients:\n\n      cd client_load\n      fly logs\n\n  As for the local setup, latency statistics will be written to your Postgres instance.\n\n- Once you're done, scale down your client machines:\n\n      cd client_load\n      fly scale count 0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectric-sql%2Fclient-load-benchmarking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felectric-sql%2Fclient-load-benchmarking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectric-sql%2Fclient-load-benchmarking/lists"}