{"id":16889750,"url":"https://github.com/benoitc/hackney_disp","last_synced_at":"2025-04-11T13:08:02.374Z","repository":{"id":12247155,"uuid":"14861406","full_name":"benoitc/hackney_disp","owner":"benoitc","description":"Load-balanced Pool dispatcher based on dispcount for hackney.","archived":false,"fork":false,"pushed_at":"2013-12-02T12:16:22.000Z","size":112,"stargazers_count":6,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T10:07:21.483Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Erlang","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/benoitc.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}},"created_at":"2013-12-02T12:12:59.000Z","updated_at":"2022-08-08T13:23:35.000Z","dependencies_parsed_at":"2022-08-29T04:31:27.205Z","dependency_job_id":null,"html_url":"https://github.com/benoitc/hackney_disp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fhackney_disp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fhackney_disp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fhackney_disp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fhackney_disp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benoitc","download_url":"https://codeload.github.com/benoitc/hackney_disp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248404598,"owners_count":21097780,"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-10-13T16:58:43.882Z","updated_at":"2025-04-11T13:08:02.347Z","avatar_url":"https://github.com/benoitc.png","language":"Erlang","readme":"# hackney_disp\n\nLoad-balanced Pool dispatcher based on\n[dispcount](https://github.com/ferd/dispcount) for\n[hackney](https://github.com/benoitc/hackney).\n\nLike the default pool handler `hackney_pool`, but with the difference that\nfor each endpoint (domain/ip + port + ssl) of requests, a load balancer\nis started allowing as many connections as mentioned in the\nconfiguration.\n\nEach load balancer has N workers that will connect on-demand to each\nclient.\n\nThe load balancer/pools/dispatcher mechanism is based on\n[dispcount](https://github.com/ferd/dispcount), which will randomly\ncontact workers. This means that even though few connections might be\nrequired, the nondeterministic dispatching may make all connections open\nat some point. As such, it should be used in cases where the load is\nsomewhat predictable in terms of base levels.\n\n## When to use it?\n\nWhenever the HTTP client you're currently using happens to block trying\nto access resources that are too scarce for the load required, you may\nexperience something similar to bufferbloat, where the queuing up of\nrequests ends up ruining latency for everyone, making the overall\nresponse time terribly slow.\n\nIn the case of Erlang, this may happen over pools (like the default)\nthat dispatch resources through message passing. Then the process'\nmailbox ends up as a bottleneck that makes the application too slow.\nDispcount was developed to solve similar issues by avoiding all message\npassing on busy workers.\n\nWARNING: use with caution, this pool handler is considered as\nexperimental. It's for now nased on the code from the dlhttpc project\nand adapted to hackney.  How to use it?\n\nIn your application config set the `pool_handler` property to `hackney_disp`:\n\n    {hackney, [\n        {pool_handler, hackney_disp},\n        {restart, permanent},\n        {shutdown, 10000},\n        {maxr, 10},\n        {maxt, 1}\n        ...\n    ]}\n\nand hackney will automatically use this pool.\n\nThe restart, shutdown, maxr, and maxt values allow to configure the\nsupervisor that will take care of that dispatcher. You can set the\nmaximum number of connections with the options passed to the client:\n`[{max_connections, 200}]` .\n\nNote: for now you can't force the pool handler / client.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenoitc%2Fhackney_disp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenoitc%2Fhackney_disp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenoitc%2Fhackney_disp/lists"}