본문 바로가기

쓸모 있는 제품

Product: Gearman - Open Source Message Queuing System

원제 : Product: Gearman - Open Source Message Queuing System

번역 : Product: Gearman - Open Source Message Queuing System

Update: New Gearman Server & Library in C, MySQL UDFs.

Gearman 은 여러 언어를 사용하여 분산 작업 처리를 쉽게 하는 오픈소스 message queuing 시스템입니다. Gearman과 함께: system that makes it easy to do distributed job processing using multiple languages. With Gearman you: farm out work to other machines, dispatching function calls to machines that are better suited to do work, to do work in parallel, to load balance lots of function calls, to call functions between languages, spread CPU usage around your network.

Gearman은 LiveJournal, Yahoo!, Digg과 같은 회사에서 사용합니다. Digg를 예로, 어떤 이슈도 없이 Gearman으로 하루에 30만개 작업이 동작합니다. 대부분 큰 사이트들은 비슷한 것을 사용합니다.  메시지 큐 시스템을 필요로 하지 않은 사람이 있겠습니까?

웹 서버로부터 작업(이미지 처리같은)을 줄이고, 백그라운드에서 수천개의 문서를 만들고, 웹 페이지를 구축하기 위해 병렬로 여러개의 요청을 운영하고 또는웹 요청을 서비스하는 메인 요청 루프의 부분이 아닌  백그라운드에서 편하게 작업을 수행하는데 메시지 큐는 편리한 방법입니다.

Perl, Ruby, Python, C으로 작성한 gearmand 서버와 클라이언트가 있습니다. 고가용성을 위해 적어도 2개 이상의 gearmand 서버를 사용하세요. 클라이언트가 수행하도록 gearman에 등록된 작업은 구현할 수 있는 클라이언트에게 이 기능을 위해 요청을 배포합니다(좀 어색하고 이해가 안되네).

높은 대기 시간과 signal-and-pull를 사용하면, Gearman은 매우 강력하게 사용합니다.

  • dormando 에 따르면 흐름은 다음과 같습니다:
    * worker connects to all gearmand servers.
    * worker registers what functions it supports.
    * worker asks for jobs.
    * if no jobs, sends command 'pre_sleep' to all gearmand's and sleeps.

  • Client does:
    * Connect to gearmand.
    * submit's a job for a particular func.

  • Gearmand does:
    * Acks the job, finds all *sleeping workers* related to the function.
    * Sends them all a 'noop' command to wake them up.

  • Worker does:
    * Urk, I'm awake now.
    * Worker asks for jobs.
    * If jobs, do work.
    * If no jobs, sends command 'pre_sleep' to all gearmand's, etc.

    Gearman 은 효율적인 바이너리 프로토콜을 사용하고 XML은 사용하지 않습니다. 관리를 위한 라인 기반의 텍스트 프로토콜이 있으며 그래서 여러분은 telnet을 이용하고 Nagios 플러그인으로 넣을 수 있습니다.

    시스템은 어떤 보증도 없습니다. 장애가 발생하면 클라이언트는 장애에 대해서 말해야되고 재시도도 클라이언트 책임집니다. 큐가 지속적이지 않기 때문에, gearman이 재시작하면 큐는 사라집니다.

    관련 기사

  • Gearman Wiki
  • German Google Groups
  • Queue everything and delight everyone by Leslie Michael Orchard.
  • USENIX 2007. Starts at slide 83.
  • PEAR and Gearman by Daniel O'Connor.
  • Amazon Architecture