
GearmanWorker::__construct에서 $worker_options 배열을 구성하는 방법은 다음과 같습니다.
- debug: Gearman Worker의 디버그 모드를 활성화합니다. (true/false)
- timeout: Gearman Worker의 타임아웃 시간을 설정합니다. (초)
- concurrency: Gearman Worker가 처리할 작업의 동시성을 설정합니다. (정수)
- max_concurrency: Gearman Worker가 처리할 작업의 최대 동시성을 설정합니다. (정수)
- max_jobs: Gearman Worker가 처리할 작업의 최대 수를 설정합니다. (정수)
- max_tasks: Gearman Worker가 처리할 작업의 최대 태스크 수를 설정합니다. (정수)
- max_uploads: Gearman Worker가 처리할 업로드의 최대 수를 설정합니다. (정수)
예를 들어, $worker_options 배열을 다음과 같이 구성할 수 있습니다.
#hostingforum.kr
php
$worker_options = array();
$worker_options['debug'] = true;
$worker_options['timeout'] = 10;
$worker_options['concurrency'] = 5;
$worker_options['max_concurrency'] = 10;
$worker_options['max_jobs'] = 100;
$worker_options['max_tasks'] = 500;
$worker_options['max_uploads'] = 50;
GearmanWorker::__construct에서 $host, $port, $manager_options, $worker_options를 사용하는 방법은 다음과 같습니다.
- $host: Gearman Manager의 호스트 이름 또는 IP 주소를 설정합니다.
- $port: Gearman Manager의 포트 번호를 설정합니다.
- $manager_options: Gearman Manager의 옵션을 설정합니다.
- $worker_options: Gearman Worker의 옵션을 설정합니다.
예를 들어, 다음과 같이 코드를 작성할 수 있습니다.
#hostingforum.kr
php
$worker = new GearmanWorker();
$worker->addServer('localhost', 4730);
$worker->addServer('otherhost', 4730);
$worker_options = array();
$worker_options['debug'] = true;
$worker_options['timeout'] = 10;
$worker->setOptions($worker_options);
$worker->startWorker();
GearmanWorker::__construct에서 $worker_options 배열을 구성하는 방법은 위에서 설명한 방법과 같습니다.
2025-06-09 10:57