Horizon: [QUESTION] Supervisor memory parameter

Created on 29 Nov 2017  路  1Comment  路  Source: laravel/horizon

When you launch a Laravel Horizon supervisor with the --memory parameter, does this allowed memory amount is shared among all children worker processes, or it is the amount allowed for each children worker process ?

For example, using --memory=128 with 5 workers :

  • It is 128M total allowed shared by the 5 workers ?
  • or it is 128M allowed for each worker => 5 x 128 = 640M total allowed memory ?

Most helpful comment

After digging in source code, i think i got my answer : it seems it is allowed memory per worker. (ie: for each worker).

If someone else interested : it monitors memory using PHP memory_get_usage() methods and acts accordingly.

Also an important note : ensure that your PHP memory_limit configuration options is properly set.

For example, if PHP memory_limit is 64M and Horizon worker memory option is set to 128 then if a worker process consumes more than 64M it will crash before Horizon supervisor handling and will obviously result in a timed out job.

This happened to me because i run jobs which use lot of memory _(large image size processing)_.

>All comments

After digging in source code, i think i got my answer : it seems it is allowed memory per worker. (ie: for each worker).

If someone else interested : it monitors memory using PHP memory_get_usage() methods and acts accordingly.

Also an important note : ensure that your PHP memory_limit configuration options is properly set.

For example, if PHP memory_limit is 64M and Horizon worker memory option is set to 128 then if a worker process consumes more than 64M it will crash before Horizon supervisor handling and will obviously result in a timed out job.

This happened to me because i run jobs which use lot of memory _(large image size processing)_.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pmartelletti picture pmartelletti  路  4Comments

okaufmann picture okaufmann  路  3Comments

rossuhms picture rossuhms  路  5Comments

mikeminckler picture mikeminckler  路  3Comments

slavarazum picture slavarazum  路  3Comments