Home Database Mysql Tutorial 浅谈Hadoop YARN中的事件驱动机制

浅谈Hadoop YARN中的事件驱动机制

Jun 07, 2016 pm 04:29 PM
hadoop yarn event author mechanism drive

作者: Dong | 新浪微博: 西成懂 | 可以转载, 但必须以超链接形式标明文章原始出处和作者信息及版权声明 网址:http://dongxicheng.org/mapreduce-nextgen/hadoop-yarn-event-driven/ 1. 函数调用与事件驱动 在基于函数调用的编程方式中,当一个对象要向另外

1. 函数调用与事件驱动

在基于函数调用的编程方式中,当一个对象要向另外一个对象传递信息时,会直接采用函数调用的方式。比如在Hadoop中,当TaskTracker需要执行一个Task时,一般首先下载Task以来的文件(jar包、二进制文件等、字典文件等)、然后执行Task,同时在整个过程中,会记录一些关键日志,该过程可用下图表示:

基于函数调用的编程模型是低效的,它隐含中整个过程是串行、同步进行的。一种更为先进的编程模型是事件驱动,这在Hadoop YARN和Mesos等分布式系统中得到了广泛应用。在基于事件驱动的编程模型中,所有对象被抽象成了事件处理器,而事件处理器之间通过事件相互关联。每种事件处理器处理一种类型的事件,同时根据需要触发另外一种事件,该过程如下图所示。

相比于基于函数调用的编程模型,这种编程方式具有异步、并发等特点,更加高效,因此更加适合大型分布式系统。

2. Hadoop YARN中的事件驱动

我们以Hadoop中的调度器框架为例说明基于事件驱动的开发模块给Hadoop带来的变化。在Hadoop 1.0中,Hadoop中的调度器是可插拔的,一次调度过程如下所示:

步骤1???? TaskTracker向JobTracker发送心跳,请求新的任务

步骤2???? JobTracker收到心跳信息后,调用TaskScheduler(可能是JobQueueTaskScheduler、FairScheduler或者CapacityTaskScheduler)的assignTasks()函数,为该TaskTracker分配任务。

步骤3???? TaskScheduler通过一定的策略选择一个或者多个任务,并返回给JobTracker

步骤4???? JobTracker通过心跳应答将任务发给TaskTracker。

注意,上面的步骤1~4是一气呵成的,仅当这四个步骤全部完成,一次心跳发送才算完成。

而在YARN中,由于采用了事件驱动,资源汇报和任务获取可异步进行。如下图所示,NodeManager向ResourceManager汇报心跳信息后,ResourceManager会简单收集一些信息直接返回给对应的NodeManager,同时触发一个NODE_UPDATE事件,该事件会被ResourceScheduler接收并处理,如果ResourceScheduler发现节点有空闲资源,则采用一定的分配算法将该资源分配给应用程序,并将分配结果暂时放到一个缓冲区中,等待ApplicationMaster自己来取。

总之,采用事件驱动之后,ResourceManager中的心跳处理和资源分配可以异步并发进行,而不像JobTracker那样同步串行进行。

原创文章,转载请注明: 转载自董的博客

本文链接地址: http://dongxicheng.org/mapreduce-nextgen/hadoop-yarn-event-driven/

作者:Dong,作者介绍:http://dongxicheng.org/about/


Copyright © 2013
This feed is for personal, non-commercial use only.
The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:
)
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Does Logitech ghub driver not support win7? -Why can Logitech ghub driver only be installed on the c drive? Does Logitech ghub driver not support win7? -Why can Logitech ghub driver only be installed on the c drive? Mar 18, 2024 pm 05:37 PM

Does Logitech ghub driver not support win7? Not compatible. Since Windows 7 has stopped updating and is no longer Microsoft's main operating system, many new software no longer supports it, such as Logitech ghub. The main interface of the Logitech driver: 1. The main software interface is on the left. The three buttons are lighting, buttons, and sensitivity settings. 2. In the settings of the lighting interface, the general special effects are relatively conventional, and the audio visual effects are the highlight. They can change color according to the sound frequency, and can be set according to the high, middle and bass bands, with different colors and effects. 3. In button settings, users can edit them here according to their special requirements. 4. In the sensitivity settings, many users will have some of their own settings. They can add the DPI speed switching point by themselves, but

Steps to restore Logitech driver to default configuration Steps to restore Logitech driver to default configuration Feb 28, 2024 am 11:04 AM

