Return to Video

Push Queues - Developing Scalable Apps with Java

  • 0:00 - 0:03
    All right, let's talk about the different task queues and
  • 0:03 - 0:05
    start off with the push queue which is the most
  • 0:05 - 0:08
    common one. The execution of push queues are managed by
  • 0:08 - 0:12
    App Engine itself. This means that App Engine has worker threads
  • 0:12 - 0:16
    that scan these queues and pick up tasks. These threads
  • 0:16 - 0:18
    then call a URL that you have specified when you
  • 0:18 - 0:21
    insert the task in the queue. This means that the
  • 0:21 - 0:26
    execution is broken out from the HTTP request response flow since
  • 0:26 - 0:30
    App Engine provide the threads to execute the tasks.
  • 0:30 - 0:32
    But the code used to process each task is still
  • 0:32 - 0:35
    provided by you, since you provide the URL that
  • 0:35 - 0:38
    the worker threads call. The best of two worlds, a
  • 0:38 - 0:41
    generic execution methodology,. That works with code that you
  • 0:41 - 0:45
    write. So the worker thread picks up task by task
  • 0:45 - 0:48
    and calls your url for each of them. And this
  • 0:48 - 0:51
    behavior continues for all the tasks in the queue until
  • 0:51 - 0:55
    the queue is empty. By default, the maximum execution duration
  • 0:55 - 0:58
    for a task is ten minutes. It is of course up
  • 0:58 - 1:00
    to you when you develop the application to split up
  • 1:00 - 1:03
    the work into tasks that can be completed within this time,
  • 1:03 - 1:07
    for example 100 mails each. There are many different configuration
  • 1:07 - 1:10
    options for queues in the following screen, we will look at
  • 1:10 - 1:13
    some of them. First to note is that the queues of
  • 1:13 - 1:16
    the find in the queue configuration file when you do development.
  • 1:16 - 1:19
    All queues have a queue name. For all applications,
  • 1:19 - 1:22
    half engine order provides a default queue with the name
  • 1:22 - 1:26
    default. This queue can be used without adding anything to
  • 1:26 - 1:29
    the queue configuration file but you may want to change
  • 1:29 - 1:31
    its default options, in which case you need to
  • 1:31 - 1:34
    define it in the file. Other things you can configure
  • 1:34 - 1:38
    are the performance parameters such as, the rate of processing,
  • 1:38 - 1:41
    the maximum rate in case of traffic peaks. The bucket
  • 1:41 - 1:45
    size and the maximum number of concurrent tasks that can
  • 1:45 - 1:48
    be executed. There are also a lot of parameters surrounding
  • 1:48 - 1:51
    error management. So now we've talked about how to define
  • 1:51 - 1:54
    a queue. Let's finish this part by looking at how to
  • 1:54 - 1:57
    create a task and assign it to a queue for
  • 1:57 - 2:00
    execution. The first thing you do is get the queue by
  • 2:00 - 2:03
    the queue name then you create the task and set
  • 2:03 - 2:07
    options such as the task name, the url to process the
  • 2:07 - 2:10
    task, another parameter such as performance and retry
  • 2:10 - 2:13
    options and finally you add the task to the
  • 2:13 - 2:16
    queue for execution. Finally, it is important that you
  • 2:16 - 2:20
    to protect the URL so only administrators can access
  • 2:20 - 2:23
    them through the permission settings. You don't want external
  • 2:23 - 2:26
    users to be able to execute your task logic
  • 2:26 - 2:30
    should they get ahold of these URL's. That was
  • 2:30 - 2:32
    a lot of theory, but that's it for now.
  • 2:32 - 2:35
    Now the time is come for you to do some work because we
  • 2:35 - 2:39
    have an exercise coming up where you will use push queues. Good luck.
タイトル:
Push Queues - Developing Scalable Apps with Java
概説:

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

English subtitles

改訂 Compare revisions