+

CN111796940B - Resource allocation method and device and electronic equipment - Google Patents

Resource allocation method and device and electronic equipment Download PDF

Info

Publication number
CN111796940B
CN111796940B CN202010640962.9A CN202010640962A CN111796940B CN 111796940 B CN111796940 B CN 111796940B CN 202010640962 A CN202010640962 A CN 202010640962A CN 111796940 B CN111796940 B CN 111796940B
Authority
CN
China
Prior art keywords
target
electronic device
resource space
value
idle
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202010640962.9A
Other languages
Chinese (zh)
Other versions
CN111796940A (en
Inventor
窦笠
邹勇
徐佳祥
万博
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tower Zhilian Technology Co ltd
China Tower Co Ltd
Original Assignee
China Tower Co Ltd
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 China Tower Co Ltd filed Critical China Tower Co Ltd
Priority to CN202010640962.9A priority Critical patent/CN111796940B/en
Publication of CN111796940A publication Critical patent/CN111796940A/en
Application granted granted Critical
Publication of CN111796940B publication Critical patent/CN111796940B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本申请公开了一种资源分配方法、装置和电子设备。所述资源分配方法,应用于第一电子设备,包括:在接收到作业任务的情况下,获取目标区域中多个第二电子设备的状态信息,其中,所述状态信息包括闲置资源空间和历史访问流量;基于所述状态信息,从所述多个第二电子设备中筛选出至少一个目标电子设备;从每个所述目标电子设备的闲置资源空间中选择固定大小的目标资源空间,并将所述选择的目标资源空间分配给所述作业任务。本申请提供的一种资源分配方法、装置和电子设备,可以解决现有技术中,在利用边缘节点向用户提供服务的过程中,存在的资源浪费的问题。

This application discloses a resource allocation method, device and electronic equipment. The resource allocation method, applied to a first electronic device, includes: when receiving a job task, obtaining status information of a plurality of second electronic devices in the target area, wherein the status information includes idle resource space and history Access traffic; filter out at least one target electronic device from the plurality of second electronic devices based on the status information; select a target resource space of a fixed size from the idle resource space of each target electronic device, and add The selected target resource space is allocated to the job task. The resource allocation method, device and electronic equipment provided by this application can solve the problem of resource waste in the process of using edge nodes to provide services to users in the existing technology.

Description

一种资源分配方法、装置和电子设备Resource allocation method, device and electronic equipment

技术领域Technical field

本申请涉及数据传输领域,具体涉及一种资源分配方法、装置和电子设备。This application relates to the field of data transmission, and specifically relates to a resource allocation method, device and electronic equipment.

背景技术Background technique

现有技术中,为了提高向用户传输数据的效率,通常会部署不同的边缘节点,以通过边缘节点执行指定的作业任务。不同的厂商通常需要部署对应的节点设备,当服务变更时,节点设备将直接丢弃,导致资源的浪费,可见,现有技术中,在利用边缘节点向用户提供服务的过程中,存在资源浪费的问题。In the existing technology, in order to improve the efficiency of data transmission to users, different edge nodes are usually deployed to perform specified job tasks through the edge nodes. Different manufacturers usually need to deploy corresponding node devices. When services are changed, the node devices will be discarded directly, resulting in a waste of resources. It can be seen that in the existing technology, there is a waste of resources in the process of using edge nodes to provide services to users. question.

发明内容Contents of the invention

本申请实施例提供了一种资源分配方法、装置和电子设备,以解决现有技术中,在利用边缘节点向用户提供服务的过程中,存在资源浪费的问题。Embodiments of the present application provide a resource allocation method, device and electronic equipment to solve the problem of resource waste in the existing technology when edge nodes are used to provide services to users.

为了解决上述技术问题,本申请是这样实现的:In order to solve the above technical problems, this application is implemented as follows:

第一方面,本申请实施例提供了一种资源分配方法,应用于第一电子设备,包括:In a first aspect, embodiments of the present application provide a resource allocation method, applied to a first electronic device, including:

在接收到作业任务的情况下,获取目标区域中多个第二电子设备的状态信息,其中,所述状态信息包括闲置资源空间和历史访问流量;When receiving a job task, obtain status information of multiple second electronic devices in the target area, where the status information includes idle resource space and historical access traffic;

基于所述状态信息,从所述多个第二电子设备中筛选出至少一个目标电子设备;Based on the status information, filter out at least one target electronic device from the plurality of second electronic devices;

从每个所述目标电子设备的闲置资源空间中选择固定大小的目标资源空间,并将所述选择的目标资源空间分配给所述作业任务。Select a target resource space of a fixed size from the idle resource space of each target electronic device, and allocate the selected target resource space to the job task.

可选地,所述闲置资源空间包括闲置存储资源空间和闲置宽带资源空间,所述基于所述状态信息,从所述多个第二电子设备中筛选出至少一个目标电子设备,包括:Optionally, the idle resource space includes idle storage resource space and idle broadband resource space, and selecting at least one target electronic device from the plurality of second electronic devices based on the status information includes:

基于所述闲置存储资源空间、所述闲置宽带资源空间和热度值,分别计算每个所述第二电子设备的评分值,其中,所述热度值为基于所述历史访问流量计算得到的值;Calculate the score value of each second electronic device based on the idle storage resource space, the idle broadband resource space and the popularity value, wherein the popularity value is a value calculated based on the historical access traffic;

将所述多个第二电子设备中评分值较高的前N个第二电子设备分别确定为所述目标电子设备,其中,所述N为大于或者等于1的整数。The top N second electronic devices with higher score values among the plurality of second electronic devices are respectively determined as the target electronic devices, where N is an integer greater than or equal to 1.

可选地,所述基于所述闲置存储资源空间、所述闲置宽带资源空间和热度值,分别计算每个所述第二电子设备的评分值,包括:Optionally, calculating the score value of each second electronic device based on the idle storage resource space, the idle broadband resource space and the popularity value includes:

根据如下公式计算每个所述第二电子设备的评分值:The score value of each second electronic device is calculated according to the following formula:

其中,所述S为所述评分值,所述λ为调整因子,所述为对所述热度值进行归一化处理之后得到的位于0至1之间的数值,所述/>为对所述闲置存储资源空间的大小进行归一化处理之后得到的位于0至1之间的数值,所述/>为对所述闲置宽带资源空间的大小进行归一化处理之后得到的位于0至1之间的数值。Wherein, the S is the score value, the λ is an adjustment factor, and the is a value between 0 and 1 obtained after normalizing the heat value, the/> is a value between 0 and 1 obtained after normalizing the size of the idle storage resource space, the/> It is a value between 0 and 1 obtained after normalizing the size of the idle broadband resource space.

可选地,所述基于所述闲置存储资源空间、所述闲置宽带资源空间和热度值,分别计算每个所述第二电子设备的评分值之前,所述方法还包括:Optionally, before calculating the score value of each second electronic device based on the idle storage resource space, the idle broadband resource space and the popularity value, the method further includes:

确定第一目标设备集H,其中,所述第一目标设备集H包括所述多个第二电子设备中历史访问流量较高的前M个第二电子设备的状态信息;Determine a first target device set H, where the first target device set H includes status information of the top M second electronic devices with higher historical access traffic among the plurality of second electronic devices;

获取所述多个第二电子设备中每个所述第二电子设备的位置信息;Obtain the location information of each second electronic device in the plurality of second electronic devices;

根据如下公式计算每个所述第二电子设备的所述热度值:The heat value of each second electronic device is calculated according to the following formula:

其中,所述Hote为目标第二电子设备的热度值,所述目标第二电子设备为所述多个第二电子设备中的任一第二电子设备,所述|Pe-Ph|为所述目标第二电子设备与所述第一目标设备集H中的任一第二电子设备之间的距离值。Wherein, the Hot e is the heat value of the target second electronic device, the target second electronic device is any second electronic device among the plurality of second electronic devices, and the |P e -P h | is the distance value between the target second electronic device and any second electronic device in the first target device set H.

可选地,所述方法还包括:Optionally, the method also includes:

确定第二目标电子设备,其中,所述第二目标电子设备为所述多个第二电子设备中,同步运行至少两个不同的作业任务的第二电子设备;Determine a second target electronic device, wherein the second target electronic device is a second electronic device among the plurality of second electronic devices that synchronously runs at least two different job tasks;

在所述至少两个不同的作业任务包括第一作业任务和第二作业任务的情况下,将第一目标资源空间中的固定大小的第一空间分配给所述第二作业任务;In the case where the at least two different job tasks include a first job task and a second job task, allocate a first space of a fixed size in the first target resource space to the second job task;

其中,所述第一作业任务为在第一预设时间段内目标资源空间的使用率均小于第一预设值的作业任务,所述第二作业任务为在所述第一预设时间段内目标资源空间的使用率均大于或者等于第一预设值,且所述第一预设时间段内所述目标资源空间的使用率持续增加的作业任务;所述第一目标资源空间为所述第一作业任务的作业空间,所述第二目标资源空间为所述第二作业任务的作业空间。Wherein, the first job task is a job task in which the usage rate of the target resource space is less than the first preset value in the first preset time period, and the second job task is a job task in which the usage rate of the target resource space is less than the first preset value in the first preset time period. The usage rate of the target resource space within the first preset time period is greater than or equal to the first preset value, and the usage rate of the target resource space continues to increase during the first preset time period; the first target resource space is the The operation space of the first operation task is the operation space of the second operation task, and the second target resource space is the operation space of the second operation task.

可选地,所述方法还包括:Optionally, the method also includes:

确定第三目标电子设备,其中,所述第三目标电子设备为所述多个第二电子设备中运行第三作业任务的第二电子设备,其中,所述第三作业任务为在第二预设时间段内目标资源空间的使用率均小于第二预设值的作业任务;Determine a third target electronic device, where the third target electronic device is a second electronic device running a third job task among the plurality of second electronic devices, where the third job task is a second predetermined Assume that the usage rate of the target resource space within the time period is less than the second preset value of the job task;

在距离所述第三目标电子设备预设距离的范围内确定第四目标电子设备,其中,所述第四目标电子设备为所述闲置资源空间的值大于第三预设值的第二电子设备;Determine a fourth target electronic device within a range of a preset distance from the third target electronic device, where the fourth target electronic device is a second electronic device with a value of the idle resource space greater than a third preset value. ;

在所述第四目标电子设备中选择固定大小的第四目标资源空间,并将所述第四目标资源空间分配给所述第三作业任务;Select a fourth target resource space of a fixed size in the fourth target electronic device, and allocate the fourth target resource space to the third job task;

将所述第三目标电子设备中的第三目标资源空间分配至所述第三目标电子设备的闲置资源空间,其中,所述第三目标资源空间为所述第三作业任务的作业空间,所述第三目标电子设备的评分值高于所述第四目标电子设备的评分值。Allocate the third target resource space in the third target electronic device to the idle resource space of the third target electronic device, wherein the third target resource space is the work space of the third job task, so The score value of the third target electronic device is higher than the score value of the fourth target electronic device.

第二方面,本申请还提供了一种资源分配装置,包括:In a second aspect, this application also provides a resource allocation device, including:

第一获取模块,用于在接收到作业任务的情况下,获取目标区域中多个第二电子设备的状态信息,其中,所述状态信息包括闲置资源空间和历史访问流量;A first acquisition module, configured to acquire status information of a plurality of second electronic devices in the target area when receiving a job task, where the status information includes idle resource space and historical access traffic;

筛选模块,用于基于所述状态信息,从所述多个第二电子设备中筛选出至少一个目标电子设备;A screening module, configured to screen out at least one target electronic device from the plurality of second electronic devices based on the status information;

分配模块,用于从每个所述目标电子设备的闲置资源空间中选择固定大小的目标资源空间,并将所述选择的目标资源空间分配给所述作业任务。An allocation module is configured to select a target resource space of a fixed size from the idle resource space of each target electronic device, and allocate the selected target resource space to the job task.

可选地,所述闲置资源空间包括闲置存储资源空间和闲置宽带资源空间,所述筛选模块包括:Optionally, the idle resource space includes idle storage resource space and idle broadband resource space, and the screening module includes:

计算子模块,用于基于所述闲置存储资源空间、所述闲置宽带资源空间和热度值,分别计算每个所述第二电子设备的评分值,其中,所述热度值为基于所述历史访问流量计算得到的值;Calculation sub-module, configured to calculate the score value of each second electronic device based on the idle storage resource space, the idle broadband resource space and a popularity value, wherein the popularity value is based on the historical access The value obtained by flow calculation;

确定子模块,用于将所述多个第二电子设备中评分值较高的前N个第二电子设备分别确定为所述目标电子设备,其中,所述N为大于或者等于1的整数。A determination sub-module is configured to determine the top N second electronic devices with higher score values among the plurality of second electronic devices as the target electronic devices, respectively, where N is an integer greater than or equal to 1.

第三方面,本申请提供一种电子设备,包括:In a third aspect, this application provides an electronic device, including:

至少一个处理器;以及at least one processor; and

与所述至少一个处理器通信连接的存储器;其中,a memory communicatively connected to the at least one processor; wherein,

所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行本申请提供的资源分配方法步骤。The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the steps of the resource allocation method provided by this application.

第四方面,本申请提供一种存储有计算机指令的非瞬时计算机可读存储介质,所述计算机指令用于使所述计算机执行本申请提供的资源分配方法步骤。In a fourth aspect, the present application provides a non-transitory computer-readable storage medium storing computer instructions, the computer instructions being used to cause the computer to execute the steps of the resource allocation method provided by the present application.

本申请通过预先在目标区域内部署多个作为边缘节点的第二电子设备,当某一厂商需要利用边缘节点向用户提供服务时,仅需从多个第二电子设备中选择至少一个目标电子设备,并从每个目标电子设备中选择固定大小的目标资源空间作为该厂商的作业空间。当该厂商由于服务变更,而不再需要使用边缘节点时,可以直接每个目标电子设备中的目标资源空间释放至闲置资源空间,以便于后续作为其他厂商的作业空间。这样,不同厂商在需要利用边缘节点向用户提供服务时,仅需从目标电子设备中划分出一定资源空间即可,而无需每次都部署节点设备,且服务变更时,仅需释放作业空间即可,而不会造成节点设备丢弃的问题,从而缓解了在利用边缘节点向用户提供服务的过程中,存在的资源浪费的问题。This application pre-deploys multiple second electronic devices as edge nodes in the target area. When a manufacturer needs to use the edge nodes to provide services to users, it only needs to select at least one target electronic device from the multiple second electronic devices. , and select a fixed size target resource space from each target electronic device as the manufacturer's operating space. When the manufacturer no longer needs to use edge nodes due to service changes, the target resource space in each target electronic device can be directly released to the idle resource space so that it can subsequently be used as operating space for other manufacturers. In this way, when different manufacturers need to use edge nodes to provide services to users, they only need to divide a certain resource space from the target electronic device, without deploying node equipment every time, and when the service changes, they only need to release the operating space. It can be used without causing the problem of node equipment being discarded, thereby alleviating the problem of resource waste in the process of using edge nodes to provide services to users.

附图说明Description of the drawings

图1是本申请实施例提供的资源分配方法的流程图之一;Figure 1 is one of the flow charts of the resource allocation method provided by the embodiment of the present application;

图2是本申请实施例提供的资源分配方法的流程图之二;Figure 2 is the second flow chart of the resource allocation method provided by the embodiment of the present application;

图3是本申请实施例提供的资源分配装置的结构示意图;Figure 3 is a schematic structural diagram of a resource allocation device provided by an embodiment of the present application;

图4是本申请实施例提供的资源分配方法的电子设备的框图。FIG. 4 is a block diagram of an electronic device according to the resource allocation method provided by the embodiment of the present application.

具体实施方式Detailed ways

以下结合附图对本申请的示范性实施例做出说明,其中包括本申请实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本申请的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。Exemplary embodiments of the present application are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present application to facilitate understanding, and they should be considered to be exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the application. Also, descriptions of well-known functions and constructions are omitted from the following description for clarity and conciseness.

请参见图1,图1是本申请实施例提供的一种资源分配方法,应用于第一电子设备,包括:Please refer to Figure 1. Figure 1 is a resource allocation method provided by an embodiment of the present application, applied to a first electronic device, including:

步骤S101、在接收到作业任务的情况下,获取目标区域中多个第二电子设备的状态信息,其中,所述状态信息包括闲置资源空间和历史访问流量;Step S101: When receiving a job task, obtain status information of multiple second electronic devices in the target area, where the status information includes idle resource space and historical access traffic;

上述第一电子设备可以是用于与各第二电子设备进行通信的服务器,上述第二电子设备可以是部署与目标区域中不同位置的边缘节点设备,所述边缘节点设备也可以是服务器。可以通过所述第一电子设备向各第二电子设备发送用于执行不同厂商的作业任务的作业数据。例如,当所述厂商为爱奇艺时,可以通过第一电子设备将视频资源存储于各第二电子设备,这样,当用户访问爱奇艺应用播放视频时,可以通过距离用户所在地较近的第二电子设备为用户提供视频播放服务,即将该第二电子设备上的视频资源向用户进行发送,以提高用户播放视频资源的流畅性。The above-mentioned first electronic device may be a server for communicating with each second electronic device. The above-mentioned second electronic device may be an edge node device deployed in a different location from the target area. The edge node device may also be a server. Job data for performing job tasks of different manufacturers may be sent to each second electronic device through the first electronic device. For example, when the manufacturer is iQiyi, the video resources can be stored in each second electronic device through the first electronic device. In this way, when the user accesses the iQiyi application to play the video, the video resources can be stored through the device closer to the user's location. The second electronic device provides a video playback service for the user, that is, sends the video resources on the second electronic device to the user to improve the smoothness of the user's playback of the video resources.

上述目标区域可以是县级、市级、省级或国家级等行政区域。所述获取目标区域中多个第二电子设备的状态信息可以是指获取目标区域中所有第二电子设备的状态信息。The above target areas can be administrative areas at the county level, city level, provincial level or national level. The obtaining the status information of the plurality of second electronic devices in the target area may refer to obtaining the status information of all the second electronic devices in the target area.

上述闲置资源空间可以是指第二电子设备的存储资源空间、宽带资源空间、接口资源等。上述历史访问流量可以是指在过去一段时间内用户访问第二电子设备的服务次数,其中,所述用户访问第二电子设备的服务次数可以是用户访问第二电子设备上的不同服务的次数之和。例如,某一第二电子设备同时作为抖音、爱奇艺、腾讯的边缘节点,则该第二电子设备的历史访问流量为:在过去一段时间内访问该第二电子设备的所有抖音用户、爱奇艺用户、腾讯用户的数量之和。The above-mentioned idle resource space may refer to the storage resource space, broadband resource space, interface resources, etc. of the second electronic device. The above historical access traffic may refer to the number of times the user accessed the service of the second electronic device in the past period of time, wherein the number of times the user accessed the service of the second electronic device may be one of the number of times the user accessed different services on the second electronic device. and. For example, if a certain second electronic device serves as an edge node for Douyin, iQiyi, and Tencent at the same time, then the historical access traffic of the second electronic device is: all Douyin users who have accessed the second electronic device in the past period of time , the sum of the number of iQiyi users and Tencent users.

上述接收到作业任务可以是指某一厂商需要在目标区域部署边缘节点时所发出的作业任务。例如,目标区域内的很多用户均需通过A公司开发的视频软件观看视频,而A公司由于未在目标区域部署边缘节点,从而导致目标区域内的用户通过A公司的视频软件播放视频时经常出现由于资源不足而无法播放的问题。为此,A公司可以借助已经部署于目标区域的第二电子设备为A区域中的第二电子设备为用户提供服务,即从目标区域的第二电子设备中选择出至少一个目标电子设备,并从每个所述目标电子设备的闲置资源空间中选择固定大小的目标资源空间,并将所述选择的目标资源空间分配给A公司,这样,A公司可以通过第一电子设备将视频资源预先存储于各目标电子设备的目标资源空间内,以便于后续A区域内的用户可以直接接收目标电子设备发送的视频资源。The above received job task may refer to a job task issued by a certain manufacturer when it needs to deploy an edge node in the target area. For example, many users in the target area need to watch videos through the video software developed by Company A. However, because Company A has not deployed edge nodes in the target area, users in the target area often experience problems when playing videos through the video software of Company A. Unable to play due to insufficient resources. To this end, Company A can use the second electronic device that has been deployed in the target area to provide services to users for the second electronic device in area A, that is, select at least one target electronic device from the second electronic devices in the target area, and Select a target resource space of a fixed size from the idle resource space of each target electronic device, and allocate the selected target resource space to Company A. In this way, Company A can pre-store video resources through the first electronic device. In the target resource space of each target electronic device, so that subsequent users in area A can directly receive the video resources sent by the target electronic device.

在目标区域首次部署所述第二电子设备时,可以按照目标区域中的人口分布热力图的进行部署,即在人口分布密集的区域部署较多的第二电子设备,在人口分布稀疏的区域部署较少甚至不部署第二电子设备。When the second electronic device is deployed in the target area for the first time, it can be deployed according to the population distribution heat map in the target area, that is, more second electronic devices are deployed in areas with dense population distribution and more second electronic devices are deployed in areas with sparse population distribution. Less or no secondary electronics are deployed.

步骤S102、基于所述状态信息,从所述多个第二电子设备中筛选出至少一个目标电子设备;Step S102: Based on the status information, select at least one target electronic device from the plurality of second electronic devices;

其中,当接收到作业任务时,由于并非所有第二电子设备均适合运行该作业任务,例如,可能存在部分第二电子设备由于存储资源空间不足,而无法接收新的作业任务。或者,可能存在部分第二电子设备部署时间已经相当长,但历史访问流量非常少,即说明该第二电子设备的周边可能人烟稀少,即便能够将作业任务部署于该第二电子设备,即将视频资源存储于该第二电子设备,但由于该第二电子设备的周边人烟稀少,将导致很少用户通过该第二电子设备访问服务,进而无法通过该第二电子设备分担后台服务器的访问压力。When a job task is received, not all second electronic devices are suitable for running the job task. For example, some second electronic devices may be unable to receive new job tasks due to insufficient storage resource space. Or, there may be some second electronic devices that have been deployed for a long time, but have very little historical access traffic, which means that the surrounding area of the second electronic device may be sparsely populated. Even if the task can be deployed on the second electronic device, that is, the video resource Stored in the second electronic device, but because the surrounding area of the second electronic device is sparsely populated, few users will access the service through the second electronic device, and the access pressure of the backend server cannot be shared through the second electronic device.

为此,本申请实施例中可以通过选择目标区域中闲置资源较多且历史访问流量较多的第二电子设备作为所述目标电子设备。To this end, in the embodiment of the present application, a second electronic device with more idle resources and more historical access traffic in the target area can be selected as the target electronic device.

步骤S103、从每个所述目标电子设备的闲置资源空间中选择固定大小的目标资源空间,并将所述选择的目标资源空间分配给所述作业任务。Step S103: Select a target resource space of a fixed size from the idle resource space of each target electronic device, and allocate the selected target resource space to the job task.

其中,可以预先将每个所述目标电子设备的资源空间划分为若干个目标资源空间,每个目标资源空间可以作为一个厂商的作业任务的作业空间,这样,每台目标电子设备可以同时作为多个厂商的边缘节点。Among them, the resource space of each target electronic device can be divided into several target resource spaces in advance, and each target resource space can be used as a work space for a manufacturer's work tasks. In this way, each target electronic device can be used as a workspace for multiple tasks at the same time. edge nodes of each manufacturer.

上述闲置资源空间可以是指目前没有作业任务的资源空间。应当说明的是,在将某一目标资源空间作为某一作业任务的作业空间之后,若未将该目标资源空间重新分配至闲置空间,则该目标资源空间不再作为其他作业任务的作业空间,即便当前该目标资源空间未执行作业任务,也无法作为其他作业任务的作业空间。直至将该目标资源空间重新分配至闲置空间,并重新为该目标资源空间分配新的作业任务之后,该目标资源空间才能执行新的作业任务。The above-mentioned idle resource space may refer to a resource space that currently has no job tasks. It should be noted that after a certain target resource space is used as the working space of a certain job task, if the target resource space is not reallocated to idle space, the target resource space will no longer be used as the working space of other job tasks. Even if the target resource space is not currently executing a job task, it cannot be used as a job space for other job tasks. The target resource space cannot execute new job tasks until the target resource space is reallocated to idle space and new job tasks are reassigned to the target resource space.

上述固定大小的目标资源空间可以是指存储资源空间为100Mbps,宽带资源空间为500G等固定大小的资源空间,即从目标电子设备的剩余存储空间中划分出一个大小为100Mbps的空间,从所述目标电子设备的剩余宽带资源空间中划分出一个500G的空间作为所述目标资源空间。The above fixed size target resource space may refer to a fixed size resource space such as a storage resource space of 100Mbps and a broadband resource space of 500G. That is, a space of 100Mbps is divided from the remaining storage space of the target electronic device. A 500G space is divided from the remaining broadband resource space of the target electronic device as the target resource space.

该实施方式中,通过预先在目标区域内部署多个作为边缘节点的第二电子设备,当某一厂商需要利用边缘节点向用户提供服务时,仅需从多个第二电子设备中选择至少一个目标电子设备,并从每个目标电子设备中选择固定大小的目标资源空间作为该厂商的作业空间。当该厂商由于服务变更,而不再需要使用边缘节点时,可以直接将每个目标电子设备中的目标资源空间释放至闲置资源空间,以便于后续作为其他厂商的作业空间。这样,不同厂商在需要利用边缘节点向用户提供服务时,仅需从目标电子设备中划分出一定资源空间即可,而无需每次都部署节点设备,且服务变更时,仅需释放作业空间即可,而不会造成节点设备丢弃的问题,从而缓解了在利用边缘节点向用户提供服务的过程中,存在的资源浪费的问题。In this embodiment, by pre-deploying multiple second electronic devices as edge nodes in the target area, when a manufacturer needs to use edge nodes to provide services to users, it only needs to select at least one of the multiple second electronic devices. The target electronic device is selected, and a fixed-sized target resource space is selected from each target electronic device as the operating space of the manufacturer. When the manufacturer no longer needs to use edge nodes due to service changes, the target resource space in each target electronic device can be directly released to the idle resource space so that it can subsequently be used as operating space for other manufacturers. In this way, when different manufacturers need to use edge nodes to provide services to users, they only need to divide a certain resource space from the target electronic device, without deploying node equipment every time, and when the service changes, they only need to release the operating space. It can be used without causing the problem of node equipment being discarded, thereby alleviating the problem of resource waste in the process of using edge nodes to provide services to users.

可选地,所述闲置资源空间包括闲置存储资源空间和闲置宽带资源空间,所述基于所述状态信息,从所述多个第二电子设备中筛选出至少一个目标电子设备,包括:Optionally, the idle resource space includes idle storage resource space and idle broadband resource space, and selecting at least one target electronic device from the plurality of second electronic devices based on the status information includes:

基于所述闲置存储资源空间、所述闲置宽带资源空间和热度值,分别计算每个所述第二电子设备的评分值,其中,所述热度值为基于所述历史访问流量计算得到的值;Calculate the score value of each second electronic device based on the idle storage resource space, the idle broadband resource space and the popularity value, wherein the popularity value is a value calculated based on the historical access traffic;

将所述多个第二电子设备中评分值较高的前N个第二电子设备分别确定为所述目标电子设备,其中,所述N为大于或者等于1的整数。The top N second electronic devices with higher score values among the plurality of second electronic devices are respectively determined as the target electronic devices, where N is an integer greater than or equal to 1.

该实施方式中,通过基于闲置存储资源空间、所述闲置宽带资源空间和热度值,对每个第二电子设备进行评分,并将所述多个第二电子设备中评分值较高的前N个第二电子设备分别确定为所述目标电子设备。这样,可以确保所筛选出的目标电子设备为目标区域中剩余存储资源较多、剩余宽带资源较多以及访客数量较多的第二电子设备,从而提高为用户的服务效果。In this embodiment, each second electronic device is scored based on the idle storage resource space, the idle broadband resource space and the popularity value, and the top N devices with higher score values among the plurality of second electronic devices are Two second electronic devices are respectively determined as the target electronic devices. In this way, it can be ensured that the filtered target electronic device is the second electronic device with more remaining storage resources, more remaining broadband resources, and a greater number of visitors in the target area, thereby improving the service effect for users.

可选地,所述基于所述闲置存储资源空间、所述闲置宽带资源空间和热度值,分别计算每个所述第二电子设备的评分值,包括:Optionally, calculating the score value of each second electronic device based on the idle storage resource space, the idle broadband resource space and the popularity value includes:

根据如下公式计算每个所述第二电子设备的评分值:The score value of each second electronic device is calculated according to the following formula:

其中,所述S为所述评分值,所述λ为调整因子,所述为对所述热度值进行归一化处理之后得到的位于0至1之间的数值,所述/>为对所述闲置存储资源空间的大小进行归一化处理之后得到的位于0至1之间的数值,所述/>为对所述闲置宽带资源空间的大小进行归一化处理之后得到的位于0至1之间的数值。Wherein, the S is the score value, the λ is an adjustment factor, and the is a value between 0 and 1 obtained after normalizing the heat value, the/> is a value between 0 and 1 obtained after normalizing the size of the idle storage resource space, the/> It is a value between 0 and 1 obtained after normalizing the size of the idle broadband resource space.

上述调整因子可以是0至1之间的任意一个数值,可以根据经验进行选取,以确定热度值在评分值中的权重。上述对所述热度值进行归一化处理之后得到的位于0至1之间的数值的过程可以为:确定目标区域中所有第二电子设备的热度值的分布范围,例如,分布范围为[A1,A2],然后,然后获取某一第二电子设备e的热度值A3,其中,A1≤A3≤A2,则将该第二电子设备e的热度值归一化处理之后的数值/> The above adjustment factor can be any value between 0 and 1, and can be selected based on experience to determine the weight of the popularity value in the rating value. The value between 0 and 1 obtained after the above normalization process of the heat value The process can be: determining the distribution range of the heat values of all second electronic devices in the target area, for example, the distribution range is [A1, A2], and then obtaining the heat value A3 of a certain second electronic device e, where, A1≤A3≤A2, then the normalized value of the heat value of the second electronic device e/>

上述确定的过程为,先确定第二电子设备e的存储资源空间总量B1,然后确定该第二电子设备e当前闲置存储资源空间大小B2,则/>同理,上述/>的确定过程为:先确定第二电子设备e的宽带资源空间总量T1,然后确定该第二电子设备e当前闲置宽带资源空间大小T2,则/> The above is determined The process is to first determine the total storage resource space B1 of the second electronic device e, and then determine the current idle storage resource space size B2 of the second electronic device e, then/> In the same way, the above/> The determination process is: first determine the total amount of broadband resource space T1 of the second electronic device e, and then determine the current idle broadband resource space size T2 of the second electronic device e, then/>

此外,所述基于所述闲置存储资源空间、所述闲置宽带资源空间和热度值,分别计算每个所述第二电子设备的评分值,还可以包括:In addition, calculating the score value of each second electronic device based on the idle storage resource space, the idle broadband resource space and the popularity value may further include:

根据如下公式计算每个所述第二电子设备的评分值:The score value of each second electronic device is calculated according to the following formula:

其中,所述λ1、λ2和λ3分别为位于0至1之间的调整因子。Wherein, the λ1, λ2 and λ3 are adjustment factors between 0 and 1 respectively.

该实施方式与上述实施方式的区别在于,为闲置存储资源空间、所述闲置宽带资源空间和热度值分别设置权重,计算得到按照闲置存储资源空间、所述闲置宽带资源空间和热度值的重要性计算出更为合理的评分值。The difference between this embodiment and the above embodiment is that weights are respectively set for idle storage resource space, the idle broadband resource space and the popularity value, and the importance of the idle storage resource space, the idle broadband resource space and the popularity value is calculated. Calculate a more reasonable rating value.

此外,所述基于所述闲置存储资源空间、所述闲置宽带资源空间和热度值,分别计算每个所述第二电子设备的评分值,还可以包括:In addition, calculating the score value of each second electronic device based on the idle storage resource space, the idle broadband resource space and the popularity value may further include:

根据如下公式计算每个所述第二电子设备的评分值:The score value of each second electronic device is calculated according to the following formula:

该实施方式与上述实施例的区别在于仅考虑闲置存储资源空间和闲置宽带资源空间对各第二电子设备进行评分。The difference between this embodiment and the above-mentioned embodiment is that only idle storage resource space and idle broadband resource space are considered to score each second electronic device.

可选地,所述基于所述闲置存储资源空间、所述闲置宽带资源空间和热度值,分别计算每个所述第二电子设备的评分值之前,所述方法还包括:Optionally, before calculating the score value of each second electronic device based on the idle storage resource space, the idle broadband resource space and the popularity value, the method further includes:

确定第一目标设备集H,其中,所述第一目标设备集H包括所述多个第二电子设备中历史访问流量较高的前M个第二电子设备的状态信息;Determine a first target device set H, where the first target device set H includes status information of the top M second electronic devices with higher historical access traffic among the plurality of second electronic devices;

获取所述多个第二电子设备中每个所述第二电子设备的位置信息;Obtain the location information of each second electronic device in the plurality of second electronic devices;

根据如下公式计算每个所述第二电子设备的所述热度值:The heat value of each second electronic device is calculated according to the following formula:

其中,所述Hote为目标第二电子设备的热度值,所述目标第二电子设备为所述多个第二电子设备中的任一第二电子设备,所述|Pe-Ph|为所述目标第二电子设备与所述第一目标设备集H中的任一第二电子设备之间的距离值,|Pe-Ph|的单位为千米。Wherein, the Hot e is the heat value of the target second electronic device, the target second electronic device is any second electronic device among the plurality of second electronic devices, and the |P e -P h | is the distance value between the target second electronic device and any second electronic device in the first target device set H, and the unit of |P e -P h | is kilometers.

具体地,可以基于所述多个第二电子设备的访问流量对所述多个第二电子设备进行排序,以便于从多个第二电子设备中选取出热度较高的前M个第二电子设备,并将所选的前M个第二电子设备的状态信息存入第一目标设备集H。也可以是在对所述多个第二电子设备进行排序之后,选取排序靠前的前10%的第二电子设备的状态信息存入第一目标设备集H。Specifically, the plurality of second electronic devices can be sorted based on the access traffic of the plurality of second electronic devices, so as to select the top M second electronic devices with higher popularity from the plurality of second electronic devices. device, and store the status information of the selected first M second electronic devices into the first target device set H. It may also be that after sorting the plurality of second electronic devices, the status information of the top 10% second electronic devices with the highest ranking is selected and stored in the first target device set H.

由于所述第一目标设备集H中的第二电子设备为热度较高的边缘节点,因此,第一目标设备集H中的第二电子设备很可能位于人流密度较大的区域。相应的,若第一目标设备集H之外的其他第二电子设备f距离第一目标设备集H中的第二电子设备越近,则说明第二电子设备f位于人流密度较高的区域的可能性越大,相应地热度值也越高。反之,若第二电子设备f距离第一目标设备集H中的第二电子设备越远,则说明第二电子设备f位于人流密度较高的区域的可能性越小,相应地热度值也越低。Since the second electronic device in the first target device set H is a relatively hot edge node, the second electronic device in the first target device set H is likely to be located in an area with a high human flow density. Correspondingly, if the other second electronic devices f outside the first target device set H are closer to the second electronic device in the first target device set H, it means that the second electronic device f is located in an area with a high human flow density. The greater the possibility, the higher the heat value accordingly. On the contrary, if the second electronic device f is further away from the second electronic device in the first target device set H, it means that the possibility of the second electronic device f being located in an area with higher human flow density is smaller, and accordingly the heat value is also higher. Low.

因此,在计算多个第二电子设备的热度值时,可以基于所要计算的第二电子设备c与第一目标设备集H的各第二电子设备之间的相对距离,以确定所要计算的第二电子设备c的热度值。例如,当所要计算的第二电子设备c为第一目标设备集H中的某一第二电子设备时,而第二电子设备c与其本身之间的距离趋近于0,因此中必然存在一个|Pe-Ph|趋近于0,此时lg|Pe-Ph|趋近于负无穷大,因此,求和之后/>趋近于正无穷大,说明第一目标设备集H中的第二电子设备c的热度值趋近于正无穷大,也即对应的热度值越高。而当某一第二电子设备f与第一目标设备集H中的各第二电子设备之间的距离均较远,例如该第二电子设备f与第一目标设备集H中的各第二电子设备之间的距离均超过10千米,即/>中的所有|Pe-Ph|均大于10,也即/>中的所有(-lg|Pe-Ph|)均为负值,此时,求和之后得到的/>也为负值,说明该第二电子设备f的热度越低。基于此,通过公式/>计算各第二电子设备的热度值之后,可以通过数值的大小判断出各第二电子设备的热度高低。Therefore, when calculating the heat values of multiple second electronic devices, the first electronic device to be calculated can be determined based on the relative distance between the second electronic device c to be calculated and each second electronic device of the first target device set H. 2. The heat value of the electronic device c. For example, when the second electronic device c to be calculated is a second electronic device in the first target device set H, and the distance between the second electronic device c and itself approaches 0, therefore There must be a |P e -P h | approaching 0. At this time, lg|P e -P h | approaches negative infinity. Therefore, after the summation/> Approaches positive infinity, indicating that the heat value of the second electronic device c in the first target device set H approaches positive infinity, that is, the corresponding heat value is higher. And when the distance between a certain second electronic device f and each second electronic device in the first target device set H is relatively far, for example, the second electronic device f and each second electronic device in the first target device set H The distance between electronic devices exceeds 10 kilometers, that is/> All |P e -P h | in are greater than 10, that is, /> All (-lg|P e -P h |) in are negative values. At this time, the /> obtained after summing It is also a negative value, indicating that the heat of the second electronic device f is lower. Based on this, through the formula/> After calculating the heat value of each second electronic device, the heat level of each second electronic device can be determined based on the value.

可选地,所述方法还包括:Optionally, the method also includes:

确定第二目标电子设备,其中,所述第二目标电子设备为所述多个第二电子设备中,同步运行至少两个不同的作业任务的第二电子设备;Determine a second target electronic device, wherein the second target electronic device is a second electronic device among the plurality of second electronic devices that synchronously runs at least two different job tasks;

在所述至少两个不同的作业任务包括第一作业任务和第二作业任务的情况下,将第一目标资源空间中的固定大小的第一空间分配给所述第二作业任务;In the case where the at least two different job tasks include a first job task and a second job task, allocate a first space of a fixed size in the first target resource space to the second job task;

其中,所述第一作业任务为在第一预设时间段内目标资源空间的使用率均小于第一预设值的作业任务,所述第二作业任务为在所述第一预设时间段内目标资源空间的使用率均大于或者等于第一预设值,且所述第一预设时间段内所述目标资源空间的使用率持续增加的作业任务;所述第一目标资源空间为所述第一作业任务的作业空间,所述第二目标资源空间为所述第二作业任务的作业空间。Wherein, the first job task is a job task in which the usage rate of the target resource space is less than the first preset value in the first preset time period, and the second job task is a job task in which the usage rate of the target resource space is less than the first preset value in the first preset time period. The usage rate of the target resource space within the first preset time period is greater than or equal to the first preset value, and the usage rate of the target resource space continues to increase during the first preset time period; the first target resource space is the The operation space of the first operation task is the operation space of the second operation task, and the second target resource space is the operation space of the second operation task.

其中,所述第一预设时间段可以是过去一周、过去半个月、过去一个月等时间段。Wherein, the first preset time period may be a time period such as the past week, the past half month, the past month, etc.

上述第一目标资源空间可以是指存储资源空间为100Mbps,宽带资源空间为500G等固定大小的资源空间。上述第二目标资源空间可以是指存储资源空间为100Mbps,宽带资源空间为500G等固定大小的资源空间。The above-mentioned first target resource space may refer to a fixed size resource space such as a storage resource space of 100Mbps and a broadband resource space of 500G. The above-mentioned second target resource space may refer to a resource space of a fixed size such as a storage resource space of 100Mbps and a broadband resource space of 500G.

上述目标资源空间的使用率可以包括存储资源的使用率x%和宽带资源的使用率y%。上述第一作业任务为在第一预设时间段内目标资源空间的使用率均小于第一预设值的作业任务,可以是指:过去一个月内第一作业任务的存储资源的使用率低于50%,宽带资源的使用率也低于50%。上述第二作业任务为在所述第一预设时间段内目标资源空间的使用率均大于或者等于第一预设值,且所述第一预设时间段内所述目标资源空间的使用率持续增加的作业任务,可以是指:过去一个月第二作业任务的存储资源的使用率高于50%,宽带资源的使用率也高于50%,且每天存储资源的使用率均高于前一天存储资源的使用率,以及每天宽带资源的使用率也均高于前一天宽带资源的使用率。The usage rate of the target resource space may include the usage rate x% of storage resources and the usage rate y% of broadband resources. The above-mentioned first job task is a job task in which the usage rate of the target resource space in the first preset time period is less than the first preset value, which may refer to: the storage resource usage rate of the first job task in the past month is low. is less than 50%, and the usage rate of broadband resources is also less than 50%. The above-mentioned second task is that the usage rate of the target resource space within the first preset time period is greater than or equal to the first preset value, and the usage rate of the target resource space within the first preset time period is Job tasks that continue to increase can refer to: the storage resource usage of the second job task in the past month is higher than 50%, the usage of broadband resources is also higher than 50%, and the daily storage resource usage is higher than before. The usage rate of storage resources in one day and the usage rate of broadband resources in one day are also higher than the usage rate of broadband resources in the previous day.

其中,所述第一作业任务的存储资源的使用率可以是指,执行第一作业任务实际所占用的空间与第一目标资源空间之间的比值。可以每隔三十分钟计算一次存储资源的使用率,然后求取一天的存储资源的使用率的平均值,从而得到该天的存储资源使用率。同理,除第一作业任务之外的其他作业任务的存储资源的使用率的计算过程也可以按照上述方法进行计算。此外,宽带资源的使用率的计算过程也可以按照上述方法进行计算。Wherein, the usage rate of the storage resource of the first job task may refer to the ratio between the space actually occupied by executing the first job task and the first target resource space. The storage resource usage can be calculated every thirty minutes, and then the average storage resource usage for a day can be calculated to obtain the storage resource usage for that day. Similarly, the calculation process of storage resource usage of other job tasks except the first job task can also be calculated according to the above method. In addition, the calculation process of broadband resource usage can also be calculated according to the above method.

上述第一空间可以是所述第一目标资源空间中的10%的资源空间。The above-mentioned first space may be 10% of the resource space in the first target resource space.

该实施方式中,通过确定同时运行至少两个作业任务的第二目标电子设备,然后监测每个第二目标电子设备中各作业任务的目标资源空间的使用率,并且将目标资源空间的使用率低的第一作业任务的空间转移至目标资源空间的使用率高,且目标资源空间的使用率不断上升的第二作业任务。从而实现动态的条件第二目标电子设备中各作业任务所占用的空间。确保各作业任务在第二目标电子设备上正常运行,提高了资源的利用率。In this embodiment, the second target electronic device that runs at least two job tasks at the same time is determined, and then the usage rate of the target resource space of each job task in each second target electronic device is monitored, and the usage rate of the target resource space is The first job task with low space is transferred to the second job task with high target resource space usage and increasing target resource space usage. This achieves a dynamic condition of the space occupied by each task in the second target electronic device. This ensures that each job task runs normally on the second target electronic device, thereby improving resource utilization.

可选地,所述方法还包括:Optionally, the method also includes:

确定第三目标电子设备,其中,所述第三目标电子设备为所述多个第二电子设备中运行第三作业任务的第二电子设备,其中,所述第三作业任务为在第二预设时间段内目标资源空间的使用率均小于第二预设值的作业任务;Determine a third target electronic device, where the third target electronic device is a second electronic device running a third job task among the plurality of second electronic devices, where the third job task is a second predetermined Assume that the usage rate of the target resource space within the time period is less than the second preset value of the job task;

在距离所述第三目标电子设备预设距离的范围内确定第四目标电子设备,其中,所述第四目标电子设备为所述闲置资源空间的值大于第三预设值的第二电子设备;Determine a fourth target electronic device within a range of a preset distance from the third target electronic device, where the fourth target electronic device is a second electronic device with a value of the idle resource space greater than a third preset value. ;

在所述第四目标电子设备中选择固定大小的第四目标资源空间,并将所述第四目标资源空间分配给所述第三作业任务;Select a fourth target resource space of a fixed size in the fourth target electronic device, and allocate the fourth target resource space to the third job task;

将所述第三目标电子设备中的第三目标资源空间分配至所述第三目标电子设备的闲置资源空间,其中,所述第三目标资源空间为所述第三作业任务的作业空间。Allocate a third target resource space in the third target electronic device to an idle resource space of the third target electronic device, where the third target resource space is a work space of the third job task.

上述第三目标资源空间可以是指存储资源空间为100Mbps,宽带资源空间为500G等固定大小的资源空间。The above third target resource space may refer to a fixed size resource space such as a storage resource space of 100Mbps and a broadband resource space of 500G.

上述第三目标电子设备除了运行所述第三作业任务之外还可以运行其他作业任务。上述第二预设时间段可以是过去一周、过去半个月、过去一个月等时间段。上述第二预设值可以是第三目标资源空间的10%。上述预设距离的范围内可以是3千米至5千米的范围内。此外,上述第三目标电子设备可以是第一目标设备集H中的第二电子设备,上述第四目标电子设备可以是第一目标设备集H之外的第二电子设备。In addition to running the third job task, the third target electronic device may also run other job tasks. The above-mentioned second preset time period may be a time period such as the past week, the past half month, the past month, etc. The above-mentioned second preset value may be 10% of the third target resource space. The range of the above preset distance may be within the range of 3 kilometers to 5 kilometers. In addition, the third target electronic device may be a second electronic device in the first target device set H, and the fourth target electronic device may be a second electronic device outside the first target device set H.

上述第四目标资源空间可以是指存储资源空间为100Mbps,宽带资源空间为500G等固定大小的资源空间。The above fourth target resource space may refer to a fixed size resource space such as a storage resource space of 100Mbps and a broadband resource space of 500G.

该实施方式中,通过确定第三目标电子设备中资源利用率较低的第三作业任务,并将该第三作业任务迁移至评分值较低的第四目标电子设备,从而确保评分值较高的边缘节点上运行的作业任务的资源率均相对较高,进而使得优质的边缘节点整体的资源率得到充分利用。In this implementation, a third job task with a lower resource utilization rate in the third target electronic device is determined, and the third job task is migrated to a fourth target electronic device with a lower score, thereby ensuring a higher score. The resource rate of the job tasks running on the edge nodes is relatively high, thus making the overall resource rate of high-quality edge nodes fully utilized.

请参见图2,为本申请一具体实施例提供的一种资源分配方法,其具体过程为:(1)基于位置信息与人流热力图在目标区域部署多个第二电子设备;即根据各个位置的人流密度部署第二电子设备,人流密度越高,部署的第二电子设备越密集。(2)在首次接收到作业任务的情况下,基于位置信息与人流热力图,从多个第二电子设备中筛选出至少一个目标电子设备。即在完成第二电子设备的部署之后,首次接收到作业任务的情况下,由于各第二电子设备的评分值均一致,因此,基于位置信息与人流热力图,从多个第二电子设备中筛选出至少一个目标电子设备。(3)在后续接收到作业任务的情况下,基于状态信息,从多个第二电子设备中筛选出至少一个目标电子设备。由于部署完首次作业任务之后,各第二电子设备的历史流量及剩余资源数量将逐渐存在差异,因此,各第二电子设备的评分值将出现差异,故后续可以按照上述资源分配方法部署后续接收到的作业任务。(3)监测各第二电子设备上运行的作业任务的目标资源空间的使用率,在监测到第二目标电子设备的至少两个不同作业任务中包括第一作业任务和第二作业任务的情况下,将第一目标资源空间中的固定大小的第一空间分配给第二作业任务,其中,所述第一作业任务为在第一预设时间段内目标资源空间的使用率均小于第一预设值的作业任务,所述第二作业任务为在所述第一预设时间段内目标资源空间的使用率均大于或者等于第一预设值,且所述第一预设时间段内所述目标资源空间的使用率持续增加的作业任务;所述第一目标资源空间为所述第一作业任务的作业空间,所述第二目标资源空间为所述第二作业任务的作业空间。(4)在监测到存在第三目标电子设备的情况下,将第三作业任务从第三目标电子设备迁移至第四目标电子设备,其中,所述第三目标电子设备为所述多个第二电子设备中运行第三作业任务的第二电子设备,其中,所述第三作业任务为在第二预设时间段内目标资源空间的使用率均小于第二预设值的作业任务。所述将第三作业任务从第三目标电子设备迁移至第四目标电子设备包括:在距离所述第三目标电子设备预设距离的范围内确定第四目标电子设备,其中,所述第四目标电子设备为所述闲置资源空间的值大于第三预设值的第二电子设备;在所述第四目标电子设备中选择固定大小的第四目标资源空间,并将所述第四目标资源空间分配给所述第三作业任务;将所述第三目标电子设备中的第三目标资源空间分配至所述第三目标电子设备的闲置资源空间,其中,所述第三目标资源空间为所述第三作业任务的作业空间,所述第三目标电子设备的评分值高于所述第四目标电子设备的评分值。Please refer to Figure 2, which is a resource allocation method provided by a specific embodiment of the present application. The specific process is: (1) deploy multiple second electronic devices in the target area based on location information and people flow heat map; that is, based on each location The second electronic device is deployed according to the density of people flow. The higher the density of people flow, the denser the second electronic device is deployed. (2) When a job task is received for the first time, at least one target electronic device is selected from a plurality of second electronic devices based on the location information and the people flow heat map. That is, after the deployment of the second electronic device is completed, when a job task is received for the first time, since the scoring values of each second electronic device are consistent, based on the location information and the people flow heat map, the second electronic device is selected from the multiple second electronic devices based on the location information and the people flow heat map. Filter out at least one target electronic device. (3) When a job task is subsequently received, at least one target electronic device is selected from the plurality of second electronic devices based on the status information. After the first operation task is deployed, the historical traffic and remaining resource quantity of each second electronic device will gradually differ. Therefore, the score value of each second electronic device will be different. Therefore, subsequent reception can be deployed according to the above resource allocation method. Arrival assignments. (3) Monitor the usage rate of the target resource space of the job tasks running on each second electronic device, and detect that at least two different job tasks of the second target electronic device include the first job task and the second job task. Next, allocate a first space of a fixed size in the first target resource space to a second job task, wherein the first job task is such that the usage rate of the target resource space within the first preset time period is less than the first A task with a preset value, the second task is that the usage rate of the target resource space within the first preset time period is greater than or equal to the first preset value, and within the first preset time period A job task in which the usage rate of the target resource space continues to increase; the first target resource space is the work space of the first job task, and the second target resource space is the work space of the second job task. (4) When the presence of a third target electronic device is detected, migrate the third job task from the third target electronic device to the fourth target electronic device, wherein the third target electronic device is the plurality of third electronic devices. A second electronic device running a third job task among the two electronic devices, wherein the third job task is a job task in which the usage rate of the target resource space within the second preset time period is less than the second preset value. The migrating the third task from the third target electronic device to the fourth target electronic device includes: determining the fourth target electronic device within a preset distance from the third target electronic device, wherein the fourth target electronic device The target electronic device is a second electronic device with a value of the idle resource space greater than a third preset value; select a fourth target resource space of a fixed size in the fourth target electronic device, and add the fourth target resource Allocate space to the third task; allocate a third target resource space in the third target electronic device to an idle resource space of the third target electronic device, wherein the third target resource space is the In the work space of the third task, the score value of the third target electronic device is higher than the score value of the fourth target electronic device.

请参见图3,图3为本申请实施例提供的一种资源分配装置300,包括:Please refer to Figure 3. Figure 3 is a resource allocation device 300 provided by an embodiment of the present application, including:

第一获取模块301,用于在接收到作业任务的情况下,获取目标区域中多个第二电子设备的状态信息,其中,所述状态信息包括闲置资源空间和历史访问流量;The first acquisition module 301 is configured to acquire status information of multiple second electronic devices in the target area when receiving a job task, where the status information includes idle resource space and historical access traffic;

筛选模块302,用于基于所述状态信息,从所述多个第二电子设备中筛选出至少一个目标电子设备;Screening module 302, configured to screen out at least one target electronic device from the plurality of second electronic devices based on the status information;

分配模块303,用于从每个所述目标电子设备的闲置资源空间中选择固定大小的目标资源空间,并将所述选择的目标资源空间分配给所述作业任务。The allocation module 303 is configured to select a target resource space of a fixed size from the idle resource space of each target electronic device, and allocate the selected target resource space to the job task.

可选地,所述闲置资源空间包括闲置存储资源空间和闲置宽带资源空间,所述筛选模块302包括:Optionally, the idle resource space includes idle storage resource space and idle broadband resource space, and the screening module 302 includes:

计算子模块,用于基于所述闲置存储资源空间、所述闲置宽带资源空间和热度值,分别计算每个所述第二电子设备的评分值,其中,所述热度值为基于所述历史访问流量计算得到的值;Calculation sub-module, configured to calculate the score value of each second electronic device based on the idle storage resource space, the idle broadband resource space and a popularity value, wherein the popularity value is based on the historical access The value obtained by flow calculation;

确定子模块,用于将所述多个第二电子设备中评分值较高的前N个第二电子设备分别确定为所述目标电子设备,其中,所述N为大于或者等于1的整数。A determination sub-module is configured to determine the top N second electronic devices with higher score values among the plurality of second electronic devices as the target electronic devices, respectively, where N is an integer greater than or equal to 1.

可选地,所述计算子模块:具体用于根据如下公式计算每个所述第二电子设备的评分值:Optionally, the calculation sub-module is specifically configured to calculate the score value of each second electronic device according to the following formula:

其中,所述S为所述评分值,所述λ为调整因子,所述为对所述热度值进行归一化处理之后得到的位于0至1之间的数值,所述/>为对所述闲置存储资源空间的大小进行归一化处理之后得到的位于0至1之间的数值,所述/>为对所述闲置宽带资源空间的大小进行归一化处理之后得到的位于0至1之间的数值。Wherein, the S is the score value, the λ is an adjustment factor, and the is a value between 0 and 1 obtained after normalizing the heat value, the/> is a value between 0 and 1 obtained after normalizing the size of the idle storage resource space, the/> It is a value between 0 and 1 obtained after normalizing the size of the idle broadband resource space.

可选地,所述装置还包括:Optionally, the device also includes:

第一确定模块,用于确定第一目标设备集H,其中,所述第一目标设备集H包括所述多个第二电子设备中历史访问流量较高的前M个第二电子设备的状态信息;A first determination module, configured to determine a first target device set H, where the first target device set H includes the status of the top M second electronic devices with higher historical access traffic among the plurality of second electronic devices. information;

第二获取模块,用于获取所述多个第二电子设备中每个所述第二电子设备的位置信息;a second acquisition module, configured to acquire the location information of each second electronic device in the plurality of second electronic devices;

计算模块,用于根据如下公式计算每个所述第二电子设备的所述热度值:A calculation module, configured to calculate the heat value of each second electronic device according to the following formula:

其中,所述Hote为目标第二电子设备的热度值,所述目标第二电子设备为所述多个第二电子设备中的任一第二电子设备,所述|Pe-Ph|为所述目标第二电子设备与所述第一目标设备集H中的任一第二电子设备之间的距离值。Wherein, the Hot e is the heat value of the target second electronic device, the target second electronic device is any second electronic device among the plurality of second electronic devices, and the |P e -P h | is the distance value between the target second electronic device and any second electronic device in the first target device set H.

可选地,所述装置还包括:Optionally, the device also includes:

第二确定模块,用于确定第二目标电子设备,其中,所述第二目标电子设备为所述多个第二电子设备中,同步运行至少两个不同的作业任务的第二电子设备;a second determination module, configured to determine a second target electronic device, wherein the second target electronic device is a second electronic device among the plurality of second electronic devices that synchronously runs at least two different job tasks;

所述分配模块303,还用于在所述至少两个不同的作业任务包括第一作业任务和第二作业任务的情况下,将第一目标资源空间中的固定大小的第一空间分配给所述第二作业任务;The allocation module 303 is also configured to allocate a first space of a fixed size in the first target resource space to the first space in the first target resource space when the at least two different job tasks include a first job task and a second job task. Describe the second homework task;

其中,所述第一作业任务为在第一预设时间段内目标资源空间的使用率均小于第一预设值的作业任务,所述第二作业任务为在所述第一预设时间段内目标资源空间的使用率均大于或者等于第一预设值,且所述第一预设时间段内所述目标资源空间的使用率持续增加的作业任务;所述第一目标资源空间为所述第一作业任务的作业空间,所述第二目标资源空间为所述第二作业任务的作业空间。Wherein, the first job task is a job task in which the usage rate of the target resource space is less than the first preset value in the first preset time period, and the second job task is a job task in which the usage rate of the target resource space is less than the first preset value in the first preset time period. The usage rate of the target resource space within the first preset time period is greater than or equal to the first preset value, and the usage rate of the target resource space continues to increase during the first preset time period; the first target resource space is the The operation space of the first operation task is the operation space of the second operation task, and the second target resource space is the operation space of the second operation task.

可选地,所述装置还包括:Optionally, the device also includes:

第三确定模块,用于确定第三目标电子设备,其中,所述第三目标电子设备为所述多个第二电子设备中运行第三作业任务的第二电子设备,其中,所述第三作业任务为在第二预设时间段内目标资源空间的使用率均小于第二预设值的作业任务;A third determination module, configured to determine a third target electronic device, where the third target electronic device is a second electronic device running a third job task among the plurality of second electronic devices, where the third The job task is a job task whose usage rate of the target resource space is less than the second preset value within the second preset time period;

第四确定模块,用于在距离所述第三目标电子设备预设距离的范围内确定第四目标电子设备,其中,所述第四目标电子设备为所述闲置资源空间的值大于第三预设值的第二电子设备;A fourth determination module, configured to determine a fourth target electronic device within a preset distance range from the third target electronic device, wherein the value of the idle resource space of the fourth target electronic device is greater than the third preset distance. Second electronic device for setting value;

所述分配模块303,还用于在所述第四目标电子设备中选择固定大小的第四目标资源空间,并将所述第四目标资源空间分配给所述第三作业任务;The allocation module 303 is also configured to select a fourth target resource space of a fixed size in the fourth target electronic device, and allocate the fourth target resource space to the third job task;

所述分配模块303,还用于将所述第三目标电子设备中的第三目标资源空间分配至所述第三目标电子设备的闲置资源空间,其中,所述第三目标资源空间为所述第三作业任务的作业空间,所述第三目标电子设备的评分值高于所述第四目标电子设备的评分值。The allocation module 303 is also configured to allocate the third target resource space in the third target electronic device to the idle resource space of the third target electronic device, wherein the third target resource space is the In the work space of the third task, the score value of the third target electronic device is higher than the score value of the fourth target electronic device.

本实施例提供的资源分配装置300能够实现图1-2所示的方法实施例中的各个过程,且可以达到相同有益效果,为避免重复,这里不再赘述。The resource allocation device 300 provided in this embodiment can implement each process in the method embodiment shown in Figures 1-2, and can achieve the same beneficial effects. To avoid duplication, details will not be described here.

根据本申请的实施例,本申请还提供了一种电子设备和一种可读存储介质。According to embodiments of the present application, the present application also provides an electronic device and a readable storage medium.

如图4所示,是根据本申请实施例的资源分配方法的电子设备的框图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本申请的实现。As shown in Figure 4, it is a block diagram of an electronic device according to the resource allocation method according to the embodiment of the present application. Electronic devices are intended to refer to various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are examples only and are not intended to limit the implementation of the present application as described and/or claimed herein.

如图4所示,该电子设备包括:一个或多个处理器401、存储器402,以及用于连接各部件的接口,包括高速接口和低速接口。各个部件利用不同的总线互相连接,并且可以被安装在公共主板上或者根据需要以其它方式安装。处理器可以对在电子设备内执行的指令进行处理,包括存储在存储器中或者存储器上以在外部输入/输出装置(诸如,耦合至接口的显示设备)上显示GUI的图形信息的指令。在其它实施方式中,若需要,可以将多个处理器和/或多条总线与多个存储器和多个存储器一起使用。同样,可以连接多个电子设备,各个设备提供部分必要的操作(例如,作为服务器阵列、一组刀片式服务器、或者多处理器系统)。图4中以一个处理器401为例。As shown in Figure 4, the electronic device includes: one or more processors 401, memory 402, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses and can be mounted on a common motherboard or otherwise mounted as desired. The processor may process instructions executed within the electronic device, including instructions stored in or on memory to display graphical information of the GUI on an external input/output device, such as a display device coupled to the interface. In other embodiments, multiple processors and/or multiple buses may be used with multiple memories and multiple memories, if desired. Likewise, multiple electronic devices can be connected, each device providing part of the necessary operation (eg, as a server array, a set of blade servers, or a multi-processor system). In Figure 4, a processor 401 is taken as an example.

存储器402即为本申请所提供的非瞬时计算机可读存储介质。其中,所述存储器存储有可由至少一个处理器执行的指令,以使所述至少一个处理器执行本申请所提供的资源分配方法。本申请的非瞬时计算机可读存储介质存储计算机指令,该计算机指令用于使计算机执行本申请所提供的资源分配方法。The memory 402 is the non-transitory computer-readable storage medium provided by this application. The memory stores instructions executable by at least one processor, so that the at least one processor executes the resource allocation method provided by this application. The non-transitory computer-readable storage medium of this application stores computer instructions, which are used to cause the computer to execute the resource allocation method provided by this application.

存储器402作为一种非瞬时计算机可读存储介质,可用于存储非瞬时软件程序、非瞬时计算机可执行程序以及模块,如本申请实施例中的资源分配方法对应的程序指令/模块(例如,附图3所示的第一获取模块301、筛选模块302和分配模块303)。处理器401通过运行存储在存储器402中的非瞬时软件程序、指令以及模块,从而执行服务器的各种功能应用以及数据处理,即实现上述方法实施例中的资源分配方法。As a non-transitory computer-readable storage medium, the memory 402 can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions/modules corresponding to the resource allocation method in the embodiment of the present application (for example, attached The first acquisition module 301, filtering module 302 and distribution module 303 shown in Figure 3). The processor 401 executes various functional applications and data processing of the server by running non-transient software programs, instructions and modules stored in the memory 402, that is, implementing the resource allocation method in the above method embodiment.

存储器402可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据资源分配方法的电子设备的使用所创建的数据等。此外,存储器402可以包括高速随机存取存储器,还可以包括非瞬时存储器,例如至少一个磁盘存储器件、闪存器件、或其他非瞬时固态存储器件。在一些实施例中,存储器402可选包括相对于处理器401远程设置的存储器,这些远程存储器可以通过网络连接至资源分配方法的电子设备。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 402 may include a stored program area and a stored data area, wherein the stored program area may store an operating system and an application program required for at least one function; the stored data area may store data created according to the use of the electronic device according to the resource allocation method, etc. . In addition, memory 402 may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 402 optionally includes memory located remotely relative to the processor 401, and these remote memories may be connected to electronic devices of the resource allocation method through a network. Examples of the above-mentioned networks include but are not limited to the Internet, intranets, local area networks, mobile communication networks and combinations thereof.

资源分配方法的电子设备还可以包括:输入装置403和输出装置404。处理器401、存储器402、输入装置403和输出装置404可以通过总线或者其他方式连接,图4中以通过总线连接为例。The electronic device of the resource allocation method may also include: an input device 403 and an output device 404. The processor 401, the memory 402, the input device 403 and the output device 404 can be connected through a bus or other means. In Figure 4, connection through a bus is taken as an example.

输入装置403可接收输入的数字或字符信息,以及产生与资源分配方法的电子设备的用户设置以及功能控制有关的键信号输入,例如触摸屏、小键盘、鼠标、轨迹板、触摸板、指示杆、一个或者多个鼠标按钮、轨迹球、操纵杆等输入装置。输出装置404可以包括显示设备、辅助照明装置(例如,LED)和触觉反馈装置(例如,振动电机)等。该显示设备可以包括但不限于,液晶显示器(LCD)、发光二极管(LED)显示器和等离子体显示器。在一些实施方式中,显示设备可以是触摸屏。The input device 403 can receive input numeric or character information, and generate key signal input related to user settings and function control of the electronic device of the resource allocation method, such as a touch screen, a keypad, a mouse, a trackpad, a touch pad, a pointing stick, One or more input devices such as mouse buttons, trackballs, and joysticks. Output devices 404 may include display devices, auxiliary lighting devices (eg, LEDs), tactile feedback devices (eg, vibration motors), and the like. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display, and a plasma display. In some implementations, the display device may be a touch screen.

此处描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、专用ASIC(专用集成电路)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。Various implementations of the systems and techniques described herein may be implemented in digital electronic circuitry, integrated circuit systems, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include implementation in one or more computer programs executable and/or interpreted on a programmable system including at least one programmable processor, the programmable processor The processor, which may be a special purpose or general purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device. An output device.

这些计算程序(也称作程序、软件、软件应用、或者代码)包括可编程处理器的机器指令,并且可以利用高级过程和/或面向对象的编程语言、和/或汇编/机器语言来实施这些计算程序。如本文使用的,术语“机器可读介质”和“计算机可读介质”指的是用于将机器指令和/或数据提供给可编程处理器的任何计算机程序产品、设备、和/或装置(例如,磁盘、光盘、存储器、可编程逻辑装置(PLD)),包括,接收作为机器可读信号的机器指令的机器可读介质。术语“机器可读信号”指的是用于将机器指令和/或数据提供给可编程处理器的任何信号。These computing programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processors, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine language Calculation program. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or means for providing machine instructions and/or data to a programmable processor ( For example, magnetic disks, optical disks, memories, programmable logic devices (PLD)), including machine-readable media that receive machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.

为了提供与用户的交互,可以在计算机上实施此处描述的系统和技术,该计算机具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给计算机。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。To provide interaction with a user, the systems and techniques described herein may be implemented on a computer having a display device (eg, a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user ); and a keyboard and pointing device (eg, a mouse or a trackball) through which a user can provide input to the computer. Other kinds of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and may be provided in any form, including Acoustic input, voice input or tactile input) to receive input from the user.