Facing the Logitech driver that cannot be used normally, it can only be solved by restoring the factory settings. However, many friends do not know how to restore the factory settings. The following will provide you with detailed steps to restore the factory settings. I hope it can help you. Steps to restore the Logitech driver to the default configuration: 1. First download the Logitech dedicated driver software GHub, and open it after the download is complete. 2. Then open the mouse to set up, and click the settings (gear) in the upper right corner. 3. At the bottom, click "Restore default settings" , click directly and reopen the software to restore factory settings. How to connect the Logitech driver to the device 1. Open the back cover of the mouse and take out the wireless mouse socket. 2. Select the mouse socket next to the computer. 3. Set the corresponding parameter information for the mouse. 4. Bluetooth pair the device and long press Bluetooth.

How to download Razer mouse driver How to download Razer mouse driver Mar 11, 2024 pm 03:40 PM

Steps to download the Razer mouse driver: 1. Open the browser and enter the Razer official website; 2. On the official website page, find and click "Technical Support" or a similar option; 3. On the technical support page, select "Mouse" or the specific subcategory; 4. On the mouse driver download page, you can see various mouse models and their corresponding drivers; 5. Click the download link for the selected driver; 6. After the download is completed, check whether the downloaded file is complete , make sure nothing is damaged or missing.

How to solve the problem that win11 driver does not have digital signature? Tutorial to solve the problem that win11 driver does not have digital signature How to solve the problem that win11 driver does not have digital signature? Tutorial to solve the problem that win11 driver does not have digital signature Feb 19, 2024 pm 11:20 PM

When we install the win11 system or run the program, we sometimes need a digital signature to use it normally. However, many users are asking how to solve the problem that the win11 driver does not have a digital signature? Users can open a Windows Powershell window with administrator rights to perform operations. Let this site carefully introduce to users the solution to the problem that the win11 driver does not have a digital signature. Solution to the problem that the win11 driver does not have a digital signature: 1. Press the [Win+X] key combination, or [right-click] click the [Windows logo] on the taskbar, and select [Run] in the menu item that opens. 2. In the run window, enter [powershel

How to install win11 driver without digital signature_Tutorial on how to deal with win11 driver without digital signature How to install win11 driver without digital signature_Tutorial on how to deal with win11 driver without digital signature Mar 20, 2024 pm 04:46 PM

Some users have encountered some problems when installing drivers for win11 computers. The computer prompts that the digital signature of this file cannot be verified, resulting in the inability to install the driver. How to solve this problem? Please see the following introduction for details. 1. Press the [Win + [Ctrl+Shift+Enter] Open the Windows Powershell window with administrator rights; 3. User Account Control window, do you want to allow this application to make changes to your device? Click [Yes]; 4. Administrator: Windows Powers

Teach you how to quickly install the printer driver (detailed tutorial) Teach you how to quickly install the printer driver (detailed tutorial) Mar 14, 2024 am 11:30 AM

After the computer is connected to the printer, the corresponding printer driver needs to be installed for normal operation. Some printer faults also need to be solved through the printer driver. So how do we install the printer driver? There are mainly two methods, one is manual and the other is using third-party software. Method 1: For the manual installation method, make sure you know the brand and model of the printer you are using. You can look it up on the details page or manual at the time of purchase. You can also look for the relevant logo on the printer itself. Enter the brand name in the search engine, look for the official website, enter [Software and Driver Download], select [Printer], enter the product model, and download the printer driver. After the download is completed, find the corresponding program and double-click to install it. Wait until the installation is completed.

Where to open the sound card driver Where to open the sound card driver Feb 22, 2024 pm 01:39 PM

Where to open the sound card driver? The sound card driver is a very important part of the computer. It is responsible for processing the input and output of sound signals, as well as decoding and encoding sound signals. In the operating system, we can control and adjust the computer's volume by opening the sound card driver, and connect external audio devices when needed. So, where to open the sound card driver? The following will introduce it to you in detail. First of all, how to open the sound card driver depends on your operating system. In Windows system, you can open it by following the steps

How to implement change event binding of select elements in jQuery How to implement change event binding of select elements in jQuery Feb 23, 2024 pm 01:12 PM

jQuery is a popular JavaScript library that can be used to simplify DOM manipulation, event handling, animation effects, etc. In web development, we often encounter situations where we need to change event binding on select elements. This article will introduce how to use jQuery to bind select element change events, and provide specific code examples. First, we need to create a dropdown menu with options using labels:

See all articles