Horizon exposes a dashboard at the /horizon URI. When the balance option is set to false, the default Laravel behavior will be used, wherein queues are processed in the order they are listed in your configuration. You are free to tweak these values as necessary based on your application's needs. In the example above, a maximum of one new process will be created or destroyed every three seconds. The balanceMaxShift and balanceCooldown configuration values determine how quickly Horizon will scale to meet worker demand. The autoScalingStrategy configuration value determines if Horizon will assign more worker processes to queues based on the total amount of time it will take to clear the queue ( time strategy) or by the total number of jobs on the queue ( size strategy). The simple strategy splits incoming jobs evenly between worker processes: Unlike Laravel's default queue system, Horizon allows you to choose from three worker balancing strategies: simple, auto, and false. The supervisor's default configuration values will be merged into the supervisor's configuration for each environment, allowing you to avoid unnecessary repetition when defining your supervisors. This configuration option specifies the default values for your application's supervisors. Within Horizon's default configuration file, you will notice a defaults configuration option. You may choose to do this if you would like to define a different balancing strategy or worker process count for a given queue used by your application. You may add additional supervisors to a given environment if you would like to define a new group of worker processes that should run in that environment. Each supervisor is essentially responsible for "supervising" a group of worker processes and takes care of balancing worker processes across queues. By default, the configuration file defines this supervisor as supervisor-1 however, you are free to name your supervisors whatever you want. You should ensure that the environments portion of your horizon configuration file contains an entry for each environment on which you plan to run Horizon.Īs you can see in Horizon's default configuration file, each environment can contain one or more "supervisors". The default production environment is configured to start a maximum of 10 worker processes and automatically balance the number of worker processes assigned to each queue. For example, the default local Horizon environment is configured to start three worker processes and automatically balance the number of worker processes assigned to each queue. Typically, the environment is determined by the value of the APP_ENV environment variable. When you start Horizon, it will use the worker process configuration options for the environment that your application is running on. However, you are free to add more environments as needed: By default, this entry contains a production and local environment. This configuration option is an array of environments that your application runs on and defines the worker process options for each environment. This Redis connection name is reserved and should not be assigned to another Redis connection in the database.php configuration file or as the value of the use option in the horizon.php configuration file.Īfter installation, the primary Horizon configuration option that you should familiarize yourself with is the environments configuration option. Horizon uses a Redis connection named horizon internally. Each configuration option includes a description of its purpose, so be sure to thoroughly explore this file. This configuration file allows you to configure the queue worker options for your application. You may install Horizon into your project using the Composer package manager:Īfter publishing Horizon's assets, its primary configuration file will be located at config/horizon.php. Therefore, you should ensure that your queue connection is set to redis in your application's config/queue.php configuration file. Laravel Horizon requires that you use Redis to power your queue. By defining your application's worker configuration in a version controlled file, you may easily scale or modify your application's queue workers when deploying your application. When using Horizon, all of your queue worker configuration is stored in a single, simple configuration file. Horizon allows you to easily monitor key metrics of your queue system such as job throughput, runtime, and job failures. Laravel Horizon provides a beautiful dashboard and code-driven configuration for your Laravel powered Redis queues. Horizon augments Laravel's queue with additional features that may be confusing if you are not already familiar with the basic queue features offered by Laravel. Before digging into Laravel Horizon, you should familiarize yourself with Laravel's base queue services.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |