WO2019079992A1 - 分布式爬虫系统中任务管理器的分配方法及系统 - Google Patents

分布式爬虫系统中任务管理器的分配方法及系统

Info

Publication number
WO2019079992A1
WO2019079992A1 PCT/CN2017/107595 CN2017107595W WO2019079992A1 WO 2019079992 A1 WO2019079992 A1 WO 2019079992A1 CN 2017107595 W CN2017107595 W CN 2017107595W WO 2019079992 A1 WO2019079992 A1 WO 2019079992A1
Authority
WO
WIPO (PCT)
Prior art keywords
distributed
devices
delay
data packets
distributed device
Prior art date
Application number
PCT/CN2017/107595
Other languages
English (en)
French (fr)
Inventor
马岩
Original Assignee
麦格创科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 麦格创科技(深圳)有限公司 filed Critical 麦格创科技(深圳)有限公司
Priority to PCT/CN2017/107595 priority Critical patent/WO2019079992A1/zh
Publication of WO2019079992A1 publication Critical patent/WO2019079992A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/951Indexing; Web crawling techniques
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]

Definitions

  • the present invention relates to the field of data processing, and in particular, to a method and system for allocating a task manager in a distributed crawler system.
  • Web crawlers also known as web spiders, web robots, more often referred to as web chasers in the FOAF community
  • Web crawlers are programs or scripts that automatically crawl web information in accordance with certain rules.
  • Other infrequently used names are ants, automatic indexes, simulators, or worms.
  • the web crawler is actually an application for crawling network information.
  • the existing web crawler grabs a large amount of data, and the task manager of the task is randomly allocated, which may affect the efficiency of task assignment, affecting the crawler. s efficiency.
  • the present application provides a method for allocating a task manager in a distributed crawler system. It solves the shortcomings of the prior art technical solutions. Problem solution
  • a distributed crawler task allocation method comprising the following steps:
  • the distributed device receives or initiates an allocation message, where the allocation message is used to allocate a task manager from a distributed crawler system; the distributed device sequentially sends N data packets to other M devices of the distributed device; The distributed device counts the M delays of the N packets returned by the M devices, and finds the average of the M delays; the distributed device receives the M allocation messages sent by the other M devices to obtain M delays. And the average value, the allocation message includes the delay and the average value of the local machine; the allocation message is sent to the M devices in the order of M delays and average values.
  • the method further includes:
  • the distributed device acquires the size of the historically shared data packet; extracts the size interval of the historical data packet, divides the size interval into N subintervals, and distributes the device N data packets, wherein the N data packets
  • the size of the Mth data packet is the median value of the Mth subinterval in the N intervals
  • the distributed device sequentially sends N data packets to M other distributed devices, and counts each of the other M distributed devices.
  • the delay of the N packets of points is obtained, and M delays are obtained.
  • the method further includes:
  • a distributed crawler task distribution system includes: a plurality of distributed devices, where the plurality of distributed devices include a first distributed device and other N distributed devices;
  • a first distributed device configured to receive or initiate an allocation message, where the allocation message is used to allocate a task manager from a distributed crawler system; and send N data packets to other M devices of the distributed device in sequence
  • the device calculates the M delay sums of the N data packets returned by the M devices, and finds the average value of the M delay sums; receives M allocation messages sent by other M devices to obtain M delays and average values,
  • the allocation message includes the delay and the average value of the local device; and the allocation message is sent to the M devices in the order of M delays and average values;
  • the other N distributed devices are configured to obtain a local delay and send and send the local to the first distributed device.
  • the distributed device is further configured to acquire a size of a historically shared data packet; extract a size interval of the historical data packet, divide the size interval into N subintervals, and distribute the device N data.
  • the packet wherein the size of the Mth data packet in the N data packets is the median value of the Mth subinterval in the N intervals, and the distributed device sequentially sends the N data packets to the M other distributed devices, and statistics other M
  • the delay of the N packets of each access point in a distributed device results in M delays.
  • a distributed device including: a processor, a wireless transceiver, a memory, and a bus
  • the processor, the wireless transceiver, and the memory are connected by a bus.
  • the wireless transceiver is configured to receive or initiate an allocation message, where the allocation message is used to allocate a task manager from a distributed crawler system;
  • the processor is configured to sequentially send N data packets to other M devices of the distributed device; M delay sums of N data packets returned by M devices, and an average value of the M delay sums are obtained; receiving M allocation messages sent by other M devices to obtain M delays and average values, the allocation message Contains the delay and average of the local machine; sends the allocation message to M devices in M delay and average reverse order.
  • the processor is configured to acquire a size of a historically shared data packet, extract a size interval of the historical data packet, and divide the size interval into N sub-intervals.
  • the distributed device virtual N data packets, wherein the size of the Mth data packet in the N data packets is the median value of the Mth subinterval in the N intervals, and the distributed device sequentially sends the N data packets to the M other packets.
  • the distributed device counts the delays of N data packets of each of the other M distributed devices, and obtains M delay sums.
  • the processor is configured to delay t ACK (la) - tla ; wherein, t ACK (la) is the first device to return the acknowledgement message of the data packet A, tla is data The transmission of packet A to the first device.
  • a fourth aspect provides a computer readable storage medium storing a computer program for electronic data exchange, wherein the computer program causes a computer to perform the method provided by the first aspect.
  • the technical solution provided by the present invention realizes the task of assigning tasks in the reverse order of delay and the like by the method of allocation, so that the test and the larger device can be preferentially allocated to the task for processing, and the efficiency is improved.
  • FIG. 1 is a flowchart of a method for assigning a task manager in a distributed crawler system according to a first preferred embodiment of the present invention
  • FIG. 2 is a structural diagram of a distribution system of a task manager in a distributed crawler system according to a second preferred embodiment of the present invention.
  • 3 is a hardware structural diagram of a distributed device according to a second preferred embodiment of the present invention.
  • FIG. 1 is a schematic diagram of a method for allocating a task manager in a distributed crawler system according to a first preferred embodiment of the present invention. The method is as shown in FIG.
  • Step S101 The distributed device receives or initiates an allocation message, where the allocation message is used to allocate a task manager from the distributed crawler system.
  • Step S102 The distributed device sequentially sends N data packets to other M devices of the distributed device.
  • the implementation method of the foregoing step S102 may be:
  • the distributed device acquires the size of the historically shared data packet (ie, the capacity, how many MBs or multiple KBs); extracts the size interval of the historical data packet, and divides the size interval into N subintervals, the distributed device virtual N
  • the data packet wherein the size of the Mth data packet in the N data packets is the median value of the Mth subinterval in the N intervals, and the distributed device sequentially sends the N data packets to the M other distributed devices, and statistics
  • the delay of the N packets of each of the other M distributed devices results in M delays.
  • the size of the data packet herein may specifically include: 6MB, 5MB, 4MB, 3MB, 2MB, 1MB, where the N intervals divided by the two intervals are taken as an example, and the range of the specific two intervals may be, the interval 1 [6 MB, 4MB]; Interval 2 [3MB, 1MB], then the distributed device virtualizes 2 data packets.
  • packet A represents the first interval virtual data packet
  • packet B represents the second interval.
  • the virtual data packet, the size of the data packet A is 5MB
  • the size of the data packet B is 2MB
  • the data packet A and the data packet B are sequentially sent to the M other devices.
  • TAP2, TAP3, Ta (delay and average) (TAP1+TAP2+TAP3) /3 can be calculated.
  • the foregoing method may further include: the device hardware parameter, for example, a parameter of a memory, a CPU, and a memory, and may further include some variable parameters, for example, a number of crawler tasks, a memory usage rate, a CPU usage rate, and the like. Wait.
  • the device hardware parameter for example, a parameter of a memory, a CPU, and a memory
  • some variable parameters for example, a number of crawler tasks, a memory usage rate, a CPU usage rate, and the like. Wait.
  • Step S103 The distributed device counts M delay sums of N data packets returned by the M devices, and obtains an average value of the M delay sums.
  • Step S104 The distributed device receives M allocation messages sent by other M devices to obtain M delays and average values, where the allocation message includes the local delay and the average value.
  • Step S105 The distributed device sends the allocation message to the M devices according to the M delay and the average value in reverse order.
  • the technical solution provided by the present invention realizes the task of assigning tasks in the reverse order of delay and the like by the method of allocation, so that the test and the larger device can be preferentially allocated to the task for processing, and the efficiency is improved.
  • the foregoing method may further include:
  • the distributed device with the least delay is determined as the task manager, and the deferred and the second distributed device is determined as the standby task manager, and the task processing threshold of the standby task manager is reduced.
  • the foregoing method may further include:
  • the standby task manager is started as a task manager of the distributed system.
  • FIG. 2 is a distributed crawler implementation system according to a second preferred embodiment of the present invention.
  • the system includes: a first distributed device 201 and other N distributions.
  • Device 201, the task manager is connected to the device;
  • a first distributed device configured to receive or initiate an allocation message, where the allocation message is used to allocate a task manager from a distributed crawler system; and send N data packets to other M devices of the distributed device in sequence
  • the device calculates the M delay sums of the N data packets returned by the M devices, and finds the average value of the M delay sums; receives M allocation messages sent by other M devices to obtain M delays and average values,
  • the allocation message includes the delay and average of the local machine; the device with the delay and the smallest is selected from the M+1 delays and the average value as the task manager;
  • the other N distributed devices are configured to obtain a local delay and send the local delay and load in the allocation message to the first distributed device.
  • the first distributed device 201 is further configured to determine the extended and second distributed devices as the standby task manager, and reduce the task processing threshold of the standby task manager.
  • the first distributed device 201 is further configured to start the standby task manager as a task manager of the distributed system, such as a task manager failure.
  • FIG. 3 is a distributed device 30, including: a processor 301, a wireless transceiver 302, a memory 303, and a bus 304.
  • the wireless transceiver 302 is configured to send and receive data with and from an external device.
  • the number of processors 301 can be one or more.
  • processor 301, memory 302, and transceiver 303 may be connected by bus 304 or other means.
  • Server 30 can be used to perform the steps of Figure 1. For the meanings and examples of the terms involved in this embodiment, reference may be made to the corresponding embodiment of FIG. It will not be described here.
  • the wireless transceiver 302 is configured to acquire the crawler task, obtain the distance of the device connected to the task manager, and the number of crawler tasks.
  • the processor 901 is configured to call the program code stored in the memory 903 for performing the following operations:
  • the processor 301 is configured to sequentially send the N data packets to the other M devices of the distributed device, and calculate the M delays of the N data packets returned by the M devices, and obtain the M delays.
  • the average value of the sum receiving M allocation messages sent by other M devices to obtain M delays and average values, the allocation message including the local delay and the average value; selecting from M+1 delays and average values Deferred and minimal device as task manager
  • the processor 301 herein may be a processing component or a general term of multiple processing elements.
  • the processing component may be a central processing unit (CPU), or may be an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
  • CPU central processing unit
  • ASIC application specific integrated circuit
  • one or more microprocessors digital singnal processors, DSP
  • DSP digital singnal processors
  • FPGAs Field Programmable Gate Arrays
  • the memory 303 may be a storage device, or may be a collective name of a plurality of storage elements, and is used for storage.
  • the executable program code or application runs the parameters, data, etc. required to run the device.
  • the memory 303 may include random access memory (RAM), and may also include non-volatile memory such as a magnetic disk memory, a flash memory, or the like.
  • the bus 304 may be an Industry Standard Architecture (ISA) bus, an external device interconnect (Peripheral)
  • PCI Component
  • EISA extended industry standard architecture
  • the bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in Figure 3, but it does not mean that there is only one bus or one type of bus.
  • the terminal may further include an input/output device connected to the bus 304 to be connected to other portions such as the processor 301 via a bus.
  • the input/output device can provide an input interface for the operator, so that the operator can select the control item through the input interface, and can also be other interfaces through which other devices can be externally connected.
  • a program to instruct related hardware can be stored in a computer readable storage medium, the storage medium It can include: flash drive, read-only memory (English: Read-Only Memory, ROM for short), random access memory (English: Random Access Memory, RAM for short), disk or CD.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明公开了一种分布式爬虫系统中任务管理器的分配方法,所述方法包括如下步骤:分布式设备接收或发起分配消息,所述分配消息用于从分布式爬虫系统中分配出任务管理器;分布式设备将N个数据包依次发送给分布式设备的其他M个设备;分布式设备统计M个设备返回的N个数据包的M个时延和,求该M个时延和的平均值;分布式设备接收其他M个设备发送的M个分配消息得到M个时延和平均值,该分配消息包含本机的时延和平均值;分布式设备按M个时延和平均值倒序向M个设备发送所述分配消息。本发明提供的技术方案具有效率高的优点。

Description

分布式爬虫系统中任务管理器的分配方法及系统 技术领域
[0001] 本发明涉及数据处理领域, 尤其涉及一种分布式爬虫系统中任务管理器的分配 方法及系统。
背景技术
[0002] 网络爬虫 (又被称为网页蜘蛛, 网络机器人, 在 FOAF社区中间, 更经常的称 为网页追逐者) , 是一种按照一定的规则, 自动地抓取万维网信息的程序或者 脚本。 另外一些不常使用的名字还有蚂蚁、 自动索引、 模拟程序或者蠕虫。
[0003] 网络爬虫实际是一种网络信息抓取的应用程序, 现有的网络爬虫抓取数据量大 , 任务的分配的任务管理器为随机分配的, 其可能影响任务分配的效率, 影响 爬虫的效率。
技术问题
[0004] 本申请提供一种分布式爬虫系统中任务管理器的分配方法。 其解决现有技术的 技术方案效率低的缺点。 问题的解决方案
技术解决方案
[0005] 一方面, 提供一种分布式爬虫任务分配方法, 所述方法包括如下步骤:
[0006] 分布式设备接收或发起分配消息, 所述分配消息用于从分布式爬虫系统中分配 出任务管理器; 分布式设备将 N个数据包依次发送给分布式设备的其他 M个设备 ; 分布式设备统计 M个设备返回的 N个数据包的 M个吋延和, 求该 M个吋延和的 平均值; 分布式设备接收其他 M个设备发送的 M个分配消息得到 M个吋延和平均 值, 该分配消息包含本机的吋延和平均值; 按 M个吋延和平均值倒序向 M个设备 发送所述分配消息。
[0007] 可选的, 所述方法还包括:
[0008] 分布式设备获取历史分享的数据包的大小; 提取历史数据包的大小区间, 将该 大小区间划分成 N个子区间, 分布式设备虚拟 N个数据包, 其中 N个数据包中的 第 M个数据包的大小为 N个区间中第 M个子区间的中值, 分布式设备将 N个数据 包依次发送给 M个其他分布式设备, 统计其他 M个分布式设备中每个接入点的 N 个数据包的吋延和, 得到 M个吋延和。
[0009] 可选的, 所述方法还包括:
[0010] 吋延 = t ACK (la) - tla; 其中, t ACK (la) 为第一设备返回数据包 A的确认 消息的接收吋间, tla为数据包 A向第一设备的发送吋间。
[0011] 第二方面, 提供一种分布式爬虫任务分配系统, 所述系统包括: 多个分布式设 备, 所述多个分布式设备包括第一分布式设备和其他 N个分布式设备;
[0012] 第一分布式设备, 用于接收或发起分配消息, 所述分配消息用于从分布式爬虫 系统中分配出任务管理器; 将 N个数据包依次发送给分布式设备的其他 M个设备 ; 统计 M个设备返回的 N个数据包的 M个吋延和, 求该 M个吋延和的平均值; 接 收其他 M个设备发送的 M个分配消息得到 M个吋延和平均值, 该分配消息包含本 机的吋延和平均值; 按 M个吋延和平均值倒序向 M个设备发送所述分配消息;
[0013] 其他 N个分布式设备, 用于获取本地的吋延和, 将该本地吋延和发送给第一分 布式设备。
[0014] 可选的, 所述分布式设备, 还用于获取历史分享的数据包的大小; 提取历史数 据包的大小区间, 将该大小区间划分成 N个子区间, 分布式设备虚拟 N个数据包 , 其中 N个数据包中的第 M个数据包的大小为 N个区间中第 M个子区间的中值, 分布式设备将 N个数据包依次发送给 M个其他分布式设备, 统计其他 M个分布式 设备中每个接入点的 N个数据包的吋延和, 得到 M个吋延和。
[0015] 可选的, 所述分布式设备, 还用于吋延 = t ACK (la) - tla; 其中, t ACK (la ) 为第一设备返回数据包 A的确认消息的接收吋间, tla为数据包 A向第一设备的 发送吋间。
[0016] 第三方面, 提供一种分布式设备, 包括: 处理器、 无线收发器、 存储器和总线
, 所述处理器、 无线收发器、 存储器通过总线连接,
[0017] 所述无线收发器, 用于接收或发起分配消息, 所述分配消息用于从分布式爬虫 系统中分配出任务管理器;
[0018] 所述处理器, 用于将 N个数据包依次发送给分布式设备的其他 M个设备; 统计 M个设备返回的 N个数据包的 M个吋延和, 求该 M个吋延和的平均值; 接收其他 M个设备发送的 M个分配消息得到 M个吋延和平均值, 该分配消息包含本机的吋 延和平均值; 按 M个吋延和平均值倒序向 M个设备发送所述分配消息。
[0019] 可选的, 所述处理器, 用于获取历史分享的数据包的大小; 提取历史数据包的 大小区间, 将该大小区间划分成 N个子区间,
分布式设备虚拟 N个数据包, 其中 N个数据包中的第 M个数据包的大小为 N个区 间中第 M个子区间的中值, 分布式设备将 N个数据包依次发送给 M个其他分布式 设备, 统计其他 M个分布式设备中每个接入点的 N个数据包的吋延和, 得到 M个 吋延和。
[0020] 可选的, 所述处理器, 用于吋延 t ACK (la) - tla; 其中, t ACK (la) 为第 一设备返回数据包 A的确认消息的接收吋间, tla为数据包 A向第一设备的发送吋 间。
[0021] 第四方面, 提供一种计算机可读存储介质, 其存储用于电子数据交换的计算机 程序, 其中, 所述计算机程序使得计算机执行第一方面提供的方法。
发明的有益效果
有益效果
[0022] 本发明提供的技术方案通过分配的方法实现了按吋延和的倒序来分配任务, 这 样试验和较大的设备能够优先分配到任务进行处理, 提高效率。
对附图的简要说明
附图说明
[0023] 为了更清楚地说明本发明实施例的技术方案, 下面将对实施例描述中所需要使 用的附图作简单地介绍, 显而易见地, 下面描述中的附图是本发明的一些实施 例, 对于本领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可以根 据这些附图获得其他的附图。
[0024] 图 1为本发明第一较佳实施方式提供的一种分布式爬虫系统中任务管理器的分 配方法的流程图;
[0025] 图 2为本发明第二较佳实施方式提供的一种分布式爬虫系统中任务管理器的分 配系统的结构图。 [0026] 图 3为本发明第二较佳实施方式提供的一种分布式设备的硬件结构图。
本发明的实施方式
[0027] 下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案进行清楚、 完整地描述, 显然, 所描述的实施例是本发明一部分实施例, 而不是全部的实 施例。 基于本发明中的实施例, 本领域普通技术人员在没有作出创造性劳动前 提下所获得的所有其他实施例, 都属于本发明保护的范围。
[0028] 请参考图 1, 图 1是本发明第一较佳实施方式提出的一种分布式爬虫系统中任务 管理器的分配方法, 该方法如图 1所示, 包括如下步骤:
[0029] 步骤 S101、 分布式设备接收或发起分配消息, 所述分配消息用于从分布式爬虫 系统中分配出任务管理器。
[0030] 步骤 S102、 分布式设备将 N个数据包依次发送给分布式设备的其他 M个设备。
[0031] 上述步骤 S102的实现方法可以为:
[0032] 分布式设备获取历史分享的数据包的大小 (即容量, 多少个 MB或多个 KB); 提 取历史数据包的大小区间, 将该大小区间划分成 N个子区间, 分布式设备虚拟 N 个数据包, 其中 N个数据包中的第 M个数据包的大小为 N个区间中第 M个子区间 的中值, 分布式设备将 N个数据包依次发送给 M个其他分布式设备, 统计其他 M 个分布式设备中每个接入点的 N个数据包的吋延和, 得到 M个吋延和。
[0033] 下面以一个实际的例子来说明反馈参数为吋间和的计算方式;
[0034] 这里的数据包的大小具体可以包括: 6MB、 5MB、 4MB、 3MB、 2MB、 1MB , 这里划分的 N个区间以 2个区间为例, 具体的 2个区间的范围可以为, 区间 1 【6 MB , 4MB】 ; 区间 2 【3MB, 1MB】 , 那么分布式设备虚拟出 2个数据包, 为了 方便说明, 这里以数据包 A表示第一区间虚拟数据包, 数据包 B表示第二区间虚 拟数据包, 数据包 A的大小为 5MB, 数据包 B的大小为 2MB, 将数据包 A以及数 据包 B依次发送给 M个其他设备, (这里以三个 AP为例, 分别为 API , AP2以及 AP3) , API接收到数据包 A以后会返回 ACK (la) , 接收吋间为 t ACK (la) , 数据包 A的发送吋间为 tla, API接收到数据包 B以后会返回 ACK (lb) , 接收吋 间可以为 t ACK (lb) ,数据包 B的发送吋间为 tlb; 那么 API的吋间和 TAPl=( t ACK (la) - tla) + ( t ACK (lb) - tlb)。 同理可以计算出 TAP2、 TAP3的值, Ta (吋延和平均值) = (TAP1+TAP2+TAP3) /3。
[0035] 上述方法还可以获取设备参数可以包括: 设备硬件参数, 例如, 内存、 CPU、 存储器的参数, 当然还可以包括一些可变参数, 例如, 爬虫任务数量、 内存使 用率、 CPU使用率等等。
[0036] 步骤 S103、 分布式设备统计 M个设备返回的 N个数据包的 M个吋延和, 求该 M 个吋延和的平均值。
[0037] 步骤 S104、 分布式设备接收其他 M个设备发送的 M个分配消息得到 M个吋延和 平均值, 该分配消息包含本机的吋延和平均值。
[0038] 步骤 S105、 分布式设备按 M个吋延和平均值倒序向 M个设备发送所述分配消息
[0039] 本发明提供的技术方案通过分配的方法实现了按吋延和的倒序来分配任务, 这 样试验和较大的设备能够优先分配到任务进行处理, 提高效率。
[0040] 可选的, 上述方法还可以包括:
[0041] 将吋延最少的分布式设备确定为任务管理器, 将吋延和次少的分布式设备确定 为备用任务管理器, 降低备用任务管理器的任务处理阈值。
[0042] 可选的, 上述方法还可以包括:
[0043] 如任务管理器故障, 启动备用任务管理器作为分布式系统的任务管理器。
[0044] 此方式避免多次分配影响进程。
[0045] 请参考图 2, 图 2是本发明第二较佳实施方式提出的一种分布式爬虫实现系统, 该系统如图 2所示, 包括: 第一分布式设备 201以及其他 N个分布式设备 201, 所 述任务管理器与设备连接;
[0046] 第一分布式设备, 用于接收或发起分配消息, 所述分配消息用于从分布式爬虫 系统中分配出任务管理器; 将 N个数据包依次发送给分布式设备的其他 M个设备 ; 统计 M个设备返回的 N个数据包的 M个吋延和, 求该 M个吋延和的平均值; 接 收其他 M个设备发送的 M个分配消息得到 M个吋延和平均值, 该分配消息包含本 机的吋延和平均值; 从 M+1个吋延和平均值中选择吋延和最小的设备作为任务管 理器; [0047] 其他 N个分布式设备, 用于获取本地的吋延和, 将该本地吋延和加载在分配消 息内发送给第一分布式设备。
[0048] 可选的, 所述第一分布式设备 201, 还用于将吋延和次少的分布式设备确定为 备用任务管理器, 降低备用任务管理器的任务处理阈值。
[0049] 可选的, 所述第一分布式设备 201, 还用于如任务管理器故障, 启动备用任务 管理器作为分布式系统的任务管理器。
[0050] 参阅图 3, 图 3为一种分布式设备 30, 包括: 处理器 301、 无线收发器 302、 存储 器 303和总线 304, 无线收发器 302用于与外部设备之间收发数据。 处理器 301的 数量可以是一个或多个。 本申请的一些实施例中, 处理器 301、 存储器 302和收 发器 303可通过总线 304或其他方式连接。 服务器 30可以用于执行图 1的步骤。 关 于本实施例涉及的术语的含义以及举例, 可以参考图 1对应的实施例。 此处不再 赘述。
[0051] 无线收发器 302, 用于获取该爬虫任务, 获取与该任务管理器连接的设备的距 离以及爬虫任务数量。
[0052] 其中, 存储器 303中存储程序代码。 处理器 901用于调用存储器 903中存储的程 序代码, 用于执行以下操作:
[0053] 处理器 301, 用于依据将 N个数据包依次发送给分布式设备的其他 M个设备; 统 计 M个设备返回的 N个数据包的 M个吋延和, 求该 M个吋延和的平均值; 接收其 他 M个设备发送的 M个分配消息得到 M个吋延和平均值, 该分配消息包含本机的 吋延和平均值; 从 M+1个吋延和平均值中选择吋延和最小的设备作为任务管理器
[0054] 需要说明的是, 这里的处理器 301可以是一个处理元件, 也可以是多个处理元 件的统称。 例如, 该处理元件可以是中央处理器 (Central Processing Unit, CPU ) , 也可以是特定集成电路 (Application Specific Integrated Circuit, ASIC) , 或 者是被配置成实施本申请实施例的一个或多个集成电路, 例如: 一个或多个微 处理器 (digital singnal processor, DSP) , 或, 一个或者多个现场可编程门阵列 (Field Programmable Gate Array, FPGA) 。
[0055] 存储器 303可以是一个存储装置, 也可以是多个存储元件的统称, 且用于存储 可执行程序代码或应用程序运行装置运行所需要参数、 数据等。 且存储器 303可 以包括随机存储器 (RAM) , 也可以包括非易失性存储器 (non- volatile memory ) , 例如磁盘存储器, 闪存 (Flash) 等。
[0056] 总线 304可以是工业标准体系结构 (Industry Standard Architecture, ISA) 总线 、 外部设备互连 (Peripheral
Component, PCI) 总线或扩展工业标准体系结构 (Extended Industry Standard Architecture, EISA) 总线等。 该总线可以分为地址总线、 数据总线、 控制总线 等。 为便于表示, 图 3中仅用一条粗线表示, 但并不表示仅有一根总线或一种类 型的总线。
[0057] 该终端还可以包括输入输出装置, 连接于总线 304, 以通过总线与处理器 301等 其它部分连接。 该输入输出装置可以为操作人员提供一输入界面, 以便操作人 员通过该输入界面选择布控项, 还可以是其它接口, 可通过该接口外接其它设 备。
[0058] 需要说明的是, 对于前述的各个方法实施例, 为了简单描述, 故将其都表述为 一系列的动作组合, 但是本领域技术人员应该知悉, 本发明并不受所描述的动 作顺序的限制, 因为依据本发明, 某一些步骤可以采用其他顺序或者同吋进行 。 其次, 本领域技术人员也应该知悉, 说明书中所描述的实施例均属于优选实 施例, 所涉及的动作和模块并不一定是本发明所必须的。
[0059] 在上述实施例中, 对各个实施例的描述都各有侧重, 某个实施例中没有详细描 述的部分, 可以参见其他实施例的相关描述。
[0060] 本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可 以通过程序来指令相关的硬件来完成, 该程序可以存储于一计算机可读存储介 质中, 存储介质可以包括: 闪存盘、 只读存储器 (英文: Read-Only Memory, 简称: ROM) 、 随机存取器 (英文: Random Access Memory , 简称: RAM) 、 磁盘或光盘等。
[0061] 以上对本发明实施例所提供的内容下载方法及相关设备、 系统进行了详细介绍 , 本文中应用了具体个例对本发明的原理及实施方式进行了阐述, 以上实施例 的说明只是用于帮助理解本发明的方法及其核心思想; 同吋, 对于本领域的一 般技术人员, 依据本发明的思想, 在具体实施方式及应用范围上均会有改变之 处, 综上所述, 本说明书内容不应理解为对本发明的限制。

Claims

权利要求书
[权利要求 1] 一种分布式爬虫系统中任务管理器的分配方法, 其特征在于, 所述方 法包括如下步骤:
分布式设备接收或发起分配消息, 所述分配消息用于从分布式爬虫系 统中分配出任务管理器;
分布式设备将 N个数据包依次发送给分布式设备的其他 M个设备; 分布式设备统计 M个设备返回的 N个数据包的 M个吋延和, 求该 M个 吋延和的平均值;
分布式设备接收其他 M个设备发送的 M个分配消息得到 M个吋延和平 均值, 该分配消息包含本机的吋延和平均值;
分布式设备按 M个吋延和平均值倒序向 M个设备发送所述分配消息。
[权利要求 2] 根据权利要求 1所述的方法, 其特征在于, 所述分布式设备将 N个数 据包依次发送给分布式设备的其他 M个设备; 分布式设备统计 M个设 备返回的 N个数据包的 M个吋延和, 求该 M个吋延和的平均值包括: 分布式设备获取历史分享的数据包的大小; 提取历史数据包的大小区 间, 将该大小区间划分成 N个子区间, 分布式设备虚拟 N个数据包, 其中 N个数据包中的第 M个数据包的大小为 N个区间中第 M个子区间 的中值, 分布式设备将 N个数据包依次发送给 M个其他分布式设备, 统计其他 M个分布式设备中每个接入点的 N个数据包的吋延和, 得到 M个吋延和。
[权利要求 3] 根据权利要求 1所述的方法, 其特征在于, 所述吋延的获取方式, 包 括:
吋延 = t ACK (la) - tla; 其中, t
ACK (la) 为第一设备返回数据包 A的确认消息的接收吋间, tla为数 据包 A向第一设备的发送吋间。
[权利要求 4] 一种分布式爬虫任务分配系统, 其特征在于, 所述系统包括: 多个分 布式设备, 所述多个分布式设备包括第一分布式设备和其他 N个分布 式设备; 第一分布式设备, 用于接收或发起分配消息, 所述分配消息用于从分 布式爬虫系统中分配出任务管理器; 将 N个数据包依次发送给分布式 设备的其他 M个设备; 统计 M个设备返回的 N个数据包的 M个吋延和 , 求该 M个吋延和的平均值; 接收其他 M个设备发送的 M个分配消息 得到 M个吋延和平均值, 该分配消息包含本机的吋延和平均值; 按 M 个吋延和平均值倒序向 M个设备发送所述分配消息;
其他 N个分布式设备, 用于获取本地的吋延和, 将该本地吋延和发送 给第一分布式设备。
[权利要求 5] 根据权利要求 4所述的系统, 其特征在于,
所述第一分布式设备, 还用于获取历史分享的数据包的大小; 提取历 史数据包的大小区间, 将该大小区间划分成 N个子区间, 分布式设备 虚拟 N个数据包, 其中 N个数据包中的第 M个数据包的大小为 N个区间 中第 M个子区间的中值, 分布式设备将 N个数据包依次发送给 M个其 他分布式设备, 统计其他 M个分布式设备中每个接入点的 N个数据包 的吋延和, 得到 M个吋延和。
[权利要求 6] 根据权利要求 4所述的方法, 其特征在于,
所述第一分布式设备, 还用于吋延 = t ACK (la) - tla; 其中, t ACK (la) 为第一设备返回数据包 A的确认消息的接收吋间, tla为数据包 A向第一设备的发送吋间。
[权利要求 7] —种分布式设备, 包括: 处理器、 无线收发器、 存储器和总线, 所述 处理器、 无线收发器、 存储器通过总线连接, 其特征在于, 所述无线收发器, 用于接收或发起分配消息, 所述分配消息用于从分 布式爬虫系统中分配出任务管理器;
所述处理器, 用于将 N个数据包依次发送给分布式设备的其他 M个设 备; 统计 M个设备返回的 N个数据包的 M个吋延和, 求该 M个吋延和 的平均值; 接收其他 M个设备发送的 M个分配消息得到 M个吋延和平 均值, 该分配消息包含本机的吋延和平均值; 按 M个吋延和平均值倒 序向 M个设备发送所述分配消息。
[权利要求 8] 根据权利要求 7所述的服务器, 其特征在于, 所述处理器, 用于获取 历史分享的数据包的大小; 提取历史数据包的大小区间, 将该大小区 间划分成 N个子区间, 分布式设备虚拟 N个数据包, 其中 N个数据包 中的第 M个数据包的大小为 N个区间中第 M个子区间的中值, 分布式 设备将 N个数据包依次发送给 M个其他分布式设备, 统计其他 M个分 布式设备中每个接入点的 N个数据包的吋延和, 得到 M个吋延和。
[权利要求 9] 根据权利要求 7所述的服务器, 其特征在于, 所述处理器, 用于吋延= t ACK (la) - tla; 其中, t ACK (la) 为第一设备返回数据包 A的确 认消息的接收吋间, tla为数据包 A向第一设备的发送吋间。
[权利要求 10] 一种计算机可读存储介质, 其特征在于, 其存储用于电子数据交换的 计算机程序, 其中, 所述计算机程序使得计算机执行如权利要求 1-3 任一项所述的方法。
PCT/CN2017/107595 2017-10-25 2017-10-25 分布式爬虫系统中任务管理器的分配方法及系统 WO2019079992A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/107595 WO2019079992A1 (zh) 2017-10-25 2017-10-25 分布式爬虫系统中任务管理器的分配方法及系统

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/107595 WO2019079992A1 (zh) 2017-10-25 2017-10-25 分布式爬虫系统中任务管理器的分配方法及系统

Publications (1)

Publication Number Publication Date
WO2019079992A1 true WO2019079992A1 (zh) 2019-05-02

Family

ID=66247101

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/107595 WO2019079992A1 (zh) 2017-10-25 2017-10-25 分布式爬虫系统中任务管理器的分配方法及系统

Country Status (1)

Country Link
WO (1) WO2019079992A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105956069A (zh) * 2016-04-28 2016-09-21 优品财富管理有限公司 一种网络资讯的采集和分析方法及系统
CN106506673A (zh) * 2016-11-25 2017-03-15 国信优易数据有限公司 一种大规模分布式数据管理系统及其方法
US9721008B1 (en) * 2016-06-09 2017-08-01 International Business Machines Corporation Recipe generation utilizing natural language processing
CN107066569A (zh) * 2017-04-07 2017-08-18 武汉大学 一种分布式网络爬虫系统及信息爬取的方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105956069A (zh) * 2016-04-28 2016-09-21 优品财富管理有限公司 一种网络资讯的采集和分析方法及系统
US9721008B1 (en) * 2016-06-09 2017-08-01 International Business Machines Corporation Recipe generation utilizing natural language processing
CN106506673A (zh) * 2016-11-25 2017-03-15 国信优易数据有限公司 一种大规模分布式数据管理系统及其方法
CN107066569A (zh) * 2017-04-07 2017-08-18 武汉大学 一种分布式网络爬虫系统及信息爬取的方法

Similar Documents

Publication Publication Date Title
CN109274707B (zh) 一种负载调度方法及装置
EP3754915B1 (en) Data processing method and apparatus
US20190394129A1 (en) Method And Apparatus For Datacenter Congestion Control Based On Software Defined Network
EP3226468B1 (en) Service acceleration method and apparatus
CN110602156A (zh) 一种负载均衡调度方法及装置
JP2019506072A (ja) データ伝送方法および関連するデバイス
US11403009B2 (en) Storage system, and method and apparatus for allocating storage resources
Hwang et al. Deadline and incast aware TCP for cloud data center networks
US11782869B2 (en) Data transmission method and related device
US20180131619A1 (en) Load Balancing Method and Related Apparatus
CN108494623A (zh) 一种网络转发设备的性能测试方法及设备
CN105025080A (zh) 一种分布式系统的过载保护方法和服务器
CN111371694B (zh) 一种分流方法、装置和系统、处理设备和存储介质
US11316916B2 (en) Packet processing method, related device, and computer storage medium
CN108429703B (zh) Dhcp客户端上线方法及装置
CN107113323B (zh) 一种数据存储方法、装置和系统
CN112260962B (zh) 一种带宽控制方法及装置
CN107294911A (zh) 一种数据包监听方法及装置、远程过程调用系统、设备
WO2014101502A1 (zh) 基于内存芯片互连的内存访问处理方法、内存芯片及系统
CN115514708B (zh) 拥塞控制方法及装置
WO2019079992A1 (zh) 分布式爬虫系统中任务管理器的分配方法及系统
CN112087382B (zh) 一种服务路由方法及装置
US10951732B2 (en) Service processing method and device
WO2019079967A1 (zh) 分布式爬虫系统中任务管理器的分配方法及系统
WO2019090650A1 (zh) 任务分配在分布式系统的实现方法及系统

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17929789

Country of ref document: EP

Kind code of ref document: A1