{"id":21397310,"url":"https://github.com/silviucpp/ebeanstalkd","last_synced_at":"2025-07-13T20:32:06.878Z","repository":{"id":65205572,"uuid":"64751991","full_name":"silviucpp/ebeanstalkd","owner":"silviucpp","description":"A high performant Erlang client for beanstalkd work queue","archived":false,"fork":false,"pushed_at":"2024-03-13T21:40:21.000Z","size":67,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-14T20:44:55.952Z","etag":null,"topics":["beanstalkd","client","erlang"],"latest_commit_sha":null,"homepage":"","language":"Erlang","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/silviucpp.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":"2016-08-02T11:41:23.000Z","updated_at":"2024-03-14T20:44:55.953Z","dependencies_parsed_at":"2024-03-13T20:36:55.411Z","dependency_job_id":"328dfd12-68c5-49a8-937b-52a2de0d055f","html_url":"https://github.com/silviucpp/ebeanstalkd","commit_stats":{"total_commits":34,"total_committers":2,"mean_commits":17.0,"dds":0.2647058823529411,"last_synced_commit":"34d88fcbde444d9ea6f6edaaae99428a2d0bdbfd"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/silviucpp/ebeanstalkd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silviucpp%2Febeanstalkd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silviucpp%2Febeanstalkd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silviucpp%2Febeanstalkd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silviucpp%2Febeanstalkd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/silviucpp","download_url":"https://codeload.github.com/silviucpp/ebeanstalkd/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silviucpp%2Febeanstalkd/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265199849,"owners_count":23726722,"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":["beanstalkd","client","erlang"],"created_at":"2024-11-22T14:41:36.199Z","updated_at":"2025-07-13T20:32:06.867Z","avatar_url":"https://github.com/silviucpp.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ebeanstalkd\n\n[![Build Status](https://app.travis-ci.com/silviucpp/ebeanstalkd.svg?branch=master)](https://travis-ci.com/github/silviucpp/ebeanstalkd)\n[![GitHub](https://img.shields.io/github/license/silviucpp/ebeanstalkd)](https://github.com/silviucpp/ebeanstalkd/blob/master/LICENSE)\n[![Hex.pm](https://img.shields.io/hexpm/v/ebeanstalkd)](https://hex.pm/packages/ebeanstalkd)\n\nA high performant Erlang client for [beanstalkd][1] work queue\n\n### Features\n\n- Automatically detects server downtime and periodically attempts reconnection.\n- Offers notifications to another process when the connection goes down or is restored.\n- Includes support for connection pooling via `erlpool`.\n- High message throughput, exceeding 50K messages per second over a single connection.\n- Protection against Out of Memory (OOM) errors.\n- Operates with binary strings but also accepts lists.\n\n### Quick start\n\nAdd `ebeanstalkd` as a dependency to your project. The library works with `rebar3` or `hex.pm`\n\n```erlang\n{deps, [\n  {ebeanstalkd, \".*\", {git, \"https://github.com/silviucpp/ebeanstalkd.git\", \"master\"}},\n}.\n```\n\nThe API is straightforward. For instance, the following code demonstrates creating a connection, adding a job, reserving the job, deleting it, and then closing the connection:\n\n```erlang\n{ok, Pid} = ebeanstalkd:connect().\n{inserted, Id} = ebeanstalkd:put(Pid, \u003c\u003c\"job body\"\u003e\u003e).\n{reserved, Id, \u003c\u003c\"job body\"\u003e\u003e} = ebeanstalkd:reserve(Pid).\n{deleted} = ebeanstalkd:delete(Pid, Id).\nok = ebeanstalkd:close(Pid).\n```\n\nWhile connecting you can specify the following options (using `ebeanstalkd:connect/1`):\n\n- `host` - Beanstalkd server host. Default `{127,0,0,1}` example: `{host, {127,0,0,1}`\n- `port` - Beanstalkd server port. Default `11300` example: `{port, 11300}`\n- `timeout` - Connection timeout in milliseconds. Default `5000` example: `{timeout, 5000}`\n- `tube` - Specify what tube(s) to use or watch. Example: `{tube, {watch, [\u003c\u003c\"tube1\"\u003e\u003e, \u003c\u003c\"tube2\"\u003e\u003e]}}` or `{tube, {use, \u003c\u003c\"tube1\"\u003e\u003e}}` \n- `reconnect_interval` - After how many milliseconds should try again to reconnect. Default `5000` example: `{reconnect_interval, 5000}`\n- `monitor` - The process pid that should return the connection up and connection down messages. Default is `undefined` example: `{monitor, self()}`\n\nIn case the `monitor` parameter is set, the specified pid will receive the following messages:\n\n- `{connection_status, {up, ConnectionPid}}` - Triggered when connection is ready to be used\n- `{connection_status, {down, ConnectionPid}}` - Triggered when connection is broken\n\n### Connection pool\n\nYou can specify in the `sys.config` the pool specs in the following format:\n\n```erlang\n{ebeanstalkd, [\n    {pools, [\n        {bk_pool,[\n            {size, 50},\n            {host, {127,0,0,1}},\n            {port, 11300},\n            {timeout, 5000},\n            {tube, {use, \u003c\u003c\"poolname\"\u003e\u003e}}\n        ]}\n    ]}\n]}\n```\n\nThe API is identical whether you use a connection pool or a plain connection mechanism. The only difference is that, instead of using a PID as the first parameter, you use the pool name (an atom): \n\n```erlang\napplication:ensure_all_started(ebeanstalkd).\n{inserted, Id} = ebeanstalkd:put(pool_one, \u003c\u003c\"hello\"\u003e\u003e).\n{reserved, ID, \u003c\u003c\"hello\"\u003e\u003e} = ebeanstalkd:reserve(pool_one).\n{deleted} = ebeanstalkd:delete(pool_one, ID).\n```\n\nAll supported commands from the protocol are exported in `ebeanstalkd` module.\n\n### Performance testing\n\nFrom the `benchmark` folder you can use the `load_test:run/4` method to run benchmarks. Make sure you define a pool called `bk_pool` in your `sys.config` or use the one from the same location.\n\nThe `load_test:run(Profiling, ClientsNr, ReqNr, PayloadLength)` can take the following values:\n \n- `Method` - Specify if you want to profile the erlang processes during the test.\n- `ClientsNr` - how many processes should spawn to send requests\n- `ReqNr` - how many requests should send during the test.\n- `PayloadLength` - what length will have the message payload sent to the server\n\nExample:\n\n```erl\nload_test:run(false, 10, 100000, 5*1024).\n```\n\nYou can run the benchmark by running `make bench`\n\n### Custom features\n\nThe following features are only available when using [my server fork][2]:\n\n- `ebeanstalkd:put_in_tube2` - place a job into a specific tube in a single command (`put_in_tube`), a functionality not supported by the official protocol. Many clients issue a `use` command followed by a `put`, which reduces performance. Instead, `ebeanstalkd` provides this functionality directly via `ebeanstalkd:put_in_tube`.\n- `ebeanstalkd:kick_job_delay` - for a buried job only: instead move the job into ready queue (still possible if delay = 0), offers the possibility to move it into the delay queue and to be ready after a certain amount of time. \n- The `capabilities` configuration accepts a list with the following options:\n    - `jobs_with_tube` - Configures the server to return the tube to which a job belongs. Instead of `{Tag, JobId, JobBody}`, the server will respond with `{Tag, JobId, TubeName, JobBody}`.\n\n[1]:https://github.com/beanstalkd/beanstalkd\n[2]:https://github.com/silviucpp/beanstalkd\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilviucpp%2Febeanstalkd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsilviucpp%2Febeanstalkd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilviucpp%2Febeanstalkd/lists"}