我正在使用gearman进行并行处理,并提高了在Symfony2中开发的应用程序的性能。
并行处理工作正常,但是,几天前我发现当我有一组工作正在执行并且第一个齿轮装置结束时,它会支持我这项工作的结果,而其他工作仍然在后台运行。
这对我来说是一个问题,因为如果我希望我的应用程序正常运行,我需要并行运行作业的所有答案。
我需要同步并行地实现一系列工作。
这是我的配置齿轮包:
gearman:
# Lista de bundles donde Gearman va a buscar Workers
bundles:
# Aquí declaramos cada uno de los bundles donde se van declarar workers de Gearman
# Nosotros vamos a usar el MainBundle, donde tenemos definidos nuestros workers
MainBundle:
# Nombre del bundle ()
name: AppBundle
# Bundle search can be enabled or disabled
active: true
# Lista de directorios donde gearman va a buscar las definiciones de workers
# == MUY IMPORTANTE == -> estos directorios deben de existir dentro del bundle, sinó Gearman dará un error
include:
- Services
- Workers
# Directorios que se van a ignorar
ignore:
- DependencyInjection
- Resources
# Valores por defecto que va a usar Gearman en la definición de los workers
# Estos valores se pueden especificar para cada worker
defaults:
# Default method related with all jobs
# do // deprecated as of pecl/gearman 1.0.0. Use doNormal
# doNormal
# doBackground
# doHigh
# doHighBackground
# doLow
# doLowBackground
method: doNormal
# Default number of executions before job dies.
# If annotations defined, will be overwritten
# If empty, 0 is defined by default
iterations: 0
# Default amount of time in seconds required for the execution to run.
# This is useful if using a tool such as supervisor which may expect a command to run for a
# minimum period of time to be considered successful and avoid fatal termination.
# If empty, no minimum time is required
# minimum_execution_time: null
# Default maximum amount of time in seconds for a worker to remain idle before terminating.
# If empty, the worker will never timeout
# timeout: null
# execute callbacks after operations using Kernel events
callbacks: true
# Prefix in all jobs
# If empty name will not be modified
# Useful for rename jobs in different environments
job_prefix: null
# Autogenerate unique key in jobs/tasks if not set
# This key is unique given a Job name and a payload serialized
generate_unique_key: true
# Prepend namespace when callableName is built
# By default this variable is set as true
workers_name_prepend_namespace: true
# Server list where workers and clients will connect to
# Each server must contain host and port
# If annotations defined, will be full overwritten
#
# If servers empty, simple localhost server is defined by default
# If port empty, 4730 is defined by default
servers:
localhost:
host: 127.0.0.1
port: 4730
如果您需要更多信息,请向他们索取。
谢谢。