{"id":21424989,"url":"https://github.com/alekras/rsrc_pool","last_synced_at":"2025-03-16T20:45:47.630Z","repository":{"id":57545019,"uuid":"51341206","full_name":"alekras/rsrc_pool","owner":"alekras","description":"Resource pool project is written in Erlang 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-26T17:36:36.000Z","size":71,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-25T07:21:34.960Z","etag":null,"topics":["connection-pool","erlang","pool","pooling","pooling-utility","resource-pool"],"latest_commit_sha":null,"homepage":"","language":"Erlang","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":"2016-02-09T02:03:36.000Z","updated_at":"2024-03-13T23:46:06.000Z","dependencies_parsed_at":"2022-08-27T04:22:12.892Z","dependency_job_id":null,"html_url":"https://github.com/alekras/rsrc_pool","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekras%2Frsrc_pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekras%2Frsrc_pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekras%2Frsrc_pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekras%2Frsrc_pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alekras","download_url":"https://codeload.github.com/alekras/rsrc_pool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243933371,"owners_count":20370989,"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":["connection-pool","erlang","pool","pooling","pooling-utility","resource-pool"],"created_at":"2024-11-22T21:26:04.731Z","updated_at":"2025-03-16T20:45:47.603Z","avatar_url":"https://github.com/alekras.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Resource Pool (rsrc_pool)\nResource pool project is written in Erlang 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 and is using Erlang OTP design principles and Erlang concurrent model. Resource Pool\nis Erlang application library.\n\n## Structure\n\u003cul\u003e\n  \u003cli\u003e\u003ccode\u003eresource_pool_srv.erl\u003c/code\u003e is a main module of Resource Pool. It is generic server and implements\nalmost all Pool functionality.\u003c/li\u003e\n  \u003cli\u003e\u003ccode\u003eresource_pool.erl\u003c/code\u003e is a facade for gen_server and exposes all API functions.\u003c/li\u003e\n  \u003cli\u003e\u003ccode\u003eresource_factory.erl\u003c/code\u003e defines \u003ci\u003eresource_factory\u003c/i\u003e behaviour and acts as a template and \nsimple implementation resource factory for testing purpose.\u003c/li\u003e\n\u003c/ul\u003e\n\n## Getting started\n\u003col\u003e\n  \u003cli\u003eCreate instance of Resource Pool\u003cbr/\u003e \n    \u003cpre\u003e{ok, Pid} = resource_pool:new(test_pool, resource_factory, [])\u003c/pre\u003e\n    where: \n    \u003cul style=\"list-style-type:none;\"\u003e\n      \u003cli\u003e\u003ccode\u003etest_pool\u003c/code\u003e - registered name of the new pool;\u003c/li\u003e\n      \u003cli\u003e\u003ccode\u003eresource_factory\u003c/code\u003e - name of a module that implements resource_factory behaviour.\u003c/li\u003e\n    \u003c/ul\u003e\n    New resource pool is usually shared between few processes.  \n  \u003c/li\u003e\n  \u003cli\u003eBorrow resource from pool\u003cbr/\u003e\n    \u003cpre\u003eResource = resource_pool:borrow(test_pool)\u003c/pre\u003e\n    The process can use the borrowed resource and has to return to pool after finish. \n  \u003c/li\u003e\n  \u003cli\u003eReturn resource to pool\u003cbr/\u003e\n      \u003cpre\u003eok = resource_pool:return(test_pool, Resource)\u003c/pre\u003e\n      The process cannot use the \u003ccode\u003eResource\u003c/code\u003e anymore.\n  \u003c/li\u003e\n  \u003cli\u003ePool can be created with options:\u003cbr/\u003e\n    \u003cpre\u003eOptions = [{max_active, 10}, {when_exhausted_action, fail}]\u003c/pre\u003e\n    \u003cpre\u003e{ok, Pid} = resource_pool:new(test_pool, resource_factory, Options)\u003c/pre\u003e\n    See resource_pool for more details about options. \n  \u003c/li\u003e\n\u003c/ol\u003e\n\nSee [Resource Pool](article.md) article for details and [http://erlpool.sourceforge.net/](http://erlpool.sourceforge.net/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falekras%2Frsrc_pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falekras%2Frsrc_pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falekras%2Frsrc_pool/lists"}