可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)和互联网。The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., A user's computer having a graphical user interface or web browser through which the user can interact with implementations of the systems and technologies described herein), or including such backend components, middleware components, or any combination of front-end components in a computing system. The components of the system may be interconnected by any form or medium of digital data communication (eg, a communications network). Examples of communication networks include: local area network (LAN), wide area network (WAN), and the Internet.

计算机系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。Computer systems may include clients and servers. Clients and servers are generally remote from each other and typically interact over a communications network. The relationship of client and server is created by computer programs running on corresponding computers and having a client-server relationship with each other.

根据本申请实施例的技术方案,本申请通过预先在目标区域内部署多个作为边缘节点的第二电子设备,当某一厂商需要利用边缘节点向用户提供服务时,仅需从多个第二电子设备中选择至少一个目标电子设备,并从每个目标电子设备中选择固定大小的目标资源空间作为该厂商的作业空间。当该厂商由于服务变更,而不再需要使用边缘节点时,可以直接每个目标电子设备中的目标资源空间释放至闲置资源空间,以便于后续作为其他厂商的作业空间。这样,不同厂商在需要利用边缘节点向用户提供服务时,仅需从目标电子设备中划分出一定资源空间即可,而无需每次都部署节点设备,且服务变更时,仅需释放作业空间即可,而不会造成节点设备丢弃的问题,从而缓解了在利用边缘节点向用户提供服务的过程中,存在的资源浪费的问题。According to the technical solutions of the embodiments of this application, this application pre-deploys multiple second electronic devices as edge nodes in the target area. When a manufacturer needs to use edge nodes to provide services to users, it only needs to obtain services from multiple second electronic devices. Select at least one target electronic device from the electronic devices, and select a target resource space of a fixed size from each target electronic device as the operating space of the manufacturer. When the manufacturer no longer needs to use edge nodes due to service changes, the target resource space in each target electronic device can be directly released to the idle resource space so that it can subsequently be used as operating space for other manufacturers. In this way, when different manufacturers need to use edge nodes to provide services to users, they only need to divide a certain resource space from the target electronic device, without deploying node equipment every time, and when the service changes, they only need to release the operating space. It can be used without causing the problem of node equipment being discarded, thereby alleviating the problem of resource waste in the process of using edge nodes to provide services to users.

应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本发申请中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本申请公开的技术方案所期望的结果,本文在此不进行限制。It should be understood that various forms of the process shown above may be used, with steps reordered, added or deleted. For example, each step described in the present application can be executed in parallel, sequentially, or in a different order. As long as the desired results of the technical solution disclosed in the present application can be achieved, there is no limitation here.

上述具体实施方式,并不构成对本申请保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本申请的精神和原则之内所作的修改、等同替换和改进等,均应包含在本申请保护范围之内。The above-mentioned specific embodiments do not constitute a limitation on the scope of protection of the present application. It will be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions are possible depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application shall be included in the protection scope of this application.

Claims (7)

1.一种资源分配方法,应用于第一电子设备,其特征在于,包括:1. A resource allocation method, applied to a first electronic device, characterized in that it includes: 在接收到作业任务的情况下,获取目标区域中多个第二电子设备的状态信息,其中,所述状态信息包括闲置资源空间和历史访问流量;When receiving a job task, obtain status information of multiple second electronic devices in the target area, where the status information includes idle resource space and historical access traffic; 基于所述状态信息,从所述多个第二电子设备中筛选出至少一个目标电子设备;Based on the status information, filter out at least one target electronic device from the plurality of second electronic devices; 从每个所述目标电子设备的闲置资源空间中选择固定大小的目标资源空间,并将所述选择的目标资源空间分配给所述作业任务;Select a target resource space of a fixed size from the idle resource space of each target electronic device, and allocate the selected target resource space to the job task; 所述闲置资源空间包括闲置存储资源空间和闲置宽带资源空间,所述基于所述状态信息,从所述多个第二电子设备中筛选出至少一个目标电子设备,包括:The idle resource space includes idle storage resource space and idle broadband resource space, and selecting at least one target electronic device from the plurality of second electronic devices based on the status information includes: 基于所述闲置存储资源空间、所述闲置宽带资源空间和热度值,分别计算每个所述第二电子设备的评分值,其中,所述热度值为基于所述历史访问流量计算得到的值;Calculate the score value of each second electronic device based on the idle storage resource space, the idle broadband resource space and the popularity value, wherein the popularity value is a value calculated based on the historical access traffic; 将所述多个第二电子设备中评分值较高的前N个第二电子设备分别确定为所述目标电子设备,其中,所述N为大于或者等于1的整数;Determine the top N second electronic devices with higher score values among the plurality of second electronic devices respectively as the target electronic devices, where N is an integer greater than or equal to 1; 所述基于所述闲置存储资源空间、所述闲置宽带资源空间和热度值,分别计算每个所述第二电子设备的评分值之前,所述方法还包括:Before separately calculating the score value of each second electronic device based on the idle storage resource space, the idle broadband resource space and the popularity value, the method further includes: 确定第一目标设备集H,其中,所述第一目标设备集H包括所述多个第二电子设备中历史访问流量较高的前M个第二电子设备的状态信息;Determine a first target device set H, where the first target device set H includes status information of the top M second electronic devices with higher historical access traffic among the plurality of second electronic devices; 获取所述多个第二电子设备中每个所述第二电子设备的位置信息;Obtain the location information of each second electronic device in the plurality of second electronic devices; 根据如下公式计算每个所述第二电子设备的所述热度值:The heat value of each second electronic device is calculated according to the following formula: 其中,所述Hote为目标第二电子设备的热度值,所述目标第二电子设备为所述多个第二电子设备中的任一第二电子设备,所述|Pe-Ph|为所述目标第二电子设备与所述第一目标设备集H中的任一第二电子设备之间的距离值。Wherein, the Hot e is the heat value of the target second electronic device, the target second electronic device is any second electronic device among the plurality of second electronic devices, and the |P e -P h | is the distance value between the target second electronic device and any second electronic device in the first target device set H. 2.根据权利要求1所述的方法,其特征在于,所述基于所述闲置存储资源空间、所述闲置宽带资源空间和热度值,分别计算每个所述第二电子设备的评分值,包括:2. The method according to claim 1, characterized in that, based on the idle storage resource space, the idle broadband resource space and the popularity value, respectively calculating the score value of each of the second electronic devices includes: : 根据如下公式计算每个所述第二电子设备的评分值:The score value of each second electronic device is calculated according to the following formula: 其中,所述S为所述评分值,所述λ为调整因子,所述为对所述热度值进行归一化处理之后得到的位于0至1之间的数值,所述/>为对所述闲置存储资源空间的大小进行归一化处理之后得到的位于0至1之间的数值,所述/>为对所述闲置宽带资源空间的大小进行归一化处理之后得到的位于0至1之间的数值。Wherein, the S is the score value, the λ is an adjustment factor, and the is a value between 0 and 1 obtained after normalizing the heat value, the/> is a value between 0 and 1 obtained after normalizing the size of the idle storage resource space, the/> It is a value between 0 and 1 obtained after normalizing the size of the idle broadband resource space. 3.根据权利要求1所述的方法,其特征在于,所述方法还包括:3. The method according to claim 1, characterized in that, the method further comprises: 确定第二目标电子设备,其中,所述第二目标电子设备为所述多个第二电子设备中,同步运行至少两个不同的作业任务的第二电子设备;Determine a second target electronic device, wherein the second target electronic device is a second electronic device among the plurality of second electronic devices that synchronously runs at least two different job tasks; 在所述至少两个不同的作业任务包括第一作业任务和第二作业任务的情况下,将第一目标资源空间中的固定大小的第一空间分配给所述第二作业任务;In the case where the at least two different job tasks include a first job task and a second job task, allocate a first space of a fixed size in the first target resource space to the second job task; 其中,所述第一作业任务为在第一预设时间段内目标资源空间的使用率均小于第一预设值的作业任务,所述第二作业任务为在所述第一预设时间段内目标资源空间的使用率均大于或者等于第一预设值,且所述第一预设时间段内所述目标资源空间的使用率持续增加的作业任务;所述第一目标资源空间为所述第一作业任务的作业空间,第二目标资源空间为所述第二作业任务的作业空间。Wherein, the first job task is a job task in which the usage rate of the target resource space is less than the first preset value in the first preset time period, and the second job task is a job task in which the usage rate of the target resource space is less than the first preset value in the first preset time period. The usage rate of the target resource space within the first preset time period is greater than or equal to the first preset value, and the usage rate of the target resource space continues to increase during the first preset time period; the first target resource space is the The second target resource space is the work space of the first work task, and the second target resource space is the work space of the second work task. 4.根据权利要求1所述的方法,其特征在于,所述方法还包括:4. The method according to claim 1, characterized in that, the method further comprises: 确定第三目标电子设备,其中,所述第三目标电子设备为所述多个第二电子设备中运行第三作业任务的第二电子设备,其中,所述第三作业任务为在第二预设时间段内目标资源空间的使用率均小于第二预设值的作业任务;Determine a third target electronic device, where the third target electronic device is a second electronic device running a third job task among the plurality of second electronic devices, where the third job task is a second predetermined Assume that the usage rate of the target resource space within the time period is less than the second preset value of the job task; 在距离所述第三目标电子设备预设距离的范围内确定第四目标电子设备,其中,所述第四目标电子设备为所述闲置资源空间的值大于第三预设值的第二电子设备;Determine a fourth target electronic device within a range of a preset distance from the third target electronic device, where the fourth target electronic device is a second electronic device with a value of the idle resource space greater than a third preset value. ; 在所述第四目标电子设备中选择固定大小的第四目标资源空间,并将所述第四目标资源空间分配给所述第三作业任务;Select a fourth target resource space of a fixed size in the fourth target electronic device, and allocate the fourth target resource space to the third job task; 将所述第三目标电子设备中的第三目标资源空间分配至所述第三目标电子设备的闲置资源空间,其中,所述第三目标资源空间为所述第三作业任务的作业空间,所述第三目标电子设备的评分值高于所述第四目标电子设备的评分值。Allocate the third target resource space in the third target electronic device to the idle resource space of the third target electronic device, wherein the third target resource space is the work space of the third job task, so The score value of the third target electronic device is higher than the score value of the fourth target electronic device. 5.一种资源分配装置,其特征在于,包括:5. A resource allocation device, characterized in that it includes: 第一获取模块,用于在接收到作业任务的情况下,获取目标区域中多个第二电子设备的状态信息,其中,所述状态信息包括闲置资源空间和历史访问流量;A first acquisition module, configured to acquire status information of a plurality of second electronic devices in the target area when receiving a job task, where the status information includes idle resource space and historical access traffic; 筛选模块,用于基于所述状态信息,从所述多个第二电子设备中筛选出至少一个目标电子设备;A screening module, configured to screen out at least one target electronic device from the plurality of second electronic devices based on the status information; 分配模块,用于从每个所述目标电子设备的闲置资源空间中选择固定大小的目标资源空间,并将所述选择的目标资源空间分配给所述作业任务;An allocation module, configured to select a target resource space of a fixed size from the idle resource space of each target electronic device, and allocate the selected target resource space to the job task; 所述闲置资源空间包括闲置存储资源空间和闲置宽带资源空间,所述筛选模块包括:The idle resource space includes idle storage resource space and idle broadband resource space, and the screening module includes: 计算子模块,用于基于所述闲置存储资源空间、所述闲置宽带资源空间和热度值,分别计算每个所述第二电子设备的评分值,其中,所述热度值为基于所述历史访问流量计算得到的值;Calculation sub-module, configured to calculate the score value of each second electronic device based on the idle storage resource space, the idle broadband resource space and a popularity value, wherein the popularity value is based on the historical access The value obtained by flow calculation; 确定子模块,用于将所述多个第二电子设备中评分值较高的前N个第二电子设备分别确定为所述目标电子设备,其中,所述N为大于或者等于1的整数;Determining sub-module, configured to determine the top N second electronic devices with higher score values among the plurality of second electronic devices as the target electronic devices, respectively, where the N is an integer greater than or equal to 1; 所述装置还包括:The device also includes: 第一确定模块,用于确定第一目标设备集H,其中,所述第一目标设备集H包括所述多个第二电子设备中历史访问流量较高的前M个第二电子设备的状态信息;A first determination module, configured to determine a first target device set H, where the first target device set H includes the status of the top M second electronic devices with higher historical access traffic among the plurality of second electronic devices. information; 第二获取模块,用于获取所述多个第二电子设备中每个所述第二电子设备的位置信息;a second acquisition module, configured to acquire the location information of each second electronic device in the plurality of second electronic devices; 计算模块,用于根据如下公式计算每个所述第二电子设备的所述热度值:A calculation module, configured to calculate the heat value of each second electronic device according to the following formula: 其中,所述Hote为目标第二电子设备的热度值,所述目标第二电子设备为所述多个第二电子设备中的任一第二电子设备,所述|Pe-Ph|为所述目标第二电子设备与所述第一目标设备集H中的任一第二电子设备之间的距离值。Wherein, the Hot e is the heat value of the target second electronic device, the target second electronic device is any second electronic device among the plurality of second electronic devices, and the |P e -P h | is the distance value between the target second electronic device and any second electronic device in the first target device set H. 6.一种电子设备,其特征在于,包括:6. An electronic device, characterized in that it includes: 至少一个处理器;以及at least one processor; and 与所述至少一个处理器通信连接的存储器;其中,a memory communicatively connected to the at least one processor; wherein, 所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求1-4中任一项所述的方法。The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can perform any one of claims 1-4. Methods. 7.一种存储有计算机指令的非瞬时计算机可读存储介质,其特征在于,所述计算机指令用于使所述计算机执行权利要求1-4中任一项所述的方法。7. A non-transitory computer-readable storage medium storing computer instructions, characterized in that the computer instructions are used to cause the computer to execute the method according to any one of claims 1-4.
CN202010640962.9A 2020-07-06 2020-07-06 Resource allocation method and device and electronic equipment Active CN111796940B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010640962.9A CN111796940B (en) 2020-07-06 2020-07-06 Resource allocation method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010640962.9A CN111796940B (en) 2020-07-06 2020-07-06 Resource allocation method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN111796940A CN111796940A (en) 2020-10-20
CN111796940B true CN111796940B (en) 2024-01-26

Family

ID=72811317

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010640962.9A Active CN111796940B (en) 2020-07-06 2020-07-06 Resource allocation method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN111796940B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112506619B (en) * 2020-12-18 2023-08-04 北京百度网讯科技有限公司 Job processing method, job processing device, electronic equipment and storage medium
CN112491740B (en) * 2020-12-18 2024-02-20 中国卫通集团股份有限公司 Resource allocation method and device for satellite transponder
CN112732440B (en) * 2021-01-07 2024-12-13 中国铁塔股份有限公司 Resource allocation method, device, cloud platform server and edge node device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105850099A (en) * 2013-10-23 2016-08-10 英派尔科技开发有限公司 Local management for intermediary graphics rendition
CN106959983A (en) * 2016-01-08 2017-07-18 深圳市星电商科技有限公司 The method and apparatus of resource-sharing
WO2017133351A1 (en) * 2016-02-05 2017-08-10 华为技术有限公司 Resource allocation method and resource manager
WO2018121549A1 (en) * 2016-12-26 2018-07-05 腾讯科技(深圳)有限公司 Information analysis method, electronic device and storage medium
KR20190051878A (en) * 2017-11-07 2019-05-15 고려대학교 산학협력단 System of utilizing of idle computing resource, computing apparatus and method of the same

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105850099A (en) * 2013-10-23 2016-08-10 英派尔科技开发有限公司 Local management for intermediary graphics rendition
CN106959983A (en) * 2016-01-08 2017-07-18 深圳市星电商科技有限公司 The method and apparatus of resource-sharing
WO2017133351A1 (en) * 2016-02-05 2017-08-10 华为技术有限公司 Resource allocation method and resource manager
WO2018121549A1 (en) * 2016-12-26 2018-07-05 腾讯科技(深圳)有限公司 Information analysis method, electronic device and storage medium
KR20190051878A (en) * 2017-11-07 2019-05-15 고려대학교 산학협력단 System of utilizing of idle computing resource, computing apparatus and method of the same

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
边缘计算迁移研究综述;朱友康;乐光学;杨晓慧;刘建生;;电信科学(第04期);全文 *

Also Published As

Publication number Publication date
CN111796940A (en) 2020-10-20

Similar Documents

Publication Publication Date Title
CN111694646B (en) Resource scheduling method, device, electronic equipment and computer readable storage medium
CN111240836A (en) Computing resource management method and device, electronic equipment and storage medium
CN111796940B (en) Resource allocation method and device and electronic equipment
US9373096B2 (en) Smart cloud workload balancer
CN111880914A (en) Resource scheduling method, resource scheduling apparatus, electronic device, and storage medium
CN114756347B (en) Cluster-based server resource scheduling method and device, cloud platform and medium
CN104243405A (en) Request processing method, device and system
CN106663036A (en) Processing changes in multi-tenant system
CN111158909B (en) Cluster resource allocation processing method, device, equipment and storage medium
JP2017531844A (en) Dynamic update stream for real-time provisioning
CN105144102A (en) Adaptive data synchronization
CN114064284A (en) Cloud server resource configuration method, device, electronic device and medium
CN113722079B (en) Task scheduling distribution method, device, equipment and medium based on target application
EP4109261A2 (en) Access processing method, device, storage medium and program product
CN111459645A (en) Task scheduling method and device and electronic equipment
CN117492977A (en) Resource scheduling method, device, electronic equipment and storage medium
CN117472471A (en) Application program configuration method, device, equipment and storage medium
CN114327918B (en) Method and device for adjusting resource amount, electronic equipment and storage medium
CN111176838B (en) Method and device for distributing embedded vector to node in bipartite graph
US20240411609A1 (en) Vertical scaling of compute containers
CN107797766A (en) A kind of method and apparatus for creating volume
CN111901254B (en) Bandwidth allocation method and device for all nodes, electronic equipment and storage medium
CN116450901A (en) Resource recommendation method and device, electronic equipment and storage medium
CN112416593B (en) Resource management method and device, electronic equipment and computer readable medium
CN116302540A (en) Resource management method, device, electronic equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: Room 101, floors 1-3, building 14, North District, yard 9, dongran North Street, Haidian District, Beijing 100029

Applicant after: CHINA TOWER Co.,Ltd.

Address before: 100142 19th floor, 73 Fucheng Road, Haidian District, Beijing

Applicant before: CHINA TOWER Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20250324

Address after: 101, Floors 1-3, Building 14, North Campus, No. 9 Dongran North Street, Haidian District, Beijing 100089

Patentee after: CHINA TOWER Co.,Ltd.

Country or region after: China

Patentee after: Tower Zhilian Technology Co.,Ltd.

Address before: 100195 101, floors 1 to 3, building 14, North District, yard 9, dongran North Street, Haidian District, Beijing

Patentee before: CHINA TOWER Co.,Ltd.

Country or region before: China

TR01 Transfer of patent right
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载