{"id":13788826,"url":"https://github.com/Taymindis/ngx_lfqueue","last_synced_at":"2025-05-12T03:30:46.279Z","repository":{"id":132372009,"uuid":"149596669","full_name":"Taymindis/ngx_lfqueue","owner":"Taymindis","description":"ngx_lfqueue is the queue which share memory across multiple threads and multiple worker without any lock!! ","archived":false,"fork":false,"pushed_at":"2018-09-21T08:06:23.000Z","size":29,"stargazers_count":24,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T03:56:38.204Z","etag":null,"topics":["atomic-design","lfqueue","lock-free","nginx","queue-workers","queues","shared-memory","zerodowntime"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Taymindis.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}},"created_at":"2018-09-20T11:09:45.000Z","updated_at":"2024-04-13T15:57:13.000Z","dependencies_parsed_at":"2024-01-07T04:03:04.975Z","dependency_job_id":"3778b364-ab51-4b56-8538-a1aae025a50f","html_url":"https://github.com/Taymindis/ngx_lfqueue","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/Taymindis%2Fngx_lfqueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taymindis%2Fngx_lfqueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taymindis%2Fngx_lfqueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taymindis%2Fngx_lfqueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Taymindis","download_url":"https://codeload.github.com/Taymindis/ngx_lfqueue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253667942,"owners_count":21944943,"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":["atomic-design","lfqueue","lock-free","nginx","queue-workers","queues","shared-memory","zerodowntime"],"created_at":"2024-08-03T21:00:54.299Z","updated_at":"2025-05-12T03:30:45.976Z","avatar_url":"https://github.com/Taymindis.png","language":"C","readme":"# ngx_lfqueue\n\n\nTable of Contents\n=================\n\n* [Introduction](#introduction)\n* [Usage](#usage)\n* [Installation](#installation)\n* [Test](#test)\n* [Support](#support)\n* [Copyright \u0026 License](#copyright--license)\n\nIntroduction\n============\n\nngx_lfqueue is the lock free queue container running on nginx share memory and it read/write across multiple threads and multiple workers without any lock!\n\nngx_lfqueue is zero downtime nginx reloadable, data is on share memory, data is backupable in case nginx stop and start.\n\n\nUsage\n=======\n### 1. Setup your lfqueue\n\n#### There are 4 commands in this module\n\n**_ngx_lfqueue_memory_allocate_** - main config scope (1 argument)\nallocate the suitable share memory size for all the queue.\n\n**_ngx_lfqueue_name_** - main config scope (1 argument)\ninit or reload the queue with a queue name, if the queue name existed on backup data, it will load from backup data.\n\n**_ngx_lfqueue_backup_** - main config scope (2 arguments)\nbackup the data with special unique split key and file path, if file path not mentioned, it will stored under same directory of nginx config file.\n\n**_ngx_lfqueue_target_** - location config scope (1 argument)\ntarget which queue name to process data enqueue or dequeue.\n_POST METHOD_ - Enqueue request body data\n_GET METHOD_ - Dequeue queue message\n_HEAD METHOD_ - Get the queue Info\n\n```nginx\n# nginx.conf\nhttp {\n    ngx_lfqueue_memory_allocate 10m;\n    ngx_lfqueue_name q1;\n    ngx_lfqueue_name q2;\n    ngx_lfqueue_name q3;\n    ngx_lfqueue_backup |@| /tmp/ngx_lfqueue_data.txt;\t\n    ...\n}\n```\n\n### 2. Enqueue the message to specific queue name `ngx_lfqueue_target` by using POST/PUT method only, the request_body will be taken as queue message, response code 202\n```nginx\n# nginx.conf\n\nserver {\n    ....\n  location /processQueue {\n       ngx_lfqueue_target q1;\n   }\n\n   location /processQueueWithArgVariable {\n       ngx_lfqueue_target $arg_target;\n   }\n}\n```\n\n### 3. Dequeue the message by using GET method only, response code 200\n```nginx\n# nginx.conf\n\nserver {\n    ....\n   location /processQueue {\n       ngx_lfqueue_target q1;\n   }\n}\n```\n\n\n### 4. Get the queue info by using HEAD method only, response code 204, the headers response queue_size, total_enq, total_deq\n```nginx\n# nginx.conf\n\nserver {\n    ....\n   location /processQueue {\n       ngx_lfqueue_target q1;\n   }\n}\n```\n\n### Calling the service via using http call\n\n```bash\n\n# for enqueue\nPOST /processQueue HTTP/1.1\nHost: 127.0.0.1\nCache-Control: no-cache\nPostman-Token: 858bacc8-4826-9d8e-5ec5-fde220351b5d\n\n{\"Data\":\"MESSAGE 1.......\"}\n\n#  for dequeue\n\nGET /processQueue HTTP/1.1\nHost: 127.0.0.1\nCache-Control: no-cache\nPostman-Token: a0f89290-981a-2e18-cd99-40fa7fe734a0\n\n#  for dequeue by using variable pass in \n\n\nGET /processQueueWithArgVariable?target=q2 HTTP/1.1\nHost: 127.0.0.1\nCache-Control: no-cache\nPostman-Token: a0f89290-981a-2e18-cd99-40fa7fe734a0\n\n#  for queue info\n\nHEAD /processQueue HTTP/1.1\nHost: 127.0.0.1\nCache-Control: no-cache\nPostman-Token: 487251d4-51e9-33ee-58cf-343f259df27b\n\n```\n\nInstallation\n============\n\nngx_lfqueue is depends on [lfqueue](https://github.com/Taymindis/lfqueue) , install lfqueue as .so library before install ngx_lfqueue.\n\n\n```bash\nwget 'http://nginx.org/download/nginx-1.13.7.tar.gz'\ntar -xzvf nginx-1.13.7.tar.gz\ncd nginx-1.13.7/\n\n./configure --add-module=/path/to/ngx_lfqueue\n\nmake -j2\nsudo make install\n```\n\n[Back to TOC](#table-of-contents)\n\n\nTest\n=====\n\nIt depends on nginx test suite libs, please refer [test-nginx](https://github.com/openresty/test-nginx) for installation.\n\n\n```bash\ncd /path/to/ngx_lfqueue\nexport PATH=/path/to/nginx-dirname:$PATH \nsudo prove t\n```\n\n[Back to TOC](#table-of-contents)\n\nSupport\n=======\n\nPlease do not hesitate to contact minikawoon2017@gmail.com for any queries or development improvement.\n\n\n[Back to TOC](#table-of-contents)\n\nCopyright \u0026 License\n===================\n\nCopyright (c) 2018, Taymindis \u003ccloudleware2015@gmail.com\u003e\n\nThis module is licensed under the terms of the BSD license.\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n   list of conditions and the following disclaimer.\n2. Redistributions in binary form must reproduce the above copyright notice,\n   this list of conditions and the following disclaimer in the documentation\n   and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n[Back to TOC](#table-of-contents)\n\n\n\n## You may also like nginx lock free stack \n\n[ngx_lfstack](https://github.com/Taymindis/ngx_lfstack)\n","funding_links":[],"categories":["Third Party Modules"],"sub_categories":["C Modules"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTaymindis%2Fngx_lfqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTaymindis%2Fngx_lfqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTaymindis%2Fngx_lfqueue/lists"}