技术领域technical field
本发明涉及计算机应用技术领域,特别是涉及一种服务器资源分发方法及装置。The present invention relates to the field of computer application technology, in particular to a server resource distribution method and device.
背景技术Background technique
服务器资源,是具有时效性的某项资源,如果在设定时间段内没有分发出去,则将形成资源的浪费。Server resources are time-sensitive resources. If they are not distributed within a set period of time, resources will be wasted.
在现有技术中,所有服务器资源均放置于服务器节点中,当资源申请开始后,所有用户的资源申请将在同一时间段内集中达到服务器节点,由服务器节点处理所有并发的资源申请,再将处理结果分别分发给发出申请的用户,如图1所示。In the existing technology, all server resources are placed in the server node. When the resource application starts, the resource applications of all users will reach the server node in the same period of time, and the server node will process all concurrent resource applications. The processing results are distributed to the users who issued the application respectively, as shown in Figure 1.
这样将导致服务器节点在短时间内负载压力过重。在这种情况下服务器节点的处理能力、网络通信等都极有可能达到瓶颈,导致服务器节点宕机无法正常处理用户的资源申请。This will cause the server node to be overloaded in a short period of time. In this case, the processing capability and network communication of the server node are likely to reach a bottleneck, causing the server node to be down and unable to process the user's resource application normally.
发明内容Contents of the invention
为解决上述技术问题,本发明提供一种服务器资源分发方法及装置。In order to solve the above technical problems, the present invention provides a server resource distribution method and device.
一种服务器资源分发方法,应用于服务器节点,所述服务器节点与多个前置机节点通信连接,每个所述前置机节点对应于不同的用户集,所述前置机节点的数量和所述用户集的数量相同,且一一对应;所述方法包括:A method for distributing server resources, applied to a server node, where the server node is communicatively connected to a plurality of front-end nodes, each of the front-end nodes corresponds to a different user set, the number of the front-end nodes and The number of the user sets is the same, and one-to-one correspondence; the method includes:
确定待分发的服务器资源;Determine the server resources to be distributed;
根据预先确定的每个所述前置机节点的第一权重,将所述待分发的服务器资源预分发给每个所述前置机节点,以使每个所述前置机节点响应其对应用户集中用户的资源申请。According to the predetermined first weight of each front-end node, pre-distribute the server resources to be distributed to each front-end node, so that each front-end node responds to its corresponding The user centralizes the user's resource application.
在本发明的一种具体实施方式中,所述方法还包括:In a specific embodiment of the present invention, the method also includes:
在达到设定的再分发时限时,回收每个所述前置机节点的剩余服务器资源;Reclaiming the remaining server resources of each front-end node when the set redistribution time limit is reached;
确定每个所述前置机节点的第二权重;determining a second weight for each of the front-end nodes;
根据每个所述前置机节点的第二权重,将回收到的剩余服务器资源再分发给每个所述前置机节点。According to the second weight of each front-end node, redistribute the recovered remaining server resources to each front-end node.
在本发明的一种具体实施方式中,所述确定每个所述前置机节点的第二权重,包括:In a specific implementation manner of the present invention, the determining the second weight of each front-end node includes:
针对每个所述前置机节点,获得该前置机节点返回的用户申请意向信息,所述用户申请意向信息中携带资源申请数,其中,所述用户申请意向信息为预分发给该前置机节点的服务器资源被用户申请完成后,该前置机节点根据接收到的未处理的资源申请生成的信息;For each front-end node, obtain user application intention information returned by the front-end node, the user application intention information carries the number of resource applications, wherein the user application intention information is pre-distributed to the front-end After the server resource of the host node is applied for by the user, the information generated by the front-end node according to the received unprocessed resource application;
根据该前置机节点的资源申请数,确定该前置机节点的第二权重。The second weight of the front-end node is determined according to the number of resource applications of the front-end node.
在本发明的一种具体实施方式中,通过以下步骤预先确定每个所述前置机节点的第一权重:In a specific implementation manner of the present invention, the first weight of each said front-end processor node is predetermined through the following steps:
获得针对多次分发的历史分发数据;Obtain historical distribution data for multiple distributions;
在所述历史分发数据中提取每个所述前置机节点的多个历史权重;Extracting a plurality of historical weights of each front-end node from the historical distribution data;
针对每个所述前置机节点,根据该前置机节点的多个历史权重,确定该前置机节点的第一权重。For each front-end node, the first weight of the front-end node is determined according to multiple historical weights of the front-end node.
在本发明的一种具体实施方式中,每次分发的历史权重为:根据该次分发过程中,每个所述前置机节点实际分发给用户的资源数确定的。In a specific implementation manner of the present invention, the historical weight of each distribution is determined according to the number of resources actually distributed to users by each front-end node in the distribution process.
一种服务器资源分发装置,应用于服务器节点,所述服务器节点与多个前置机节点通信连接,每个所述前置机节点对应于不同的用户集,所述前置机节点的数量和所述用户集的数量相同,且一一对应;所述装置包括:A server resource distribution device, applied to a server node, the server node is communicatively connected to a plurality of front-end nodes, each of the front-end nodes corresponds to a different user set, the number of the front-end nodes and The number of the user sets is the same, and one-to-one correspondence; the device includes:
服务器资源确定模块,用于确定待分发的服务器资源;A server resource determining module, configured to determine server resources to be distributed;
资源预分发模块,用于根据预先确定的每个所述前置机节点的第一权重,将所述待分发的服务器资源预分发给每个所述前置机节点,以使每个所述前置机节点响应其对应用户集中用户的资源申请。A resource pre-distribution module, configured to pre-distribute the server resources to be distributed to each of the front-end nodes according to the predetermined first weight of each of the front-end nodes, so that each of the The front-end node responds to the resource application of the users in the corresponding user set.
在本发明的一种具体实施方式中,所述装置还包括:In a specific embodiment of the present invention, the device also includes:
资源回收模块,用于在达到设定的再分发时限时,回收每个所述前置机节点的剩余服务器资源;A resource recycling module, configured to reclaim the remaining server resources of each front-end node when the set redistribution time limit is reached;
第二权重确定模块,用于确定每个所述前置机节点的第二权重;A second weight determination module, configured to determine the second weight of each of the front-end processor nodes;
资源再分发模块,用于根据每个所述前置机节点的第二权重,将回收到的剩余服务器资源再分发给每个所述前置机节点。A resource redistribution module, configured to redistribute the recovered remaining server resources to each of the front-end nodes according to the second weight of each of the front-end nodes.
在本发明的一种具体实施方式中,所述第二权重确定模块,具体用于:In a specific implementation manner of the present invention, the second weight determination module is specifically used for:
针对每个所述前置机节点,获得该前置机节点返回的用户申请意向信息,所述用户申请意向信息中携带资源申请数,其中,所述用户申请意向信息为预分发给该前置机节点的服务器资源被用户申请完成后,该前置机节点根据接收到的未处理的资源申请生成的信息;For each front-end node, obtain user application intention information returned by the front-end node, the user application intention information carries the number of resource applications, wherein the user application intention information is pre-distributed to the front-end After the server resource of the host node is applied for by the user, the information generated by the front-end node according to the received unprocessed resource application;
根据该前置机节点的资源申请数,确定该前置机节点的第二权重。The second weight of the front-end node is determined according to the number of resource applications of the front-end node.
在本发明的一种具体实施方式中,所述装置还包括第一权重确定模块,用于通过以下步骤预先确定每个所述前置机节点的第一权重:In a specific implementation manner of the present invention, the device further includes a first weight determination module, configured to predetermine the first weight of each front-end node through the following steps:
获得针对多次分发的历史分发数据;Obtain historical distribution data for multiple distributions;
在所述历史分发数据中提取每个所述前置机节点的多个历史权重;Extracting a plurality of historical weights of each front-end node from the historical distribution data;
针对每个所述前置机节点,根据该前置机节点的多个历史权重,确定该前置机节点的第一权重。For each front-end node, the first weight of the front-end node is determined according to multiple historical weights of the front-end node.
在本发明的一种具体实施方式中,每次分发的历史权重为:根据该次分发过程中,每个所述前置机节点实际分发给用户的资源数确定的。In a specific implementation manner of the present invention, the historical weight of each distribution is determined according to the number of resources actually distributed to users by each front-end node in the distribution process.
应用本发明实施例所提供的技术方案,服务器节点与多个前置机节点通信连接,服务器节点确定待分发的服务器资源之后,根据预先确定的每个前置机节点的第一权重,将待分发的服务器资源预分发给每个前置机节点,这样,每个前置机节点可以响应其对应用户集中用户的资源申请,有效地将服务器节点的负载压力分散到了各个前置机节点,且根据每个前置机节点的第一权重,预分发服务器资源,具有较高的公平性、合理性。Applying the technical solution provided by the embodiment of the present invention, the server node communicates with multiple front-end nodes. After the server node determines the server resources to be distributed, according to the predetermined first weight of each front-end node, the The distributed server resources are pre-distributed to each front-end processor node, so that each front-end processor node can respond to the resource application of its corresponding user centralized user, effectively distributing the load pressure of the server node to each front-end processor node, and According to the first weight of each front-end node, server resources are pre-distributed, which has high fairness and rationality.
附图说明Description of drawings
为了更清楚的说明本发明实施例或现有技术的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单的介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the prior art, the following will briefly introduce the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only For some embodiments of the present invention, those skilled in the art can also obtain other drawings based on these drawings without creative work.
图1为现有技术中资源申请系统的结构示意图;FIG. 1 is a schematic structural diagram of a resource application system in the prior art;
图2为本发明实施例中资源申请系统的结构示意图;FIG. 2 is a schematic structural diagram of a resource application system in an embodiment of the present invention;
图3为本发明实施例中服务器资源分发方法的一种实施流程图;FIG. 3 is an implementation flowchart of a method for distributing server resources in an embodiment of the present invention;
图4为本发明实施例中服务器资源分发方法的另一种实施流程图;Fig. 4 is another implementation flowchart of the server resource distribution method in the embodiment of the present invention;
图5为本发明实施例中服务器资源分发装置的一种结构示意图;FIG. 5 is a schematic structural diagram of a server resource distribution device in an embodiment of the present invention;
图6为本发明实施例中服务器资源分发装置的另一种结构示意图。FIG. 6 is another schematic structural diagram of a server resource distribution device in an embodiment of the present invention.
具体实施方式Detailed ways
本发明的核心是提供一种服务器资源分发方法,该方法应用于服务器节点。如图2所示,该服务器节点与多个前置机节点通信连接,每个前置机节点对应于不同的用户集,前置机节点的数量和用户集的数量相同,且一一对应。The core of the present invention is to provide a server resource distribution method, which is applied to server nodes. As shown in Fig. 2, the server node communicates with multiple front-end nodes, and each front-end node corresponds to a different user set, and the number of front-end nodes is the same as the number of user sets, and there is a one-to-one correspondence.
在实际应用中,可以根据预设的规则,将用户划分到不同的用户集中,对应于每一个用户集,均配置一个前置机节点。比如,按照用户所处的地理位置划分,将服务器节点对应的区域A划分为子区域A1和子区域A2,在子区域A1中配置前置机节点A1、在子区域A2中配置前置机节点A2。每个子区域分别为一个用户集,子区域A1中用户均向前置机节点A1申请相应的服务器资源,子区域A2中用户均向前置机节点A2申请相应的服务器资源。In practical applications, users can be divided into different user sets according to preset rules, and a front-end processor node is configured corresponding to each user set. For example, according to the geographical location of the user, the area A corresponding to the server node is divided into sub-area A1 and sub-area A2, the front-end node A1 is configured in the sub-area A1, and the front-end node A2 is configured in the sub-area A2 . Each sub-area is a user set. Users in sub-area A1 apply for corresponding server resources from front-end node A1, and users in sub-area A2 apply for corresponding server resources from front-end node A2.
在本发明实施例中,服务器节点将待分发的服务器资源预分发给每个前置机节点,每个前置机节点响应其对应的用户集中用户的资源申请。In the embodiment of the present invention, the server node pre-distributes the server resources to be distributed to each front-end processor node, and each front-end processor node responds to the resource application of its corresponding centralized user.
这样,可以在有大量集中并发的资源申请时,有效缓解服务器节点的压力,提高整个系统的可用性。In this way, when there are a large number of centralized and concurrent resource applications, the pressure on the server nodes can be effectively relieved and the availability of the entire system can be improved.
为了使本技术领域的人员更好地理解本发明方案,下面结合附图和具体实施方式对本发明作进一步的详细说明。显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to enable those skilled in the art to better understand the solution of the present invention, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. Apparently, the described embodiments are only some of the embodiments of the present invention, but not all of them. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
参见图3所示,为本发明实施例所提供的一种服务器资源分发方法的实施流程图,该方法可以包括以下步骤:Referring to FIG. 3 , it is an implementation flowchart of a method for distributing server resources provided by an embodiment of the present invention. The method may include the following steps:
S110:确定待分发的服务器资源。S110: Determine server resources to be distributed.
在本发明实施例中,服务器节点要对服务器资源进行预分发时,可以先确定待分发的服务器资源。In the embodiment of the present invention, when the server node wants to pre-distribute server resources, it may first determine the server resources to be distributed.
在实际应用中,服务器节点可以将当前所有的服务器资源均作为待分发的服务器资源,还可以按照设定比例预留一部分服务器资源,将除预留的服务器资源外的其他服务器资源确定为待分发的服务器资源。预留的服务器资源可以在设定时间段内使用,如在再分发时使用,或者预留给预先设定的前置机节点。In practical applications, the server node can use all the current server resources as the server resources to be distributed, and can also reserve a part of the server resources according to the set ratio, and determine other server resources except the reserved server resources as the server resources to be distributed. server resources. The reserved server resources can be used within a set period of time, such as used during redistribution, or reserved for pre-set front-end nodes.
服务器节点确定待分发的服务器资源之后,可以继续执行步骤S120的操作。After the server node determines the server resources to be distributed, the operation of step S120 may be continued.
S120:根据预先确定的每个前置机节点的第一权重,将待分发的服务器资源预分发给每个前置机节点,以使每个前置机节点响应其对应用户集中用户的资源申请。S120: According to the predetermined first weight of each front-end node, pre-distribute the server resources to be distributed to each front-end node, so that each front-end node responds to the resource application of the user in the corresponding user set .
在本发明实施例中,在预分发服务器资源之初,服务器节点可以预先确定每个前置机节点的第一权重。根据每个前置机节点的第一权重,服务器节点可以将待分发的服务器资源预分发给每个前置机节点,这样,每个前置机节点都拥有了相应数量的服务器资源,可以响应其对应用户集中用户的资源申请。In this embodiment of the present invention, at the beginning of pre-distributing server resources, the server node may pre-determine the first weight of each front-end node. According to the first weight of each front-end processor node, the server node can pre-distribute the server resources to be distributed to each front-end processor node, so that each front-end processor node has a corresponding number of server resources and can respond It corresponds to the resource application of the user in the user pool.
在实际应用中,服务器节点可以为每个前置机节点设置相同的第一权重,为每个前置机节点预分发相同数量的服务器资源。In practical applications, the server node may set the same first weight for each front-end node, and pre-distribute the same amount of server resources for each front-end node.
或者,服务器节点可以根据每个前置机节点对应的用户比例,确定每个前置机节点的第一权重。Alternatively, the server node may determine the first weight of each front-end node according to the proportion of users corresponding to each front-end node.
在本发明的一种具体实施方式中,可以通过以下步骤预先确定每个前置机节点的第一权重:In a specific implementation manner of the present invention, the first weight of each front-end processor node may be pre-determined through the following steps:
步骤一:获得历史分发数据;Step 1: Obtain historical distribution data;
步骤二:在历史分发数据中提取每个前置机节点的多个历史权重;Step 2: Extract multiple historical weights of each front-end node from the historical distribution data;
步骤三:针对每个前置机节点,根据该前置机节点的多个历史权重,确定该前置机节点的第一权重。Step 3: For each front-end node, determine the first weight of the front-end node according to multiple historical weights of the front-end node.
为便于描述,将上述三个步骤结合起来进行说明。For ease of description, the above three steps are combined for description.
在服务器节点要进行服务器资源的预分发时,可以先获得历史分发数据。历史分发数据为服务器节点在其他时间段进行服务器资源分发时的相关数据,历史分发数据中包含有每次分发所对应的每个前置机节点的历史权重。When the server node is going to pre-distribute server resources, historical distribution data can be obtained first. The historical distribution data is related data when the server node distributes server resources in other time periods, and the historical distribution data includes the historical weight of each front-end processor node corresponding to each distribution.
服务器节点可以在历史分发数据中提取每个前置机节点的多个历史权重。The server node can extract multiple historical weights of each front-end processor node from the historical distribution data.
例如,服务器节点对应两个前置机节点,前置机节点1和前置机节点2,服务器节点在历史分发数据中提取到的每个前置机节点的多个历史权重如表1所示:For example, the server node corresponds to two front-end nodes, front-end node 1 and front-end node 2, and the multiple historical weights of each front-end node extracted by the server node from the historical distribution data are shown in Table 1 :
表1Table 1
针对每个前置机节点,根据该前置机节点的多个历史权重,可以确定该前置机节点的第一权重。For each front-end node, the first weight of the front-end node may be determined according to multiple historical weights of the front-end node.
具体的,可以通过以下几种方法确定每个前置节点的第一权重:Specifically, the first weight of each preceding node can be determined by the following methods:
第一种方法:均值法,即针对每个前置机节点,将该前置机节点的多个历史权重取平均,将得到的平均值确定为该前置机节点的第一权重。The first method: the average value method, that is, for each front-end node, multiple historical weights of the front-end node are averaged, and the obtained average value is determined as the first weight of the front-end node.
比如:根据表1中的历史权重,确定的前置机节点1的第一权重为:(50+45+20+45)/4=40,确定的前置机节点2的第一权重为:(50+55+80+55)/4=60。For example: according to the historical weights in Table 1, the determined first weight of the front-end node 1 is: (50+45+20+45)/4=40, and the determined first weight of the front-end node 2 is: (50+55+80+55)/4=60.
第二种方法:最近法,即按照最新数据能体现数据最新特征的原则,将上一次所设置的权重作为当前第一权重。The second method: the nearest method, that is, according to the principle that the latest data can reflect the latest characteristics of the data, the weight set last time is used as the current first weight.
以表1所示历史权重为例,可以将2015年前置机节点1的权重45确定为当前前置机节点1的第一权重,将2015年前置机节点2的权重55确定为当前前置机节点2的第二权重。Taking the historical weights shown in Table 1 as an example, the weight 45 of the front-end node 1 in 2015 can be determined as the first weight of the current front-end node 1, and the weight 55 of the front-end node 2 in 2015 can be determined as the current front-end weight. Set the second weight of machine node 2.
第三种方法:剔除法,即对历史权重进行分析,剔除异常数据后再求平均。The third method: the elimination method, that is, to analyze the historical weight, remove the abnormal data and then calculate the average.
以表1所示历史权重为例,2014年数据明显异于其他年份数据,可以将该年份数据剔除,以免影响对历史权重的正常分析。对剔除异常历史权重后的历史权重求平均,获得每个前置机节点的第一权重,即:Taking the historical weight shown in Table 1 as an example, the data of 2014 is obviously different from the data of other years, so the data of this year can be excluded to avoid affecting the normal analysis of historical weight. Average the historical weights after removing abnormal historical weights to obtain the first weight of each front-end node, namely:
((50+45+45)/3):((50+55+55)/3)≈47:53,即前置机节点1的第一权重为47,前置机节点2的第一权重为53。((50+45+45)/3): ((50+55+55)/3)≈47:53, that is, the first weight of front-end node 1 is 47, and the first weight of front-end node 2 is 53.
第四种方法:修正法,即对异常数据进行修正,将修正后的数据求平均。The fourth method: the correction method, that is, to correct the abnormal data and average the corrected data.
仍以表1为例,可以按照前置机节点对应的用户比例修正2014年数据,该年份修正后的权重分别为:50、50,再将多个历史权重求平均,获得每个前置机节点的第一权重,即:Still taking Table 1 as an example, the 2014 data can be corrected according to the proportion of users corresponding to the front-end node. The corrected weights for this year are: 50, 50, and then average the multiple historical weights to obtain each front-end The first weight of the node, namely:
((50+45+50+45)/4):((50+55+50+55)/4)=48:52,即前置机节点1的第一权重为48,前置机节点2的第一权重为52。((50+45+50+45)/4): ((50+55+50+55)/4)=48:52, that is, the first weight of front-end node 1 is 48, and front-end node 2 The first weight of 52.
应用本发明实施例所提供的方法,服务器节点与多个前置机节点通信连接,服务器节点确定待分发的服务器资源之后,根据预先确定的每个前置机节点的第一权重,将待分发的服务器资源预分发给每个前置机节点,这样,每个前置机节点可以响应其对应用户集中用户的资源申请,有效地将服务器节点的负载压力分散到了各个前置机节点,且根据每个前置机节点的第一权重,预分发服务器资源,具有较高的公平性、合理性。Applying the method provided by the embodiment of the present invention, the server node communicates with multiple front-end nodes. After the server node determines the server resources to be distributed, according to the predetermined first weight of each front-end node, the server resources to be distributed Server resources are pre-distributed to each front-end processor node, so that each front-end processor node can respond to the resource application of its corresponding user centralized user, effectively distributing the load pressure of the server node to each front-end processor node, and according to The first weight of each front-end node is to pre-distribute server resources, which has high fairness and rationality.
参见图4所示,在本发明的一个实施例中,服务器节点将服务器资源预分发给每个前置机节点之后,该方法还可以包括以下步骤:Referring to Fig. 4, in one embodiment of the present invention, after the server node pre-distributes server resources to each front-end node, the method may further include the following steps:
S130:在达到设定的再分发时限时,回收每个前置机节点的剩余服务器资源。S130: When the set redistribution time limit is reached, reclaim the remaining server resources of each front-end node.
在本发明实施例中,服务器节点将服务器资源预分发给每个前置机节点之后,由每个前置机节点响应其对应用户集中用户的资源申请。在达到设定的再分发时限时,如果某个或某几个前置机节点还有剩余服务器资源,即没有被其对应的用户集中用户申请完,则服务器节点可以回收相应前置机节点的剩余服务器资源。In the embodiment of the present invention, after the server node pre-distributes the server resources to each front-end processor node, each front-end processor node responds to the resource application of the user in the corresponding user concentration. When the set redistribution time limit is reached, if one or several front-end nodes still have remaining server resources, that is, they have not been applied for by the corresponding user centralized user, the server node can recycle the resources of the corresponding front-end node remaining server resources.
S140:确定每个前置机节点的第二权重。S140: Determine the second weight of each front-end processor node.
每个前置机节点的第二权重与该前置机节点的第一权重可以相同,还可以不同。The second weight of each front-end node may be the same as or different from the first weight of the front-end node.
在本发明的一种具体实施方式中,步骤S140可以包括以下步骤:In a specific implementation manner of the present invention, step S140 may include the following steps:
第一个步骤:针对每个前置机节点,获得该前置机节点返回的用户申请意向信息,用户申请意向信息中携带资源申请数,其中,用户申请意向信息为预分发给该前置机节点的服务器资源被用户申请完成后,该前置机节点根据接收到的未处理的资源申请生成的信息;The first step: For each front-end processor node, obtain the user application intention information returned by the front-end processor node. The user application intention information carries the number of resource applications. Among them, the user application intention information is pre-distributed to the front-end processor After the server resources of the node are applied for by the user, the information generated by the front-end node according to the received unprocessed resource application;
第二个步骤:根据该前置机节点的资源申请数,确定该前置机节点的第二权重。Step 2: Determine the second weight of the front-end node according to the number of resource applications of the front-end node.
为便于描述,将上述两个步骤结合起来进行说明。For ease of description, the above two steps are combined for description.
在再分发时限到达前,针对每个前置机节点,如果预分发给该前置机节点的服务器资源已被相应用户集的用户申请完,但该用户集中还有用户向该前置机节点发送了资源申请,则该前置机节点可以根据接收到的未处理的资源申请生成用户申请意向信息,以便在再分发时限到达时进行服务器资源的再分发。Before the redistribution time limit expires, for each front-end node, if the server resources pre-distributed to the front-end node have been applied by the users of the corresponding user set, but there are still users in the user set After the resource application is sent, the front-end node can generate user application intention information according to the received unprocessed resource application, so as to redistribute server resources when the redistribution time limit is reached.
在本发明实施例中,用户申请意向信息可以记录如表2所示内容:In the embodiment of the present invention, the user's application intention information can be recorded as shown in Table 2:
表2Table 2
其中,意向头Header用于标记意向开始;意向内容表明意向具体信息,如资源申请数、种类等;用户信息和前置机节点信息表明申请所属的前置机节点及具体用户,便于消息回传。Among them, the intention header Header is used to mark the beginning of the intention; the content of the intention indicates the specific information of the intention, such as the number and type of resource applications; the user information and the front-end node information indicate the front-end node and the specific user to which the application belongs, which is convenient for message return .
服务器节点根据该前置机节点的资源申请数,可以确定该前置机节点的第二权重。具体的,该第二权重可以为该前置节点的资源申请数与所有前置机节点总的资源申请数的比例。The server node may determine the second weight of the front-end node according to the number of resource applications of the front-end node. Specifically, the second weight may be a ratio of the number of resource applications of the front-end node to the total number of resource applications of all front-end nodes.
S150:根据每个前置机节点的第二权重,将回收到的剩余服务器资源再分发给每个前置机节点。S150: Redistribute the recovered remaining server resources to each front-end node according to the second weight of each front-end node.
根据每个前置机节点的第二权重,可以将回收到的剩余服务器资源再分发给每个前置机节点。这样,每个前置机节点可以继续响应其相应用户集中用户的资源申请,避免资源浪费。According to the second weight of each front-end node, the recovered remaining server resources may be redistributed to each front-end node. In this way, each front-end processor node can continue to respond to the resource applications of its corresponding user set users, avoiding waste of resources.
需要说明的是,针对某个前置节点而言,如果该前置机节点没有相应的用户申请意向,则可以将该前置机节点的第二权重设置为0,不为该前置节点再分发服务器资源。It should be noted that, for a front-end node, if the front-end node has no corresponding user application intention, the second weight of the front-end node can be set to 0, and no further Distribute server resources.
在实际应用中,服务器资源的再分发可以进行一次或多次,本发明实施例对此不做限制。In practical applications, the redistribution of server resources may be performed one or more times, which is not limited in this embodiment of the present invention.
至此,服务器节点的服务器资源经过预分发过程和再分发过程,分发到每个前置机节点上,一次服务器资源的分发包括预分发过程和再分发过程。在预分发过程中所设定的每个前置机节点的第一权重已经不能体现当前资源分发的实际情况,可以根据该次分发过程中,每个前置机节点实际分发给用户的资源数确定该次分发对应的每个前置机节点的最终权重。So far, the server resources of the server node are distributed to each front-end node through the pre-distribution process and the re-distribution process, and a server resource distribution includes the pre-distribution process and the re-distribution process. The first weight of each front-end node set in the pre-distribution process can no longer reflect the actual situation of the current resource distribution. According to the number of resources actually distributed to users by each front-end node during the distribution process Determine the final weight of each front-end processor node corresponding to this distribution.
即S1:S2:…:Si:…:Sn=p1:p2:…:pi:…:pn,其中,p1+p2+……+pn=100,Si为前置机节点i在预分发过程和再分发过程分发给用户的总资源数,pi为前置机节点i的最终权重。That is, S1:S2:...:Si:...:Sn=p1:p2:...:pi:...:pn, where p1+p2+...+pn=100, Si is the pre-distribution process and re-distribution process of front-end node i The total number of resources distributed to users during the distribution process, pi is the final weight of the front-end node i.
确定每次分发对应的每个前置机节点的最终权重,以作为后续分发时的第一权重历史权重,为确定第一权重做参考。Determine the final weight of each front-end processor node corresponding to each distribution, and use it as the first weight historical weight in the subsequent distribution, and use it as a reference for determining the first weight.
也就是说,每次分发的历史权重,可以是根据该次分发过程中,每个前置机节点实际分发给用户的资源数确定的。That is to say, the historical weight of each distribution may be determined according to the number of resources actually distributed to users by each front-end processor node in the distribution process.
相应于上面的方法实施例,本发明实施例还提供了一种服务器资源分发装置,该装置应用于服务器节点,服务器节点与多个前置机节点通信连接,每个前置机节点对应于不同的用户集,前置机节点的数量和用户集的数量相同,且一一对应。下文描述的一种服务器资源分发装置与上文描述的一种服务器资源分发方法可相互对应参照。Corresponding to the above method embodiment, the embodiment of the present invention also provides a server resource distribution device, the device is applied to a server node, and the server node communicates with multiple front-end nodes, and each front-end node corresponds to a different The number of user sets, the number of front-end nodes and the number of user sets are the same, and there is a one-to-one correspondence. An apparatus for distributing server resources described below and a method for distributing server resources described above may refer to each other correspondingly.
参见图5所示,该装置可以包括以下模块:Referring to Fig. 5, the device may include the following modules:
服务器资源确定模块210,用于确定待分发的服务器资源;A server resource determining module 210, configured to determine server resources to be distributed;
资源预分发模块220,用于根据预先确定的每个前置机节点的第一权重,将待分发的服务器资源预分发给每个前置机节点,以使每个前置机节点响应其对应用户集中用户的资源申请。The resource pre-distribution module 220 is configured to pre-distribute server resources to be distributed to each front-end node according to the predetermined first weight of each front-end node, so that each front-end node responds to its corresponding The user centralizes the user's resource application.
应用本发明实施例所提供的装置,服务器节点与多个前置机节点通信连接,服务器节点确定待分发的服务器资源之后,根据预先确定的每个前置机节点的第一权重,将待分发的服务器资源预分发给每个前置机节点,这样,每个前置机节点可以响应其对应用户集中用户的资源申请,有效地将服务器节点的负载压力分散到了各个前置机节点,且根据每个前置机节点的第一权重,预分发服务器资源,具有较高的公平性、合理性。Applying the device provided by the embodiment of the present invention, the server node communicates with multiple front-end nodes. After the server node determines the server resources to be distributed, according to the predetermined first weight of each front-end node, the server resources to be distributed Server resources are pre-distributed to each front-end processor node, so that each front-end processor node can respond to the resource application of its corresponding user centralized user, effectively distributing the load pressure of the server node to each front-end processor node, and according to The first weight of each front-end node is to pre-distribute server resources, which has high fairness and rationality.
参见图6所示,在本发明的一个实施例中,该装置还可以包括以下模块:Referring to Fig. 6, in one embodiment of the present invention, the device may also include the following modules:
资源回收模块230,用于在达到设定的再分发时限时,回收每个前置机节点的剩余服务器资源;A resource recycling module 230, configured to reclaim the remaining server resources of each front-end node when the set redistribution time limit is reached;
第二权重确定模块240,用于确定每个前置机节点的第二权重;The second weight determination module 240 is configured to determine the second weight of each front-end processor node;
资源再分发模块250,用于根据每个前置机节点的第二权重,将回收到的剩余服务器资源再分发给每个前置机节点。The resource redistribution module 250 is configured to redistribute the recovered remaining server resources to each front-end node according to the second weight of each front-end node.
在本发明的一种具体实施方式中,第二权重确定模块240,具体用于:In a specific implementation manner of the present invention, the second weight determination module 240 is specifically used for:
针对每个前置机节点,获得该前置机节点返回的用户申请意向信息,用户申请意向信息中携带资源申请数,其中,用户申请意向信息为预分发给该前置机节点的服务器资源被用户申请完成后,该前置机节点根据接收到的未处理的资源申请生成的信息;For each front-end processor node, the user application intention information returned by the front-end processor node is obtained, and the user application intention information carries the resource application number, wherein the user application intention information is that the server resources pre-distributed to the front-end processor node are After the user application is completed, the front-end node generates information based on the received unprocessed resource application;
根据该前置机节点的资源申请数,确定该前置机节点的第二权重。The second weight of the front-end node is determined according to the number of resource applications of the front-end node.
在本发明的一种具体实施方式中,该装置还包括第一权重确定模块,用于通过以下步骤预先确定每个前置机节点的第一权重:In a specific embodiment of the present invention, the device further includes a first weight determination module, configured to predetermine the first weight of each front-end processor node through the following steps:
获得针对多次分发的历史分发数据;Obtain historical distribution data for multiple distributions;
在历史分发数据中提取每个前置机节点的多个历史权重;Extract multiple historical weights of each front-end node from historical distribution data;
针对每个前置机节点,根据该前置机节点的多个历史权重,确定该前置机节点的第一权重。For each front-end node, the first weight of the front-end node is determined according to the multiple historical weights of the front-end node.
在本发明的一种具体实施方式中,每次分发的历史权重为:根据该次分发过程中,每个前置机节点实际分发给用户的资源数确定的。In a specific implementation of the present invention, the historical weight of each distribution is determined according to the number of resources actually distributed to users by each front-end processor node in the distribution process.
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same or similar parts of each embodiment can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and for the related part, please refer to the description of the method part.
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Professionals can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software or a combination of the two. In order to clearly illustrate the possible For interchangeability, in the above description, the composition and steps of each example have been generally described according to their functions. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present invention.
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the methods or algorithms described in connection with the embodiments disclosed herein may be directly implemented by hardware, software modules executed by a processor, or a combination of both. Software modules can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other Any other known storage medium.
以上对本发明所提供的一种服务器资源分发方法及装置进行了详细介绍。本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想。应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以对本发明进行若干改进和修饰,这些改进和修饰也落入本发明权利要求的保护范围内。The method and device for distributing server resources provided by the present invention have been introduced in detail above. In this paper, specific examples are used to illustrate the principle and implementation of the present invention, and the descriptions of the above embodiments are only used to help understand the method and core idea of the present invention. It should be pointed out that for those skilled in the art, without departing from the principle of the present invention, some improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610819480.3ACN106445683B (en) | 2016-09-12 | 2016-09-12 | A server resource distribution method and device |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610819480.3ACN106445683B (en) | 2016-09-12 | 2016-09-12 | A server resource distribution method and device |
| Publication Number | Publication Date |
|---|---|
| CN106445683A CN106445683A (en) | 2017-02-22 |
| CN106445683Btrue CN106445683B (en) | 2019-12-03 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201610819480.3AActiveCN106445683B (en) | 2016-09-12 | 2016-09-12 | A server resource distribution method and device |
| Country | Link |
|---|---|
| CN (1) | CN106445683B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109144726A (en)* | 2018-08-09 | 2019-01-04 | 深圳市瑞云科技有限公司 | A method of by group come scheduling node machine |
| CN112115202A (en)* | 2020-09-18 | 2020-12-22 | 北京人大金仓信息技术股份有限公司 | Task distribution method and device in cluster environment |
| CN114928604B (en)* | 2022-06-29 | 2023-06-16 | 建信金融科技有限责任公司 | File distribution method and device |
| CN116233964A (en)* | 2023-01-05 | 2023-06-06 | 西安万像电子科技有限公司 | Method, system, electronic device and storage medium for improving image transmission efficiency |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101441580A (en)* | 2008-12-09 | 2009-05-27 | 华北电网有限公司 | Distributed paralleling calculation platform system and calculation task allocating method thereof |
| CN101534244A (en)* | 2009-02-09 | 2009-09-16 | 华为技术有限公司 | Method, device and system for load distribution |
| CN103713956A (en)* | 2014-01-06 | 2014-04-09 | 山东大学 | Method for intelligent weighing load balance in cloud computing virtualized management environment |
| CN104702710A (en)* | 2013-12-09 | 2015-06-10 | 中国联合网络通信集团有限公司 | Port allocation method and device |
| CN105049225A (en)* | 2015-06-05 | 2015-11-11 | 江苏国电南自海吉科技有限公司 | Power system front-end processor system based on dynamic role weight |
| CN105516746A (en)* | 2014-10-14 | 2016-04-20 | 鸿富锦精密工业(深圳)有限公司 | Video pre-downloading system and method |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7676551B1 (en)* | 2003-06-25 | 2010-03-09 | Microsoft Corporation | Lookup partitioning storage system and method |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101441580A (en)* | 2008-12-09 | 2009-05-27 | 华北电网有限公司 | Distributed paralleling calculation platform system and calculation task allocating method thereof |
| CN101534244A (en)* | 2009-02-09 | 2009-09-16 | 华为技术有限公司 | Method, device and system for load distribution |
| CN104702710A (en)* | 2013-12-09 | 2015-06-10 | 中国联合网络通信集团有限公司 | Port allocation method and device |
| CN103713956A (en)* | 2014-01-06 | 2014-04-09 | 山东大学 | Method for intelligent weighing load balance in cloud computing virtualized management environment |
| CN105516746A (en)* | 2014-10-14 | 2016-04-20 | 鸿富锦精密工业(深圳)有限公司 | Video pre-downloading system and method |
| CN105049225A (en)* | 2015-06-05 | 2015-11-11 | 江苏国电南自海吉科技有限公司 | Power system front-end processor system based on dynamic role weight |
| Publication number | Publication date |
|---|---|
| CN106445683A (en) | 2017-02-22 |
| Publication | Publication Date | Title |
|---|---|---|
| CN106445683B (en) | A server resource distribution method and device | |
| CN108881448B (en) | API request processing method and device | |
| CN107124472A (en) | Load-balancing method and device, computer-readable recording medium | |
| CN104301404B (en) | A kind of method and device of the adjustment operation system resource based on virtual machine | |
| CN106453146B (en) | Method, system, device and readable storage medium for allocating private cloud computing resources | |
| CN114356558B (en) | Capacity reduction processing method and device based on cluster | |
| CN105450716B (en) | Dynamic service distribution method and system | |
| CN101588344A (en) | System and method for controlling same account login in network system | |
| WO2015127864A1 (en) | Method and apparatus for controlling media data to be placed at constant speed | |
| CN114048033B (en) | Load balancing method, device and computer equipment for batch tasks | |
| CN109710410B (en) | Method and device for allocating Internet information resources | |
| CN106936874B (en) | Physical source distributing method, apparatus and system | |
| CN105791447A (en) | A video service-oriented cloud resource scheduling method and device | |
| CN111881365A (en) | Content recommendation method and device | |
| CN108881043A (en) | Distribution method, device, equipment and the storage medium of portfolio in shared set meal | |
| CN112000477B (en) | Method, device, equipment and medium for load balancing in pod | |
| CN103309723A (en) | Virtual machine resource integration system and method | |
| CN109285015B (en) | Virtual resource allocation method and system | |
| CN114338811B (en) | Transaction flow limiting method, device, server, storage medium and product | |
| CN112685169A (en) | Load control method, device, server and readable storage medium | |
| CN112037019B (en) | Method and device for allocating self-service equipment of banking outlets | |
| CN105824919A (en) | Method and apparatus for dynamically regulating pricing on data inquiry operation | |
| CN108647801A (en) | Predict the method and device of account hot spot | |
| CN112199199A (en) | Server load balancing distribution method | |
| CN109246216B (en) | Access request processing method and device |
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| CB02 | Change of applicant information | Address after:100192 Beijing city Haidian District Qinghe small Camp Road No. 15 building 710 room research Applicant after:BEIJING CHINA POWER INFORMATION TECHNOLOGY Co.,Ltd. Applicant after:STATE GRID INFORMATION & TELECOMMUNICATION GROUP Co.,Ltd. Applicant after:STATE GRID CORPORATION OF CHINA Address before:100192 Beijing city Haidian District Qinghe small Camp Road No. 15 building 710 room research Applicant before:BEIJING CHINA POWER INFORMATION TECHNOLOGY Co.,Ltd. Applicant before:STATE GRID INFORMATION & TELECOMMUNICATION GROUP Co.,Ltd. Applicant before:State Grid Corporation of China | |
| CB02 | Change of applicant information | ||
| TA01 | Transfer of patent application right | Effective date of registration:20190717 Address after:100085 Building 32-3-4108-4109, Pioneer Road, Haidian District, Beijing Applicant after:BEIJING GUODIANTONG NETWORK TECHNOLOGY Co.,Ltd. Applicant after:STATE GRID CORPORATION OF CHINA Applicant after:STATE GRID INFORMATION & TELECOMMUNICATION GROUP Co.,Ltd. Address before:100192 Beijing city Haidian District Qinghe small Camp Road No. 15 building 710 room research Applicant before:BEIJING CHINA POWER INFORMATION TECHNOLOGY Co.,Ltd. Applicant before:STATE GRID INFORMATION & TELECOMMUNICATION GROUP Co.,Ltd. Applicant before:STATE GRID CORPORATION OF CHINA | |
| TA01 | Transfer of patent application right | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |