{"id":20345190,"url":"https://github.com/alekras/ex.rsrc_pool","last_synced_at":"2025-09-05T12:53:02.235Z","repository":{"id":57545022,"uuid":"263430906","full_name":"alekras/ex.rsrc_pool","owner":"alekras","description":"Resource pool is implemented in Elixir as a tiny library. The goal of the tool is reduce the overhead of creating new resources by reusing of the same resources among multiple processes. Database connection is most popular example for pooling resource.","archived":false,"fork":false,"pushed_at":"2020-06-24T21:42:48.000Z","size":69,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-04T15:47:32.975Z","etag":null,"topics":["connection-pool","elixir","pool","pooling","pooling-utility","resource-pool"],"latest_commit_sha":null,"homepage":"","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/alekras.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":"2020-05-12T19:21:30.000Z","updated_at":"2024-07-10T10:27:12.000Z","dependencies_parsed_at":"2022-08-27T04:22:13.551Z","dependency_job_id":null,"html_url":"https://github.com/alekras/ex.rsrc_pool","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alekras/ex.rsrc_pool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekras%2Fex.rsrc_pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekras%2Fex.rsrc_pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekras%2Fex.rsrc_pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekras%2Fex.rsrc_pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alekras","download_url":"https://codeload.github.com/alekras/ex.rsrc_pool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekras%2Fex.rsrc_pool/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273760725,"owners_count":25163177,"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-05T02:00:09.113Z","response_time":402,"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":["connection-pool","elixir","pool","pooling","pooling-utility","resource-pool"],"created_at":"2024-11-14T22:07:10.169Z","updated_at":"2025-09-05T12:53:02.161Z","avatar_url":"https://github.com/alekras.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Resource Pool - Getting started \n## Summary\nResource pool (**rsrc_pool_ex**)project is written in Elixir as a tiny library. The goal of the tool is reduce the overhead of creating new resources by reusing of the same resources among multiple processes. Achieving result is better performance and throughput. The resource pool was inspired by Java Apache's commons pool and adopts API and main principals from this project. Database connection is most popular example for pooling resource.\n\n## Introduction\nResource pool project was inspired by Apache Commons Pool library and API was borrowed from there. But internal \nimplementation is completely different, written in Elixir and it is using Erlang OTP design principles and Erlang concurrent model. Resource Pool is Elixir application library.   \n\n## Structure\n  - `ResourcePool.GenServer` (resource_pool_srv.ex) is a main module of Resource Pool. It is generic server and implements \n    almost all Pool functionality.\n  - `ResourcePool` (resource_pool.ex) is a facade for GenServer and exposes all API functions.\n  - `ResourceFactory` (resource_factory.ex) defines `ResourceFactory` behaviour.\n\n## Getting started\n  1. Create instance of Resource Pool\n     ```\n     {:ok, pid} = ResourcePool.new(:test_pool, ResourceFactory, [])\n     ```\n     where: \n       - `:test_pool` - registered name of the new pool;\n       - `ResourceFactory` - name of a module that implements `ResourceFactory` behaviour.\n     New resource pool is usually shared between few processes.  \n  2. Borrow resource from pool\n     ```\n     resource = ResourcePool.borrow(:test_pool)\n     ```\n     The process can use the borrowed resource and has to return to pool after finish. \n  3. Return resource to pool\n     ```\n     :ok = ResourcePool.return(:test_pool, resource)\n     ```\n     The process cannot use the `resource` anymore.\n  4. Pool can be created with options:\n     ```\n     options = [max_active: 10, when_exhausted_action: fail]\n     {:ok, pid} = ResourcePool.new(:test_pool, ResourceFactory, options)\n     ``` \n     See ResourcePool for more details about options.\n\nSee [**Resource Pool**](README_1.md) article for details and [http://erlpool.sourceforge.net/](http://erlpool.sourceforge.net/).\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `rsrc_pool_ex` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:rsrc_pool_ex, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm). Once published, the docs can\nbe found at [https://hexdocs.pm/rsrc_pool_ex](https://hexdocs.pm/rsrc_pool_ex).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falekras%2Fex.rsrc_pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falekras%2Fex.rsrc_pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falekras%2Fex.rsrc_pool/lists"}