Return to Video

Pull Queues - Developing Scalable Apps with Java

  • 0:00 - 0:03
    Okay. So let's talk about another type of queue
  • 0:03 - 0:05
    called pull queues. This queue solves another kind of
  • 0:05 - 0:08
    problem. Let's say that you implemented a site that
  • 0:08 - 0:12
    requires humans to review comments. So the users of the
  • 0:12 - 0:15
    site generate comments and these comments need to be
  • 0:15 - 0:18
    reviewed before they are published. Similarly to push queues, you
  • 0:18 - 0:22
    could create a queue. And then insert comments to
  • 0:22 - 0:26
    be reviewed into this queue as tasks. And external people,
  • 0:26 - 0:29
    well in our case robots, could review the comments, perhaps
  • 0:29 - 0:32
    working from home in their spare time. So you have
  • 0:32 - 0:35
    your queue where you add comments as review tasks. Then
  • 0:35 - 0:38
    the different people would pull a review task from the queue
  • 0:38 - 0:41
    and work on it. So let's look at the difference
  • 0:41 - 0:44
    with push queues. Well in this case, App Engine is
  • 0:44 - 0:47
    not executing the tasks. They are instead executed by the
  • 0:47 - 0:51
    external workers. You can say that the task is pulled from
  • 0:51 - 0:54
    the queue by the external worker. That's why they are
  • 0:54 - 0:58
    called pull queues. The tasks that are pulled from the
  • 0:58 - 1:01
    queue are leased by the external workers. The worker must
  • 1:01 - 1:04
    complete the task within the lease time in which case it
  • 1:04 - 1:07
    can be deleted. But if the task is not completed
  • 1:07 - 1:10
    within the lease time, it is automatically returned to the
  • 1:10 - 1:13
    queue. If we compare a pull queues to push queues,
  • 1:13 - 1:16
    the differences are. So pull queues do not have a URL,
  • 1:16 - 1:20
    since your code is not completing the task. Each
  • 1:20 - 1:22
    task is leased by a worker for a certain
  • 1:22 - 1:26
    amount of time. A worker must delete the task
  • 1:26 - 1:29
    when it's completed, otherwise it is returned when the
  • 1:29 - 1:32
    lease expires. External workers pull the queue using a
  • 1:32 - 1:36
    REST interface. And there is no default queue for
  • 1:36 - 1:39
    pull queues, so you need to explicitly create them.
  • 1:39 - 1:41
    That's it for pull queues. Let's have a quiz.
タイトル:
Pull Queues - Developing Scalable Apps with Java
概説:

more » « less
Video Language:
English
Team:
Udacity
プロジェクト:
UD859 - Developing Scalable Apps
Duration:
01:42

English subtitles

改訂 Compare revisions