Download the PHP package ph4r05/laravel-queue-database-ph4 without Composer
On this page you can find all versions of the php package ph4r05/laravel-queue-database-ph4. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ph4r05/laravel-queue-database-ph4
More information about ph4r05/laravel-queue-database-ph4
Files in ph4r05/laravel-queue-database-ph4
Package laravel-queue-database-ph4
Short Description Laravel Database queue driver with optimistic locking
License MIT
Informations about the package laravel-queue-database-ph4
Database Queue driver for Laravel with optimistic locking
Laravel database queue implementation using optimistic locking. Increases concurrency, eliminates deadlocks.
Installation
-
Install this package via composer using:
-
Create job table
- Queue configuration
- The
num_workers
should correspond to the number of workers processing jobs in the queue. window_strategy
.- 0 means worker selects one available job for processing. Smaller throughput, job ordering is preserved as with pessimistic locking.
- 1 means workers will select
num_workers
next available jobs and picks one at random. Higher throughput with slight job reordering (for more info please refer to the blog)
To use the optimistic locking you can now change your .env
:
Usage
Once you completed the configuration you can use Laravel Queue API. If you used other queue drivers you do not need to change anything else. If you do not know how to use Queue API, please refer to the official Laravel documentation: http://laravel.com/docs/queues
Testing
Run the tests with:
Blog post about optimistic locking
https://ph4r05.deadcode.me/blog/2017/12/23/laravel-queues-optimization.html
Benefits:
- No need for explicit transactions. Single query auto-commit transactions are OK.
- No DB level locking, thus no deadlocks. Works also with databases without deadlock detection (older MySQL).
- Job executed exactly once (as opposed to pessimistic default DB locking)
- High throughput.
- Tested with MySQL, PostgreSQL, Sqlite.
Cons:
- Job ordering can be slightly shifted with multiple workers (reordering 0-70 in 10 000 jobs)
Contribution
You can contribute to this package by discovering bugs and opening issues. Please, add to which version of package you create pull request or issue.
Donations
Thank you for all your support!
Monero:
Bitcoin:
All versions of laravel-queue-database-ph4 with dependencies
illuminate/support Version ^6.2
illuminate/database Version 6.*
illuminate/queue Version 6.*