Movatterモバイル変換


[0]ホーム

URL:


CN110891028A - Method, device and storage medium for determining load balancing strategy - Google Patents

Method, device and storage medium for determining load balancing strategy
Download PDF

Info

Publication number
CN110891028A
CN110891028ACN201811044541.9ACN201811044541ACN110891028ACN 110891028 ACN110891028 ACN 110891028ACN 201811044541 ACN201811044541 ACN 201811044541ACN 110891028 ACN110891028 ACN 110891028A
Authority
CN
China
Prior art keywords
bits
bit
mac addresses
bras
classification
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.)
Granted
Application number
CN201811044541.9A
Other languages
Chinese (zh)
Other versions
CN110891028B (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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co LtdfiledCriticalHuawei Technologies Co Ltd
Priority to CN201811044541.9ApriorityCriticalpatent/CN110891028B/en
Publication of CN110891028ApublicationCriticalpatent/CN110891028A/en
Application grantedgrantedCritical
Publication of CN110891028BpublicationCriticalpatent/CN110891028B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

Translated fromChinese

本申请公开了一种确定负载均衡策略的方法、装置及存储介质,属于通信技术领域。所述方法包括:获取多个MAC地址,根据多个MAC地址,确定将多个MAC地址划分为N类的分类规则,根据分类规则确定第一BRAS的负载均衡策略,并向第一BRAS发送第一BRAS的负载均衡策略。这样的话,即使MAC地址的最后一位为奇数的用户终端的数量和MAC地址的最后一位为偶数的用户终端的数量的比例与1:1相差很大,也可以根据其他的比特位制定出能够保证各个BRAS待处理的用户终端的数量分布比较均衡的负载均衡策略,提高了确定出的负载均衡策略的灵活性。

Figure 201811044541

The present application discloses a method, a device and a storage medium for determining a load balancing strategy, which belong to the technical field of communications. The method includes: acquiring multiple MAC addresses, determining a classification rule for dividing the multiple MAC addresses into N classes according to the multiple MAC addresses, determining a load balancing policy of the first BRAS according to the classification rule, and sending the first BRAS to the first BRAS. A load balancing strategy of BRAS. In this way, even if the ratio of the number of user terminals whose last digit of the MAC address is an odd number to the number of user terminals whose last digit of the MAC address is an even number is very different from 1:1, it can be determined according to other bits. The load balancing strategy can ensure a relatively balanced distribution of the number of user terminals to be processed by each BRAS, and improves the flexibility of the determined load balancing strategy.

Figure 201811044541

Description

Translated fromChinese
确定负载均衡策略的方法、装置及存储介质Method, device and storage medium for determining load balancing strategy

技术领域technical field

本申请涉及通信技术领域,特别涉及一种确定负载均衡策略的方法、装置及存储介质。The present application relates to the field of communication technologies, and in particular, to a method, an apparatus, and a storage medium for determining a load balancing strategy.

背景技术Background technique

目前,用户终端主要是通过宽带远程接入服务器(Broadband Remote AccessServer,BRAS)接入网络的。并且随着互联网技术的发展,为了避免一个BRAS需要处理的用户终端的接入请求过多,通常在网络中部署两个BRAS,这两个BRAS按照预先设置的负载均衡策略分别处理不同类型的用户终端的接入请求,以实现负载均衡。At present, the user terminal mainly accesses the network through a broadband remote access server (Broadband Remote Access Server, BRAS). And with the development of Internet technology, in order to avoid too many access requests of user terminals that need to be processed by one BRAS, two BRASs are usually deployed in the network, and these two BRASs respectively handle different types of users according to the preset load balancing strategy. Access requests from terminals to achieve load balancing.

为了便于说明,将两个BRAS分别称为第一BRAS和第二BRAS。对于任一用户终端,在该用户终端需要接入网络时,第一BRAS和第二BRAS均接收到该用户终端发送的接入请求,第一BRAS和第二BRAS分别确定该用户终端的媒体访问控制(Media Access Control,MAC)地址的最后一位,其中,MAC地址是采用二进制方式记录的。对于第一BRAS,如果该用户终端的MAC地址的最后一位为奇数1,则立即响应该用户终端的接入请求,以使该用户终端通过第一BRAS接入网络。对于第二BRAS,如果该用户终端的MAC地址的最后一位为偶数0,则立即响应该用户终端的接入请求,以使该用户终端通过第二BRAS接入网络。也即是,相关技术是根据用户终端的MAC地址最后一位的奇偶特征制定的负载均衡策略。For convenience of description, the two BRASs are referred to as the first BRAS and the second BRAS, respectively. For any user terminal, when the user terminal needs to access the network, both the first BRAS and the second BRAS receive the access request sent by the user terminal, and the first BRAS and the second BRAS respectively determine the media access of the user terminal The last digit of a control (Media Access Control, MAC) address, where the MAC address is recorded in a binary manner. For the first BRAS, if the last digit of the MAC address of the user terminal is an odd number 1, the user terminal's access request is immediately responded, so that the user terminal can access the network through the first BRAS. For the second BRAS, if the last digit of the MAC address of the user terminal is an even number 0, immediately respond to the access request of the user terminal, so that the user terminal can access the network through the second BRAS. That is, the related art is a load balancing strategy formulated according to the parity characteristic of the last digit of the MAC address of the user terminal.

由于上述负载均衡策略是根据用户终端的MAC地址最后一位的奇偶特征来实现负载均衡的,因此,对于接入网络的所有用户终端,如果MAC地址的最后一位为奇数的用户终端的数量和MAC地址的最后一位为偶数的用户终端的数量的比例近似为1:1,那么通过上述方法基本可以实现负载均衡。但是,如果MAC地址的最后一位为奇数的用户终端的数量和MAC地址的最后一位为偶数的用户终端的数量的比例与1:1相差很大,那么通过上述负载均衡策略实际是不能实现负载均衡的。Since the above load balancing strategy implements load balancing based on the parity characteristic of the last digit of the MAC address of the user terminal, for all user terminals accessing the network, if the last digit of the MAC address is an odd number of user terminals and The ratio of the number of user terminals whose last digit of the MAC address is an even number is approximately 1:1, so load balancing can be basically achieved by the above method. However, if the ratio of the number of user terminals whose last digit of the MAC address is an odd number to the number of user terminals whose last digit of the MAC address is an even number is very different from 1:1, then the above load balancing strategy cannot actually be implemented. Load balanced.

发明内容SUMMARY OF THE INVENTION

本申请提供了一种确定负载均衡策略的方法、装置及存储介质,可以解决相关技术中无法真正实现负载均衡的问题。所述技术方案如下:The present application provides a method, an apparatus and a storage medium for determining a load balancing strategy, which can solve the problem that load balancing cannot be truly achieved in the related art. The technical solution is as follows:

第一方面,提供了一种确定负载均衡策略的方法,该方法由确定负载均衡策略的装置执行,该方法包括:获取多个MAC地址,多个MAC地址包括在第一时间段内通过N个BRAS中任一BRAS接入网络的用户终端的MAC地址,N为大于或等于2的正整数,多个MAC地址中的每个MAC地址包括M个比特位,M为大于或等于1的正整数;根据多个MAC地址,确定将多个MAC地址划分为N类的分类规则,分类规则包括用于进行分类的比特位标识和N个比特值集合,比特位标识指示用于进行分类的至少一个比特位在M个比特位中的位置,至少一个比特位对应多个组合比特值,每个组合比特值是由至少一个比特位中每个比特位上的比特值组合而成,分类规则包括的N个比特值集合中每个比特值集合包括多个组合比特值中的至少一个;从分类规则包括的N个比特值集合中确定与第一BRAS对应的比特值集合,并将比特位标识和与第一BRAS对应的比特值集合作为第一BRAS的负载均衡策略,第一BRAS为N个BRAS中的一个;向第一BRAS发送第一BRAS的负载均衡策略。A first aspect provides a method for determining a load balancing policy, the method being executed by a device for determining a load balancing policy, the method comprising: acquiring multiple MAC addresses, the multiple MAC addresses including passing through N MAC address of the user terminal of any BRAS access network in the BRAS, N is a positive integer greater than or equal to 2, each MAC address in the multiple MAC addresses includes M bits, and M is a positive integer greater than or equal to 1 ; According to a plurality of MAC addresses, it is determined that the classification rules that the plurality of MAC addresses are divided into N classes, the classification rules include bit identifications for classifying and N bit value sets, and the bit identifications indicate at least one for classifying. The position of a bit in M bits, at least one bit corresponds to multiple combined bit values, and each combined bit value is composed of the bit values on each bit in at least one bit. The classification rules include Each bit value set in the N bit value sets includes at least one of a plurality of combined bit values; the bit value set corresponding to the first BRAS is determined from the N bit value sets included in the classification rule, and the bit identification and The set of bit values corresponding to the first BRAS is used as the load balancing policy of the first BRAS, and the first BRAS is one of the N BRASs; the load balancing policy of the first BRAS is sent to the first BRAS.

在本申请中,获取多个MAC地址,根据多个MAC地址,确定将多个MAC地址划分为N类的分类规则,根据分类规则确定第一BRAS的负载均衡策略,并向第一BRAS发送第一BRAS的负载均衡策略。由于第一BRAS为N个BRAS中的一个,因此,通过本申请提供的方法可以确定每个BRAS的负载均衡策略。由于分类规则包括比特位标识和N个比特值集合,也即是,本申请提供的负载均衡策略是根据多个MAC地址确定的,这样的话,即使MAC地址的最后一位为奇数的用户终端的数量和MAC地址的最后一位为偶数的用户终端的数量的比例与1:1相差很大,也可以根据其他的比特位制定出能够保证各个BRAS待处理的用户终端的数量分布比较均衡的负载均衡策略,提高了确定出的负载均衡策略的灵活性。进一步地,在各个BRAS根据本申请提供的负载均衡策略处理用户终端的接入请求之后,可以使得通过各个BRAS接入网络的用户终端的数量比较均匀。In this application, a plurality of MAC addresses are obtained, a classification rule for dividing the plurality of MAC addresses into N classes is determined according to the plurality of MAC addresses, a load balancing policy of the first BRAS is determined according to the classification rule, and the first BRAS is sent to the first BRAS. A load balancing strategy of BRAS. Since the first BRAS is one of the N BRASs, the load balancing policy of each BRAS can be determined by the method provided in this application. Since the classification rule includes bit identifiers and sets of N bit values, that is, the load balancing policy provided by this application is determined based on multiple MAC addresses, so that even if the last digit of the MAC address is an odd number of user terminals The ratio between the number and the number of user terminals whose last digit of the MAC address is an even number is very different from 1:1. It is also possible to formulate a load that can ensure a balanced distribution of the number of user terminals to be processed by each BRAS according to other bits. The balancing strategy improves the flexibility of the determined load balancing strategy. Further, after each BRAS processes the access request of the user terminal according to the load balancing policy provided in the present application, the number of user terminals accessing the network through each BRAS can be made relatively uniform.

可选地,根据多个MAC地址,确定将多个MAC地址划分为N类的分类规则,包括:确定将P个比特位对应的组合比特值划分为N个比特值集合的至少一个分类方式,其中,P为大于或等于1的正整数,且P个比特位对应的组合比特值的数量大于或等于N;从M个比特位中选择P个比特位;确定多个MAC地址中每个MAC地址在选择的P个比特位上对应的组合比特值;从至少一个分类方式中选择一个分类方式,并根据多个MAC地址中每个MAC地址在选择的P个比特位上对应的组合比特值,按照选择的分类方式对多个MAC地址进行分类,得到N个MAC地址集合;当得到的任意两个MAC地址集合中包括的MAC地址的数量的比值与第一参考数值之间的差值均小于第一数值阈值时,根据选择的P个比特位在M个比特位中的位置确定分类规则中的比特位标识,并将选择的分类方式对应的N个比特值集合作为分类规则中的N个比特值集合。Optionally, according to the multiple MAC addresses, determining a classification rule for dividing the multiple MAC addresses into N classes includes: determining at least one classification manner for dividing the combined bit values corresponding to the P bits into N bit value sets, Among them, P is a positive integer greater than or equal to 1, and the number of combined bit values corresponding to the P bits is greater than or equal to N; select P bits from the M bits; determine each MAC address in the multiple MAC addresses The corresponding combined bit value of the address on the selected P bits; select one classification mode from at least one classification mode, and according to the corresponding combined bit value of each MAC address in the selected P bits of the multiple MAC addresses , classify multiple MAC addresses according to the selected classification method, and obtain N MAC address sets; when the ratio of the number of MAC addresses included in any two MAC address sets obtained and the difference between the first reference value are all When it is less than the first numerical threshold, determine the bit identifier in the classification rule according to the positions of the selected P bits in the M bits, and use the set of N bit values corresponding to the selected classification mode as N in the classification rule. set of bit values.

在一种可能的实现方式中,在分类之后,如果任意两个MAC地址集合中包括的MAC地址的数量的比值与第一参考数值之间的差值均小于第一数值阈值,表明此时任意两个MAC地址集合中包括的MAC地址的数量差不多。也即是,分类规则是将多个MAC地址划分为N等份的一个规则,这样的话,通过分类规则确定的负载均衡策略就可以真正实现负载均衡,提高了本申请提供的确定负载均衡策略的方法的实用性。In a possible implementation manner, after the classification, if the difference between the ratio of the number of MAC addresses included in any two MAC address sets and the first reference value is smaller than the first numerical threshold, it indicates that at this time any The number of MAC addresses included in the two MAC address sets is similar. That is, the classification rule is a rule that divides multiple MAC addresses into N equal parts. In this way, the load balancing policy determined by the classification rule can truly realize load balancing, which improves the efficiency of determining the load balancing policy provided by this application. practicality of the method.

可选地,根据多个MAC地址中每个MAC地址在选择的P个比特位上对应的组合比特值,按照选择的分类方式对多个MAC地址进行分类,得到N个MAC地址集合之后,还包括:当得到的任意两个MAC地址集合中包括的MAC地址的数量的比值与第一参考数值之间的差值大于或等于第一数值阈值,则重新从至少一个分类方式中选择一个分类方式,并返回执行根据每个MAC地址在选择的P个比特位上对应的组合比特值,按照重新选择的分类方式对多个MAC地址进行分类,得到N个MAC地址集合的操作,直至根据重新选择的分类方式确定分类规则。Optionally, according to the combined bit value corresponding to each of the multiple MAC addresses on the selected P bits, classify the multiple MAC addresses according to the selected classification method, and after obtaining N sets of MAC addresses, also Including: when the difference between the ratio of the number of MAC addresses included in any two MAC address sets obtained and the first reference value is greater than or equal to the first numerical threshold, then reselect a classification method from at least one classification method , and return to perform the operation of classifying multiple MAC addresses according to the re-selected classification method according to the corresponding combination bit value of each MAC address on the selected P bits, and obtaining N sets of MAC addresses until the re-selection is performed. The classification method determines the classification rules.

当按照当前选择的分类方式无法实现将所有MAC地址进行均分时,需要重新选择一个分类方式,然后按照重新选择的分类方式对所有MAC地址进行分类,以避免只能按照一种分类方式多个MAC地址进行分类,提高了本申请提供的确定负载均衡策略的方法的灵活性。When it is impossible to divide all MAC addresses equally according to the currently selected classification method, it is necessary to re-select a classification method, and then classify all MAC addresses according to the re-selected classification method, so as to avoid multiple MAC addresses that can only be classified according to one classification method. The MAC address classification improves the flexibility of the method for determining the load balancing strategy provided by the present application.

可选地,确定多个MAC地址中每个MAC地址在选择的P个比特位上对应的组合比特值之后,还包括:当按照至少一个分类方式中任一分类方式分类之后,任意两个MAC地址集合中包括的MAC地址的数量的比值与第一参考数值之间的差值均大于或等于第一数值阈值时,从M个比特位中重新选择P个比特位,并返回执行确定多个MAC地址中每个MAC地址在重新选择的P个比特位上对应的组合比特值的操作,直至根据重新选择的P个比特位确定分类规则。Optionally, after determining the combined bit value corresponding to the selected P bits of each MAC address in the plurality of MAC addresses, the method further includes: after being classified according to any one of the at least one classification manner, any two MAC addresses are When the difference between the ratio of the number of MAC addresses included in the address set and the first reference value is greater than or equal to the first value threshold, reselect P bits from the M bits, and return to executing the determination of multiple The operation of combining the corresponding bit values of each MAC address in the reselected P bits until the classification rule is determined according to the reselected P bits.

进一步地,如果根据某次选择的P个比特位不能确定出分类规则,则可以重新从M个比特位中选择P个比特位,然后根据重新选择的P个比特位确定分类规则,以避免只能按照特定的P个比特位确定分类规则,从而保证最终能够确定出分类规则。Further, if the classification rule cannot be determined according to the selected P bits, then P bits can be re-selected from the M bits, and then the classification rules can be determined according to the re-selected P bits, so as to avoid The classification rule can be determined according to the specific P bits, so as to ensure that the classification rule can be finally determined.

可选地,该方法还包括:当在遍历完M个比特位中的所有P个比特位之后没有确定出分类规则时,重新设置P的数值,并返回执行确定将P个比特位对应的组合比特值划分为N个比特值集合的至少一个分类方式的操作,直至确定出分类规则。Optionally, the method also includes: when the classification rule is not determined after traversing all P bits in the M bits, reset the value of P, and return to perform a combination of determining the corresponding P bits. The operation of dividing the bit value into at least one classification manner of N bit value sets until the classification rule is determined.

进一步地,如果根据任意P个比特位不能确定出分类规则,则可以通过上述方式重新选择其他数量个比特位,以便于可以根据其他数量个比特位确定出分类规则。这样的话,即使MAC地址的最后一位为奇数的用户终端的数量和MAC地址的最后一位为偶数的用户终端的数量的比例与1:1相差很大,也可以根据其他的两个或更多个比特位制定出能够保证各个BRAS待处理的用户终端的数量分布比较均衡的负载均衡策略,从而提高了确定出的负载均衡策略的灵活性。Further, if the classification rule cannot be determined according to any P bits, another number of bits can be reselected in the above manner, so that the classification rule can be determined according to the other number of bits. In this case, even if the ratio of the number of user terminals whose last digit of the MAC address is an odd number and the number of user terminals whose last digit of the MAC address is an even number is very different from 1:1, it can be determined according to the other two or more Multiple bits are used to formulate a load balancing strategy that can ensure a relatively balanced distribution of the number of user terminals to be processed by each BRAS, thereby improving the flexibility of the determined load balancing strategy.

可选地,获取N个MAC地址列表之前,还包括:获取在第二时间段通过N个BRAS中每个BRAS接入网络的用户终端的数量,得到每个BRAS的上线用户数量;当N个BRAS中任意两个BRAS的上线用户数量的比值与第二参考数值之间的差值超过第二数值阈值时,执行获取N个MAC地址列表的操作。Optionally, before acquiring the N MAC address lists, the method further includes: acquiring the number of user terminals accessing the network through each of the N BRASs in the second time period, and acquiring the number of online users of each BRAS; When the difference between the ratio of the number of online users of any two BRASs in the BRAS and the second reference value exceeds the second numerical threshold, the operation of acquiring N MAC address lists is performed.

在本申请中,N个BRAS可以先按照相关技术提供的负载均衡策略处理接入请求,然后在确定按照预定负载均衡策略无法实现负载均衡时,再执行本申请提供的负载均衡策略的方法,提高了本申请提供的负载均衡策略的方法的灵活性。In the present application, N BRASs may first process the access request according to the load balancing strategy provided by the related art, and then execute the method of the load balancing strategy provided by the present application when it is determined that the load balancing cannot be achieved according to the predetermined load balancing strategy, so as to improve the The flexibility of the load balancing strategy method provided by this application is improved.

第二方面,提供了一种确定负载均衡策略的装置,应用于网络设备,网络设备所在的网络中部署有N个BRAS,所述确定负载均衡策略的装置具有实现上述第一方面中确定负载均衡策略的方法行为的功能。所述确定负载均衡策略的装置包括至少一个模块,该至少一个模块用于实现上述第一方面所提供的确定负载均衡策略的方法。In a second aspect, a device for determining a load balancing strategy is provided, which is applied to a network device, where N BRASs are deployed in a network where the network device is located, and the device for determining a load balancing strategy has the ability to implement the determination of load balancing in the first aspect above. A function of the method behavior of the strategy. The apparatus for determining a load balancing policy includes at least one module, and the at least one module is configured to implement the method for determining a load balancing policy provided in the first aspect above.

第三方面,提供了一种确定负载均衡策略的装置,应用于网络设备,网络设备所在的网络中部署有N个BRAS,所述确定负载均衡策略的装置的结构中包括处理器和存储器,所述存储器用于存储支持确定负载均衡策略的装置执行上述第一方面所提供的确定负载均衡策略的方法的程序,以及存储用于实现上述第一方面所提供的确定负载均衡策略的方法所涉及的数据。所述处理器被配置为用于执行所述存储器中存储的程序。所述存储设备的操作装置还可以包括通信总线,该通信总线用于该处理器与存储器之间建立连接。In a third aspect, an apparatus for determining a load balancing policy is provided, which is applied to a network device, where N BRASs are deployed in a network where the network device is located, and the structure of the apparatus for determining a load balancing policy includes a processor and a memory, so The memory is used to store a program that supports the device for determining a load balancing policy to perform the method for determining a load balancing policy provided in the first aspect, and stores the program for implementing the method for determining a load balancing policy provided in the first aspect. data. The processor is configured to execute programs stored in the memory. The operating means of the storage device may further include a communication bus for establishing a connection between the processor and the memory.

第四方面,提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述第一方面所述的确定负载均衡策略的方法。In a fourth aspect, a computer-readable storage medium is provided, where instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium runs on a computer, the computer executes the method for determining a load balancing strategy described in the first aspect above .

第五方面,提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述第一方面所述的确定负载均衡策略的方法。In a fifth aspect, a computer program product containing instructions is provided, which, when executed on a computer, causes the computer to execute the method for determining a load balancing policy described in the first aspect above.

上述第二方面、第三方面、第四方面和第五方面所获得的技术效果与第一方面中对应的技术手段获得的技术效果近似,在这里不再赘述。The technical effects obtained by the second aspect, the third aspect, the fourth aspect and the fifth aspect are similar to the technical effects obtained by the corresponding technical means in the first aspect, and will not be repeated here.

附图说明Description of drawings

图1是本申请实施例提供的一种网络系统示意图;1 is a schematic diagram of a network system provided by an embodiment of the present application;

图2是本申请实施例提供的一种确定负载均衡策略的方法流程图;FIG. 2 is a flowchart of a method for determining a load balancing strategy provided by an embodiment of the present application;

图3是本申请实施例提供的一种确定分类规则的方法流程图;3 is a flowchart of a method for determining a classification rule provided by an embodiment of the present application;

图4是本申请实施例提供的一种确定负载均衡策略的装置框图;4 is a block diagram of an apparatus for determining a load balancing strategy provided by an embodiment of the present application;

图5是本申请实施例提供的一种第一确定模块框图;5 is a block diagram of a first determination module provided by an embodiment of the present application;

图6是本申请实施例提供的一种网络设备的结构示意图。FIG. 6 is a schematic structural diagram of a network device provided by an embodiment of the present application.

具体实施方式Detailed ways

为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the objectives, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.

在对本申请实施例提供的确定负载均衡策略的方法进行解释说明之前,先对本申请实施例的应用场景进行解释说明。目前,随着互联网技术的发展,用户终端对多媒体数据业务的需求远远大于传统的语音数据业务的需求,致使网络中亟需一种智能化的多业务控制网关,以支持更多不同类型的数据业务的需求。而BRAS正是这样一种智能化的多业务控制网关,它可以充分保证各项数据业务的安全性和可靠性。因此,目前在网络中通常都部署有BRAS,用户终端可以通过BRAS接入网络。进一步地,为了避免一个BRAS处理的业务过多,通常在网络中部署两个BRAS,这两个BRAS按照预先制定的负载均衡策略分别处理不同的用户终端的业务。Before explaining the method for determining a load balancing policy provided by the embodiment of the present application, an application scenario of the embodiment of the present application is explained first. At present, with the development of Internet technology, the demand of user terminals for multimedia data services is far greater than that of traditional voice data services, resulting in an urgent need for an intelligent multi-service control gateway in the network to support more different types of Data business needs. And BRAS is such an intelligent multi-service control gateway, which can fully guarantee the security and reliability of various data services. Therefore, a BRAS is usually deployed in a network at present, and a user terminal can access the network through the BRAS. Further, in order to avoid too many services processed by one BRAS, two BRASs are usually deployed in the network, and the two BRASs respectively process services of different user terminals according to a pre-established load balancing policy.

图1是本申请实施例提供的一种网络系统示意图,如图1所示,该网络系统100包括至少一个用户终端101、交换机102、至少一个BRAS 103、后台服务器104和网络控制器105。其中,每个用户终端101与对应的交换机102之间通过有线或无线方式连接以进行通信。对于任一交换机102,该交换机102与网络中的每个BRAS之间通过有线或无线方式连接以进行通信,以使每个用户终端101可通过对应的交换机102与所有的BRAS中每个BRAS进行通信。每个BRAS与后台服务器104之间通过网络连接以进行通信,网络控制器105与每个BRAS 103之间也通过网络连接以进行通信。其中,该网络可以为骨干网等网络。FIG. 1 is a schematic diagram of a network system provided by an embodiment of the present application. As shown in FIG. 1 , the network system 100 includes at least oneuser terminal 101 , aswitch 102 , at least oneBRAS 103 , abackground server 104 and anetwork controller 105 . Wherein, eachuser terminal 101 and thecorresponding switch 102 are connected by wire or wireless for communication. For anyswitch 102, theswitch 102 and each BRAS in the network are connected by wire or wireless for communication, so that eachuser terminal 101 can communicate with each BRAS in all the BRASs through thecorresponding switch 102 communication. Each BRAS and thebackground server 104 are connected through a network for communication, and thenetwork controller 105 and eachBRAS 103 are also connected through a network for communication. Wherein, the network may be a network such as a backbone network.

在一种可能的实现方式中,对于图1中任一用户终端101,该用户终端101可以基于以太网上的点对点(Point to Point Protocol over Ethernet,PPPoE)协议接入网络。具体地,当该用户终端101需要接入网络时,该用户终端101通过对应的交换机102广播接入请求,该接入请求可以是PPPoE活动发现发起(PPPoE Active Discovery Initiation,PADI)报文,该PADI报文中携带该用户终端101的MAC地址。网络中的每个BRAS 103均将接收到该PADI报文,对于任一BRAS 103,该BRAS 103根据预先制定的负载均衡策略和该用户终端101的MAC地址,判断该用户终端的MAC地址是否满足一定条件。如果满足一定条件,该BRAS 103则立即向该用户终端101返回应答消息,该应答消息中携带该BRAS 103的标识,当该用户终端101接收到应答消息时,则可以通过该BRAS 103接入网络。In a possible implementation manner, for anyuser terminal 101 in FIG. 1 , theuser terminal 101 may access the network based on the Point to Point Protocol over Ethernet (PPPoE) protocol over Ethernet. Specifically, when theuser terminal 101 needs to access the network, theuser terminal 101 broadcasts an access request through thecorresponding switch 102, and the access request may be a PPPoE Active Discovery Initiation (PPPoE Active Discovery Initiation, PADI) message, the The MAC address of theuser terminal 101 is carried in the PADI packet. EachBRAS 103 in the network will receive the PADI message, and for anyBRAS 103, theBRAS 103 judges whether the MAC address of the user terminal satisfies the requirements according to the preset load balancing policy and the MAC address of theuser terminal 101. certain conditions. If certain conditions are met, theBRAS 103 immediately returns a response message to theuser terminal 101, and the response message carries the identifier of theBRAS 103. When theuser terminal 101 receives the response message, it can access the network through theBRAS 103 .

另外,如果该用户终端的MAC地址不满足一定条件,该BRAS 103则会延迟向该用户终端101返回应答消息,此时如果该用户终端101已经通过其他的BRAS接入网络,则会丢弃该应答消息,如果该用户终端101没有通过其他的BRAS接入网络,则可以继续通过该BRAS103接入网络,这样可以保证用户终端101能够成功接入网络。In addition, if the MAC address of the user terminal does not meet certain conditions, theBRAS 103 will delay returning a response message to theuser terminal 101. At this time, if theuser terminal 101 has accessed the network through another BRAS, the response will be discarded. message, if theuser terminal 101 does not access the network through another BRAS, it can continue to access the network through theBRAS 103, which can ensure that theuser terminal 101 can successfully access the network.

其中,用户终端101通过BRAS 103接入网络,是指用户终端101通过BRAS 103与后台服务器104之间进行信息交互。网络控制器105用于对进行流量管理。在一种可能的实现方式中,当网络为软定义网络(Software Defined Network,SDN)时,网络控制器105可以为SDN控制器(SDN Controller,SNC)。The fact that theuser terminal 101 accesses the network through theBRAS 103 means that theuser terminal 101 exchanges information with thebackground server 104 through theBRAS 103 . Thenetwork controller 105 is used for traffic management. In a possible implementation manner, when the network is a software defined network (Software Defined Network, SDN), thenetwork controller 105 may be an SDN controller (SDN Controller, SNC).

在申请实施例中,负载均衡策略用于描述各个BRAS 103待处理的用户终端的MAC地址需要满足的条件。其中,负载均衡策略由确定负载均衡策略的装置来制定,也即是,本申请实施例提供的确定负载均衡策略的方法是由确定负载均衡策略的装置执行,该确定负载均衡策略的装置可以为图1中的一个BRAS 103,还可以为图1中的网络控制器105,当然还可以为图1所示的网络系统中的其他网络设备,本申请实施例在此不做具体限定。In the application embodiment, the load balancing policy is used to describe the conditions that the MAC addresses of the user terminals to be processed by eachBRAS 103 need to meet. The load balancing strategy is formulated by the device for determining the load balancing strategy, that is, the method for determining the load balancing strategy provided by the embodiment of the present application is executed by the device for determining the load balancing strategy, and the device for determining the load balancing strategy may be ABRAS 103 in FIG. 1 may also be thenetwork controller 105 in FIG. 1 , and certainly may also be other network devices in the network system shown in FIG. 1 , which is not specifically limited in this embodiment of the present application.

需要说明的是,图1中的用户终端的数量、交换机的数量、BRAS的数量,以及各个设备之间的连接关系仅仅是举例说明,并不构成对本申请的限定。比如,具体应用时,网络系统100中可以是三个用户终端对应一个交换机,另外,网络系统还可以部署3个或更多的BRAS。It should be noted that the number of user terminals, the number of switches, the number of BRASs, and the connection relationship between various devices in FIG. 1 are only examples and do not constitute a limitation to the present application. For example, in a specific application, three user terminals may correspond to one switch in the network system 100, and in addition, three or more BRASs may be deployed in the network system.

接下来对本申请实施例提供的确定负载均衡策略的方法进行详细解释说明。Next, the method for determining a load balancing policy provided by the embodiment of the present application will be explained in detail.

图2是本申请实施例提供的一种确定负载均衡策略的方法流程图,该方法由确定负载均衡策略的装置执行,该确定负载均衡策略的装置可以为图1所示的网络系统中的某个网络设备,比如,可以为某个BRAS或网络控制器,另外,为了后续便于说明,假设图1所示的网络系统中部署有N个BRAS。具体地,如图2所示,该方法包括如下步骤:FIG. 2 is a flowchart of a method for determining a load balancing policy provided by an embodiment of the present application. The method is executed by a device for determining a load balancing policy, and the device for determining a load balancing policy may be a certain device in the network system shown in FIG. 1 . Each network device may be, for example, a certain BRAS or a network controller. In addition, for the convenience of subsequent description, it is assumed that N BRASs are deployed in the network system shown in FIG. 1 . Specifically, as shown in Figure 2, the method includes the following steps:

步骤201:获取多个MAC地址,多个MAC地址包括在第一时间段内通过N个BRAS中任一BRAS接入网络的用户终端的MAC地址,N为大于或等于2的正整数,多个MAC地址中的每个MAC地址包括M个比特位,M为大于或等于1的正整数。Step 201: Acquire multiple MAC addresses, where the multiple MAC addresses include the MAC addresses of user terminals that access the network through any of the N BRASs within the first time period, where N is a positive integer greater than or equal to 2, and the multiple MAC addresses are: Each MAC address in the MAC address includes M bits, where M is a positive integer greater than or equal to 1.

在本申请实施例中,为了使得网络系统中N个BRAS按照本申请实施例提供的负载均衡策略处理网络系统中的用户终端的接入请求之后可以真正地实现负载均衡,需要先获取多个MAC地址,以便于后续根据多个MAC地址制定合适的负载均衡策略。In the embodiment of the present application, in order to enable the N BRASs in the network system to truly implement load balancing after processing the access requests of the user terminals in the network system according to the load balancing policy provided in the embodiment of the present application, it is necessary to obtain multiple MAC addresses first. address, so as to formulate an appropriate load balancing strategy based on multiple MAC addresses in the future.

由于用户终端在通过任一BRAS接入网络之后,该BRAS中将记录有该用户终端的MAC地址,也即是,每个BRAS中存储有一个MAC地址列表,每个MAC地址列表中包括在第一时间段内通过对应BRAS接入网络的各个用户终端的MAC地址。因此,在一种可能的实现方式中,获取多个MAC地址具体可以为:获取与N个BRAS一一对应的N个MAC地址列表,然后获取N个MAC地址列表中的地址,即可得到步骤201中的多个MAC地址。After the user terminal accesses the network through any BRAS, the BRAS will record the MAC address of the user terminal, that is, each BRAS stores a MAC address list, and each MAC address list is included in the first MAC address list. The MAC address of each user terminal that accesses the network through the corresponding BRAS within a period of time. Therefore, in a possible implementation manner, acquiring multiple MAC addresses may specifically be: acquiring N MAC address lists corresponding to N BRASs one-to-one, and then acquiring addresses in the N MAC address lists, and then the steps can be obtained. Multiple MAC addresses in 201.

由图1所示的网络系统可知,负载均衡策略可以由N个BRAS中的一个BRAS制定,或者,还可以由网络控制器制定。因此,获取与N个BRAS一一对应的N个MAC地址列表具体由以下两种实现方式。It can be known from the network system shown in FIG. 1 that the load balancing policy may be formulated by one BRAS among the N BRASs, or may also be formulated by a network controller. Therefore, the acquisition of the N MAC address lists corresponding to the N BRASs one-to-one is specifically implemented in the following two manners.

第一种实现方式,应用于负载均衡策略由N个BRAS中的一个BRAS制定的场景中,为了后续便于说明,将制定负载均衡策略的BRAS称为目标BRAS。The first implementation manner is applied to a scenario where the load balancing policy is formulated by one BRAS among N BRASs. For the convenience of subsequent description, the BRAS that formulates the load balancing policy is called the target BRAS.

具体地,目标BRAS向N个BRAS中其他的每个BRAS发送MAC地址列表查询请求,对于其他的任一BRAS,当该BRAS接收到MAC地址列表查询请求时,将自身的MAC地址列表反馈给目标BRAS。目标BRAS接收其他的各个BRAS发送的MAC地址列表,并获取自身的MAC地址列表。Specifically, the target BRAS sends a MAC address list query request to each other BRAS among the N BRASs. For any other BRAS, when the BRAS receives the MAC address list query request, it feeds back its own MAC address list to the target. Bras. The target BRAS receives the MAC address list sent by other BRASs, and obtains its own MAC address list.

第二种实现方式,应用于负载均衡策略由网络控制器制定的场景中。The second implementation method is applied in the scenario where the load balancing policy is formulated by the network controller.

具体地,网络控制器向N个BRAS中每个BRAS发送MAC地址列表查询请求,对于N个BRAS中任一BRAS,当该BRAS接收到MAC地址列表查询请求时,将自身的MAC地址列表反馈给网络控制器,网络控制器可以接收N个BRAS中每个BRAS发送的MAC地址列表。Specifically, the network controller sends a MAC address list query request to each of the N BRASs. For any BRAS among the N BRASs, when the BRAS receives the MAC address list query request, it feeds back its own MAC address list to the BRAS. The network controller, the network controller can receive the MAC address list sent by each of the N BRASs.

其中,第一时间段为当前时间之前的一段时间,示例地,第一时间段可以为当前时间之前且距离当前时间第一时长的时间段。比如,当第一时长为1天时,每个MAC地址列表包括在最近1天内通过对应的BRAS接入网络的各个用户终端的MAC地址。另外,MAC地址列表还可以称为MAC地址明细,本申请实施例对此不做具体限定。The first period of time is a period of time before the current time. For example, the first period of time may be a period of time before the current time and a first period of time away from the current time. For example, when the first duration is 1 day, each MAC address list includes the MAC addresses of each user terminal that accesses the network through the corresponding BRAS in the last 1 day. In addition, the MAC address list may also be referred to as a MAC address detail, which is not specifically limited in this embodiment of the present application.

上述多个MAC地址是根据与N个BRAS一一对应的N个MAC地址列表确定的,可选地,如果图1所示的网络中某个网络设备可以记录接入网络的所有用户终端的MAC地址,此时,可以直接从该网络设备中获取该多个MAC地址,而无需先获取与N个BRAS一一对应的N个MAC地址列表。当然,在本申请实施例中,还可以通过其他方式获取该多个MAC地址,在此不再一一展开说明。The above-mentioned multiple MAC addresses are determined according to N MAC address lists corresponding to N BRASs one-to-one. Optionally, if a certain network device in the network shown in FIG. 1 can record the MAC addresses of all user terminals accessing the network address, at this time, the multiple MAC addresses can be directly obtained from the network device without first obtaining the N MAC address lists corresponding to the N BRASs one-to-one. Of course, in this embodiment of the present application, the multiple MAC addresses may also be acquired in other manners, which will not be described one by one here.

另外,在本申请实施例中,可以将根据用户终端的MAC地址最后一位的奇偶特征来实现负载均衡的方式设置为默认的负载均衡策略,网络中的各个BRAS按照默认的负载均衡策略处理接收到的用户终端的接入请求。在各个BRAS按照默认的负载均衡策略处理接收到的用户终端的接入请求一段时间之后,确定通过各个BRAS接入网络的用户终端的数量是否均衡,如果均衡,则继续采用默认的负载均衡策略处理接收到的用户终端的接入请求。如果不均衡,则再执行步骤201,以重新确定负载均衡策略。In addition, in this embodiment of the present application, the method of implementing load balancing according to the parity feature of the last digit of the MAC address of the user terminal may be set as the default load balancing strategy, and each BRAS in the network processes the received data according to the default load balancing strategy. The access request to the user terminal. After each BRAS processes the received access requests of user terminals according to the default load balancing policy for a period of time, it is determined whether the number of user terminals accessing the network through each BRAS is balanced. If so, the default load balancing policy continues to be used for processing. The received access request of the user terminal. If it is not balanced,step 201 is performed again to re-determine the load balancing strategy.

其中,确定通过各个BRAS接入网络的用户终端的数量是否均衡的实现方式可以为:获取在第二时间段通过N个BRAS中每个BRAS接入网络的用户终端的数量,得到每个BRAS的上线用户数量,如果N个BRAS中任意两个BRAS的上线用户数量的比值与第二参考数值之间的差值超过第二数值阈值,则执行步骤201。其中,第二参考数值为预先设置的数值,第二数值阈值也为预先设置的数值,示例地,第二参考数值可以为1,此时,第二数值阈值可以为0.01或0.02等。The implementation manner of determining whether the number of user terminals accessing the network through each BRAS is balanced may be: acquiring the number of user terminals accessing the network through each of the N BRASs in the second time period, and obtaining the number of user terminals of each BRAS. The number of online users. If the difference between the ratio of the number of online users of any two BRASs in the N BRASs and the second reference value exceeds the second numerical threshold,step 201 is executed. The second reference value is a preset value, and the second value threshold is also a preset value. For example, the second reference value may be 1. In this case, the second value threshold may be 0.01 or 0.02.

具体地,针对上述步骤201的第一种实现方式,目标BRAS可以向其他的各个BRAS发送上线用户数量查询请求,对于其他的任一BRAS,当该BRAS接收到目标BRAS发送的上线用户数量查询请求时,向目标BRAS反馈第二时间段内通过自身接入网络的用户终端的数量,以使目标BRAS可以获取到N个BRAS中每个BRAS的上线用户数量。目标BRAS可以根据N个BRAS中每个BRAS的上线用户数量确定当前通过各个BRAS接入网络的用户终端的数量是否均衡,如果不均衡,则执行步骤201。Specifically, for the first implementation manner of theabove step 201, the target BRAS may send a query request for the number of online users to other BRASs, and for any other BRAS, when the BRAS receives the query request for the number of online users sent by the target BRAS At the time, the target BRAS feeds back to the target BRAS the number of user terminals that access the network through itself in the second time period, so that the target BRAS can obtain the number of online users of each of the N BRASs. The target BRAS may determine whether the number of user terminals currently accessing the network through each BRAS is balanced according to the number of online users of each of the N BRASs, and if it is not, step 201 is performed.

比如,网络中部署有两个BRAS,将除目标BRAS之外的另一个BRAS称为第二BRAS。此时,目标BRAS通过上述方式获取第二BRAS的上线用户数量,并在确定目标BRAS的上线用户数量和第二BRAS的上线用户数量之间不均衡时,执行步骤201。其中,目标BRAS在通过上述方式获取第二BRAS的上线用户数量之前,目标BRAS可以通过传输控制协议(TransmissionControl Protocol,TCP)握手的方式建立与第二BRAS之间的网络连接,以进行信息交互。当然,目标BRAS还可以通过其他方式建立与第二BRAS之间的网络连接,在此不再详细阐述。For example, two BRASs are deployed in the network, and another BRAS other than the target BRAS is called the second BRAS. At this time, the target BRAS obtains the number of online users of the second BRAS in the above manner, and when it is determined that there is an imbalance between the number of online users of the target BRAS and the number of online users of the second BRAS,step 201 is performed. Wherein, before the target BRAS obtains the number of online users of the second BRAS in the above manner, the target BRAS may establish a network connection with the second BRAS by way of a Transmission Control Protocol (Transmission Control Protocol, TCP) handshake for information exchange. Certainly, the target BRAS may also establish a network connection with the second BRAS in other manners, which will not be described in detail here.

针对上述步骤201的第二种实现方式,网络控制器可以向N个BRAS中每个BRAS发送上线用户数量查询请求,对于N个BRAS中任一BRAS,当该BRAS接收到网络控制器发送的上线用户数量查询请求时,向网络控制器反馈第二时间段内通过自身接入网络的用户终端的数量,以使网络控制器可以获取到N个BRAS中每个BRAS的上线用户数量。网络控制器可以根据N个BRAS中每个BRAS的上线用户数量确定当前通过各个BRAS接入网络的用户终端的数量是否均衡,如果不均衡,则执行步骤201。For the second implementation manner of theabove step 201, the network controller may send a request for querying the number of online users to each of the N BRASs. For any BRAS among the N BRASs, when the BRAS receives the online user request sent by the network controller In the user quantity query request, the network controller feeds back the number of user terminals that access the network through itself in the second time period, so that the network controller can obtain the number of online users of each of the N BRASs. The network controller may determine whether the number of user terminals currently accessing the network through each BRAS is balanced according to the number of online users of each BRAS in the N BRASs, and if it is not, step 201 is performed.

其中,第二时间时段为当前时间之前的一段时间,示例地,第二时间段可以为当前时间之前且距离当前时间第二时长的时间段。比如,当第二时长为4小时,每个BRAS的上线用户数量是指在最近4小时内通过对应的BRAS接入网络的用户终端的数量。另外,第二时间段可以和第一时间段为同一时间段,也可以不是同一时间段,本申请实施例在此不做具体限定。Wherein, the second time period is a period of time before the current time. For example, the second time period may be a period of time before the current time and a second time period away from the current time. For example, when the second duration is 4 hours, the number of online users of each BRAS refers to the number of user terminals that access the network through the corresponding BRAS in the last 4 hours. In addition, the second period of time may be the same period of time as the first period of time, or may not be the same period of time, which is not specifically limited in this embodiment of the present application.

步骤202:根据多个MAC地址,确定将多个MAC地址划分为N类的分类规则,分类规则包括比特位标识和N个比特值集合,比特位标识指示用于进行分类的至少一个比特位在M个比特位中的位置,至少一个比特位对应多个组合比特值,分类规则包括的N个比特值集合中每个比特值集合包括多个组合比特值中的至少一个。Step 202: According to the multiple MAC addresses, determine a classification rule for dividing the multiple MAC addresses into N classes, the classification rule includes a bit identifier and a set of N bit values, and the bit identifier indicates that at least one bit used for classification is in At the position of the M bits, at least one bit corresponds to multiple combined bit values, and each bit value set in the N bit value sets included in the classification rule includes at least one of the multiple combined bit values.

在本申请实施例中,由于预先并不能确定根据多少个比特位能够确定出分类规则,因此,可以设置一个数值P,并为P设置一个初始值,这个初始值可以保证P个比特位对应的组合比特值能够被划分为N类,也即是,P为大于或等于1的正整数,且P个比特位对应的组合比特值的数量大于或等于N。然后通过下述步骤2021至步骤2025判断能否确定出分类规则。如果根据不能确定出分类规则,则重新设置P的数值,并继续通过下述步骤2021至步骤2025判断能否确定出分类规则,重复执行上述过程,直至确定出分类规则。In the embodiment of the present application, since it is not possible to determine in advance how many bits can determine the classification rule, a value P can be set, and an initial value can be set for P, and this initial value can ensure that the corresponding P bits The combined bit values can be divided into N types, that is, P is a positive integer greater than or equal to 1, and the number of combined bit values corresponding to the P bits is greater than or equal to N. Then, it is judged whether the classification rule can be determined through the followingsteps 2021 to 2025 . If the classification rule cannot be determined according to the basis, reset the value of P, and continue to judge whether the classification rule can be determined through the followingsteps 2021 to 2025, and repeat the above process until the classification rule is determined.

为了后续便于说明,在此先对步骤202中的比特位标识和组合比特值进行解释说明。For the convenience of subsequent description, the bit identification and combined bit value instep 202 are explained here first.

其中,比特位标识指示用于进行分类的至少一个比特位在M个比特位中的位置。在一种可能的实现方式中,比特位标识可以为包括M个比特位的一串字符,此时,可以将比特位标识包括的M个比特位中在至少一个比特位对应的比特值设置为1,其他比特位上的比特值设置为0,这样的话,通过比特位标识中哪些比特位上的比特值为1就可以确定用于进行分类的至少一个比特位。示例地,M为10,如果比特位标识为1010000000,表明至少一个比特位为第1个比特位和第3个比特位。Wherein, the bit identifier indicates the position of at least one bit used for classification among the M bits. In a possible implementation manner, the bit identifier may be a string of characters including M bits, and in this case, the bit value corresponding to at least one of the M bits included in the bit identifier may be set as 1. The bit values of other bits are set to 0, so that at least one bit used for classification can be determined by the bit value of which bits in the bit identification are 1. For example, M is 10, and if the bit identifier is 1010000000, it indicates that at least one bit is the first bit and the third bit.

在另一种可能的实现方式中,比特位标识可以为一个数组,该数组包括至少一个数字,每个数字对应至少一个比特位中的一个比特位,且每个数字用于指示对应的比特位在M个比特位中的位置。示例地,如果比特位标识为[1,3],表明至少一个比特位为第1个比特位和第3个比特位。当然,比特位标识不限于上述两种表示方式,具体应用时,可以采用其他的方式表示比特位标识,只要比特位标识能够指示用于进行分类的至少一个比特位在M个比特位中的位置即可。In another possible implementation manner, the bit identifier may be an array, the array includes at least one number, each number corresponds to one bit in the at least one bit, and each number is used to indicate a corresponding bit position in M bits. For example, if the bit identifier is [1, 3], it indicates that at least one bit is the first bit and the third bit. Of course, the bit identifier is not limited to the above two representations. In specific applications, other methods can be used to represent the bit identifier, as long as the bit identifier can indicate the position of at least one bit used for classification in the M bits That's it.

另外,每个组合比特值是由至少一个比特位中每个比特位上的比特值组合而成,示例地,当至少一个比特位为M个比特位中第1个比特位和第3个比特位时,此时至少一个比特位对应4个组合比特值,分别为0,0)、(1,0)、(0,1)、(1,1)。又示例地,当至少一个比特位为M个比特位中第1个比特位时,此时至少一个比特位对应2个组合比特值,分别为(0)和(1)。In addition, each combined bit value is formed by combining the bit values on each of the at least one bit. For example, when the at least one bit is the first bit and the third bit of the M bits When it is a bit, at least one bit corresponds to four combined bit values, which are 0,0), (1,0), (0,1), and (1,1) respectively. For another example, when at least one bit is the first bit among the M bits, at this time, at least one bit corresponds to two combined bit values, which are (0) and (1) respectively.

下面对如何根据P个比特位确定分类规则的过程进行详细解释说明。The process of how to determine the classification rule according to the P bits will be explained in detail below.

图3是本申请实施例提供的一种确定分类规则的方法流程图,如图所示,该方法包括如下步骤:3 is a flowchart of a method for determining a classification rule provided by an embodiment of the present application. As shown in the figure, the method includes the following steps:

步骤2021:确定将P个比特位对应的组合比特值划分为N个比特值集合的至少一个分类方式。Step 2021: Determine at least one classification manner for dividing the combined bit values corresponding to the P bits into N bit value sets.

示例地,当P为2,N为2时,由于每个比特位上的比特值可能为1或0,因此,2个比特位对应的组合比特值包括(0,0)、(1,0)、(0,1)、(1,1)这四种情况。此时将这四个数值划分为两类可以有表1所示的7种分类方式。For example, when P is 2 and N is 2, since the bit value on each bit may be 1 or 0, the combined bit value corresponding to 2 bits includes (0,0), (1,0 ), (0,1), (1,1) four cases. At this time, the four numerical values are divided into two categories, and there are seven classification methods shown in Table 1.

表1Table 1

分类编号Classification number比特值集合set of bit values比特值集合set of bit values第一种分类方式first classification(0,0)(0,0)(1,0)、(0,1)、(1,1)(1,0), (0,1), (1,1)第二种分类方式The second way of classification(1,0)(1,0)(0,0)、(0,1)、(1,1)(0,0), (0,1), (1,1)第三种分类方式third classification(0,1)(0,1)(0,0)、(1,0)、(1,1)(0,0), (1,0), (1,1)第四种分类方式The fourth classification(1,1)(1,1)(0,0)、(1,0)、(0,1)(0,0), (1,0), (0,1)第五种分类方式fifth classification(0,0)、(1,0)(0,0), (1,0)(0,1)、(1,1)(0,1), (1,1)第六种分类方式The sixth classification(0,0)、(0,1)(0,0), (0,1)(1,0)、(1,1)(1,0), (1,1)第七种分类方式The seventh classification(0,0)、(1,1)(0,0), (1,1)(0,1)、(1,0)(0,1), (1,0)

示例地,当P为2,N为3时,此时将2个比特位对应的组合比特值(0,0)、(1,0)、(0,1)、(1,1)划分为3类可以有表1所示的3种分类方式。For example, when P is 2 and N is 3, the combined bit values (0,0), (1,0), (0,1), (1,1) corresponding to the two bits are divided into 3 categories can have 3 classification methods shown in Table 1.

表2Table 2

分类编号Classification number比特值集合set of bit values比特值集合set of bit values比特值集合set of bit values第一种分类方式first classification(0,0)、(1,0)(0,0), (1,0)(0,1)(0,1)(1,1)(1,1)第二种分类方式The second way of classification(0,0)、(0,1)(0,0), (0,1)(1,0)(1,0)(1,1)(1,1)第三种分类方式third classification(0,0)、(1,1)(0,0), (1,1)(0,1)(0,1)(1,0)(1,0)

当N和P为其他的数值时,将P个比特位对应的组合比特值划分为N个比特值集合的至少一个分类方式的实现方式可以参考上述两个示例,在此不再一一展开说明。When N and P are other values, the implementation of at least one classification method for dividing the combined bit value corresponding to the P bits into N bit value sets may refer to the above two examples, and will not be described one by one here. .

步骤2022:从M个比特位中选择P个比特位。Step 2022: Select P bits from the M bits.

在一种可能的实现方式中,步骤2022具体可以为:对于MAC地址中的M个比特位,从M个比特位中依次选择P个比特位,对每次选择的P个比特位执行下述步骤2023至步骤2025,以确定能否根据每次选择的P个比特位确定出分类规则。In a possible implementation manner,step 2022 may specifically be: for M bits in the MAC address, select P bits in sequence from the M bits, and perform the following steps on the P bits selected each time Steps 2023 to 2025 are to determine whether the classification rule can be determined according to the P bits selected each time.

步骤2023:确定多个MAC地址中每个MAC地址在选择的P个比特位上对应的组合比特值。Step 2023: Determine the combined bit value corresponding to each of the multiple MAC addresses on the selected P bits.

比如,选择的比特位为M个比特位中的最后两个比特位,则步骤2023具体可以为:确定每个MAC地址在最后两个比特位上对应的组合比特值。For example, if the selected bits are the last two bits among the M bits,step 2023 may specifically be: determining the combined bit value corresponding to the last two bits of each MAC address.

步骤2024:从至少一个分类方式中选择一个分类方式,并根据多个MAC地址中每个MAC地址在选择的P个比特位上对应的组合比特值,按照选择的分类方式对多个MAC地址进行分类,得到N个MAC地址集合。Step 2024: Select one classification mode from the at least one classification mode, and perform a classification method on the plurality of MAC addresses according to the selected classification mode according to the combined bit value corresponding to the selected P bits of each MAC address in the plurality of MAC addresses. Classification to obtain N MAC address sets.

示例地,当选择的P个比特位为M个比特位中最后两个比特位,选择的分类方式为上述表1中的第一种分类方式时,此时,则可以确定多个MAC地址中每个MAC地址最后两个比特位上对应的组合比特值,将组合比特值为(0,0)的MAC地址归为一类,将组合比特值为(1,0)、(0,1)、(1,1)中任一个的MAC地址归为另一类,得到两个MAC地址集合。For example, when the selected P bits are the last two bits among the M bits, and the selected classification method is the first classification method in the above Table 1, at this time, it can be determined that among the multiple MAC addresses For the corresponding combined bit value on the last two bits of each MAC address, the MAC addresses with combined bit value (0,0) are classified into one category, and the combined bit value is (1,0), (0,1) , (1,1) The MAC address of any one is classified into another class, and two sets of MAC addresses are obtained.

步骤2025:当得到的任意两个MAC地址集合中包括的MAC地址的数量的比值与参考数值之间的差值均小于第一数值阈值时,则根据选择的P个比特位在M个比特位中的位置确定分类规则中的比特位标识,并将选择的分类方式对应的N个比特值集合作为分类规则中的N个比特值集合。Step 2025: When the difference between the ratio of the number of MAC addresses included in any two MAC address sets obtained and the reference value is smaller than the first numerical threshold, then according to the selected P bits in the M bits The position in determines the bit identifier in the classification rule, and the set of N bit values corresponding to the selected classification mode is used as the set of N bit values in the classification rule.

其中,参考数值为预先设置的数值,第一数值阈值也为预先设置的数值。示例地,该参考数值可以为1,此时第一数值阈值可以为0.01、0.02等数值。The reference value is a preset value, and the first value threshold is also a preset value. For example, the reference value may be 1, and in this case, the first value threshold may be a value such as 0.01, 0.02, or the like.

示例地,对于步骤2024中的示例,如果得到的两个MAC地址集合包括的MAC地址的数量的比值与1之间的差值均小于0.01,表明得到的两个MAC地址集合包括的MAC地址的数量差不多,此时可以根据M个比特位中最后两个比特位确定分类规则中的比特位标识,并将表1中的第一种分类方式对应的两个比特值集合确定为分类规则中的两个比特值集合。Illustratively, for the example instep 2024, if the difference between the ratio of the number of MAC addresses included in the two obtained MAC address sets and 1 is both less than 0.01, it indicates that the MAC addresses included in the obtained two MAC address sets are less than 0.01. The number is almost the same. At this time, the bit identifier in the classification rule can be determined according to the last two bits in the M bits, and the two bit value sets corresponding to the first classification method in Table 1 can be determined as the classification rule. A set of two bit values.

相应地,在按照选择的分类方式对N个MAC地址列表中的所有MAC地址进行分类,得到N个MAC地址集合之后,当得到的任意两个MAC地址集合中包括的MAC地址的数量的比值与第一参考数值之间的差值大于或等于第一数值阈值,则重新从至少一个分类方式中选择一个分类方式,并返回执行根据多个MAC地址中每个MAC地址在选择的P个比特位上对应的组合比特值,按照重新选择的分类方式对多个MAC地址进行分类,得到N个MAC地址集合的操作,直至根据重新选择的分类方式确定分类规则。也即是,在每次选择一个分类方式之后,均按照上述步骤2024和步骤2025确定分类规则。Correspondingly, after classifying all the MAC addresses in the N MAC address lists according to the selected classification method to obtain N MAC address sets, when the ratio of the number of MAC addresses included in any two obtained MAC address sets is equal to The difference between the first reference values is greater than or equal to the first value threshold, then a classification method is re-selected from the at least one classification method, and the execution is performed according to the selected P bits of each MAC address in the multiple MAC addresses. The operation of classifying multiple MAC addresses according to the reselected classification mode to obtain N MAC address sets until the classification rule is determined according to the reselected classification mode. That is, after selecting a classification method each time, the classification rules are determined according to theabove steps 2024 and 2025 .

相应地,当按照至少一个分类方式中任一分类方式分类之后,任意两个MAC地址集合中包括的MAC地址的数量的比值与参考数值之间的差值大于或等于第一数值阈值时,从M个比特位中重新选择P个比特位,并返回执行确定多个MAC地址中每个MAC地址在重新选择的P个比特位上对应的组合比特值的操作,直至根据重新选择的P个比特位确定分类规则。也即是,在本申请实施例中,在每次选择出P个比特位之后,均按照上述步骤2023和步骤2025判断能否确定出分类规则。Correspondingly, when the difference between the ratio of the number of MAC addresses included in any two MAC address sets and the reference value is greater than or equal to the first numerical threshold after being classified according to any one of the at least one classification method, the Reselect P bits from the M bits, and return to perform the operation of determining the corresponding combined bit value of each MAC address in the plurality of MAC addresses on the reselected P bits, until the P bits are selected according to the reselected P bits. The bits determine the classification rules. That is, in this embodiment of the present application, after each selection of P bits, it is determined whether the classification rule can be determined according to theabove steps 2023 and 2025 .

相应地,当在遍历完M个比特位中的所有P个比特位之后没有确定出分类规则时,则重新设置P的数值,并返回执行步骤2021至步骤2025,直至确定出分类规则。Correspondingly, when no classification rule is determined after traversing all P bits in the M bits, the value of P is reset, andsteps 2021 to 2025 are returned to execute until the classification rule is determined.

其中,根据选择的P个比特位在M个比特位中的位置确定分类规则中的比特位标识的实现方式可以为:假设比特位标识为包括M个比特位的一串字符,此时,可以将比特位标识包括的M个比特位中在选择的P个比特位对应的比特值设置为1,其他比特位上的比特值设置为0。示例地,M为10,选择的两个比特位为第1个比特位和第3个比特位,此时,比特位标识可以表示为1010000000。Wherein, the implementation manner of determining the bit identification in the classification rule according to the positions of the selected P bits in the M bits may be: assuming that the bit identification is a string of characters including M bits, at this time, it is possible to The bit values corresponding to the selected P bits among the M bits included in the bit identifier are set to 1, and the bit values of other bits are set to 0. For example, M is 10, and the selected two bits are the first bit and the third bit. In this case, the bit identifier can be represented as 1010000000.

可选地,根据选择的P个比特位在M个比特位中的位置确定分类规则中的比特位标识的实现方式还可以为:确定选择的P个比特位中每个比特位的标识,得到P个标识,每个标识对应一个比特位,且每个标识指示对应的比特位在M个比特位上的位置,此时,可以将P个标识组合得到分类规则中的比特位标识。示例地,选择的P个比特位为第1个比特位和第3个比特位,此时比特位标识可以表示为[1,3]。当然,当比特位标识采用其他方式表示时,相应地,可以按照其他方式来确定比特位标识,在此就不一一展开说明。Optionally, the implementation of determining the bit identification in the classification rule according to the positions of the selected P bits in the M bits may also be: determine the identification of each bit in the selected P bits, and obtain There are P identifiers, each identifier corresponds to a bit, and each identifier indicates the position of the corresponding bit on the M bits. At this time, the P identifiers can be combined to obtain the bit identifier in the classification rule. For example, the selected P bits are the 1st bit and the 3rd bit, and the bit identifier can be expressed as [1, 3] in this case. Of course, when the bit identifier is represented in other manners, correspondingly, the bit identifier may be determined in other manners, which will not be described one by one here.

另外,由于网络中部署的各个BRAS的负载处理能力差不多,因此,本申请实施例中将多个MAC地址划分为N类,可以是指将多个MAC地址划分为N等份。具体应用时,可以根据各个BRAS的负载处理能力,适应性地修改将多个MAC地址划分为N类中每类包括的MAC地址的数量,以确保本申请实施例提供的负载均衡策略可以真正地实现负载均衡。In addition, since the load processing capabilities of each BRAS deployed in the network are similar, in this embodiment of the present application, dividing multiple MAC addresses into N types may refer to dividing multiple MAC addresses into N equal parts. In specific applications, according to the load processing capability of each BRAS, the number of MAC addresses included in each of the N classes can be modified adaptively to divide multiple MAC addresses into N classes, so as to ensure that the load balancing policy provided by the embodiments of the present application can truly achieve load balancing.

由于网络中部署的BRAS的数量可以为2个或者更多,下面通过以下两种场景对步骤202的实现方式进一步展开说明:Since the number of BRASs deployed in the network can be 2 or more, the implementation ofstep 202 is further described below through the following two scenarios:

场景一:网络中部署有两个BRAS。Scenario 1: Two BRASs are deployed in the network.

此时,上述步骤202的实现方式具体可以为:先将P的初始值设置为1,并通过上述步骤2021至步骤2025判断能否确定出分类规则,如果不能确定出分类规则,则重新设置P的数值,例如可以将P设置为P+1,并返回执行上述步骤2021至步骤2025,直至确定出分类规则。At this time, the implementation of the above-mentionedstep 202 may specifically be as follows: first, the initial value of P is set to 1, and through the above-mentionedsteps 2021 to 2025, it is judged whether the classification rule can be determined, and if the classification rule cannot be determined, then reset P The value of , for example, P may be set to P+1, and theabove steps 2021 to 2025 are returned to execute until the classification rule is determined.

其中,将P的初始值设置为1之后,通过上述步骤2021至步骤2025判断能否确定出分类规则的实现方式具体可以为:由于此时N为2,P为1,而1个比特位上对应的组合比特值也即是1个比特位上的比特值,因此,1个比特位对应的组合比特值要么是1,要么是0,所说义此时只有一个分类方式,然后从M个比特位中依次选择1个比特位,对选择的比特位执行以下操作:Wherein, after the initial value of P is set to 1, theabove steps 2021 to 2025 are used to determine whether the classification rule can be implemented. Specifically, since N is 2, P is 1, and 1 bit The corresponding combined bit value is also the bit value on one bit. Therefore, the combined bit value corresponding to one bit is either 1 or 0, which means that there is only one classification method at this time, and then from M Select one bit in turn from the bits, and perform the following operations on the selected bit:

确定多个MAC地址中每个MAC地址在选择的比特位上的比特值,并按照选择的比特位上的比特值为0或1的方式对所有的MAC地址进行分类,得到2个MAC地址集合,2个MAC地址集合中包括的MAC地址的数量分别称为第一数量和第二数量。如果第一数量和第二数量的比值与第一参考数值之间的差值小于第一数值阈值,此时可以根据选择的1个比特位在M个比特位中的位置确定分类规则中的比特位标识,并将0和1分别作为分类规则中的两个比特值集合中的比特值。Determine the bit value of each MAC address on the selected bit in the multiple MAC addresses, and classify all the MAC addresses according to the bit value of the selected bit to 0 or 1, and obtain 2 MAC address sets , the numbers of MAC addresses included in the two MAC address sets are respectively referred to as the first number and the second number. If the difference between the ratio of the first number and the second number and the first reference value is smaller than the first value threshold, the bits in the classification rule can be determined according to the position of the selected 1 bit in the M bits. Bit identification, and use 0 and 1 as the bit values in the two bit value sets in the classification rule, respectively.

如果第一数量和第二数量的比值与参考数值之间的差值大于或等于第一数值阈值,则重新从M个比特位中选择1个比特位,并对重新选择的比特位执行上述操作,以判断能否确定出分类规则。循环执行上述操作,以确定分类规则。If the difference between the ratio of the first number and the second number and the reference value is greater than or equal to the first value threshold, re-select 1 bit from the M bits, and perform the above operations on the re-selected bits , to judge whether the classification rules can be determined. The above operations are performed in a loop to determine the classification rules.

另外,如果遍历完M个比特位中所有的1个比特位之后,仍没有确定出分类规则,则重新设置P的数值,假如将P设置为2,此时通过上述步骤2021至步骤2025判断能否确定出分类规则。In addition, if the classification rule is still not determined after traversing all 1 bits in the M bits, the value of P is reset. If P is set to 2, then theabove steps 2021 to 2025 determine whether the No to determine the classification rules.

其中,将P设置为2之后,通过上述步骤2021至步骤2025判断能否确定出分类规则的实现方式可以为:确定将2个比特位对应的组合比特值划分为2个比特值集合的至少一个分类方式,从M个比特位中依次选择2个比特位,对选择的2个比特位执行以下操作:Wherein, after P is set to 2, the implementation manner of determining whether the classification rule can be determined through theabove steps 2021 to 2025 may be: determining that the combined bit value corresponding to 2 bits is divided into at least one of the 2 bit value sets In the classification mode, 2 bits are selected in sequence from the M bits, and the following operations are performed on the selected 2 bits:

对于获取的多个MAC地址,确定每个MAC地址在选择的2个比特位上对应的组合比特值。从至少一个分类方式中选择一个分类方式,根据多个MAC地址中每个MAC地址在选择的2个比特位上对应的组合比特值,按照选择的分类方式对多个MAC地址进行分类,得到2个MAC地址集合,2个MAC地址集合中包括的MAC地址的数量分别称为第一数量和第二数量。如果第一数量和第二数量的比值与第一参考数值之间的差值小于第一数值阈值,此时可以根据选择的2个比特位在M个比特值中的位置确定分类规则中的比特位标识,并将选择的分类方式对应的2个比特值集合作为分类规则中的两个比特值集合。For the acquired multiple MAC addresses, determine the corresponding combined bit value of each MAC address on the selected 2 bits. Select a classification method from at least one classification method, and classify the multiple MAC addresses according to the selected classification method according to the combined bit value corresponding to each MAC address in the multiple MAC addresses in the selected 2 bits, and obtain 2 There are two MAC address sets, and the numbers of MAC addresses included in the two MAC address sets are respectively referred to as a first number and a second number. If the difference between the ratio of the first number and the second number and the first reference value is less than the first value threshold, the bits in the classification rule can be determined according to the positions of the selected 2 bits in the M bit values. bit identification, and use the two bit value sets corresponding to the selected classification mode as the two bit value sets in the classification rule.

如果按照选择的分类方式分类之后的两个MAC地址集合中包括的MAC地址的数量的比值与参考数值之间的差值大于或等于第一数值阈值,则重新从M个比特位中选择2个比特位,并对重新选择的2个比特位执行上述操作,以判断能否确定出分类规则。循环执行上述操作,以确定分类规则。If the difference between the ratio of the number of MAC addresses included in the two MAC address sets after classification according to the selected classification method and the reference value is greater than or equal to the first value threshold, reselect 2 bits from the M bits bits, and perform the above operations on the reselected 2 bits to judge whether the classification rule can be determined. The above operations are performed in a loop to determine the classification rules.

另外,如果遍历完M个比特位中所有的2个比特位之后,仍没有确定出分类规则,则继续重新设置P的数值,并通过上述步骤2021至步骤2025判断能否确定出分类规则。其中,当P被重新设置为其他数值时,同样可以参考上述方式确定能否确定出分类规则,在此不再一一展开说明。In addition, if the classification rule is still not determined after traversing all 2 bits of the M bits, continue to reset the value of P, and determine whether the classification rule can be determined through theabove steps 2021 to 2025. Wherein, when P is reset to another value, it can also be determined whether the classification rule can be determined with reference to the above method, and the description will not be described one by one here.

下面以M等于48,第一参考数值为1,第一数值阈值为0.1举例说明确定场景一中的分类规则的详细过程。The detailed process of determining the classification rule in scenario 1 is exemplified below by taking M equal to 48, the first reference value being 1, and the first value threshold being 0.1.

示例地,先将P设置为1,此时可以将48个比特位的最后一位(也即第48个比特位)作为选择的比特位,将多个MAC地址按照MAC地址最后一位为0还是1的方式进行分类,得到2个MAC地址集合,两个MAC地址集合中包括的MAC地址的数量分别为第一数量和第二数量。如果第一数量和第二数量之间的比值与1之间的差值小于0.1,则表明第一数量和第二数量之间的比值接近1:1,此时可以将48个比特位中第48个比特位的标识作为分类规则中的比特位标识,并将0和1分别作为分类规则中的两个比特值集合中的比特值。For example, first set P to 1, at this time, the last bit of the 48 bits (that is, the 48th bit) can be used as the selected bit, and the last bit of the multiple MAC addresses is 0 according to the MAC address. The classification is performed in the manner of 1, and two sets of MAC addresses are obtained, and the numbers of the MAC addresses included in the two sets of MAC addresses are the first number and the second number, respectively. If the difference between the ratio between the first number and the second number and 1 is less than 0.1, it indicates that the ratio between the first number and the second number is close to 1:1, and at this time, the first number of the 48 bits can be The 48-bit identifier is used as the bit identifier in the classification rule, and 0 and 1 are respectively used as the bit value in the two bit value sets in the classification rule.

如果第一数量和第二数量之间的比值与1之间的差值大于或等于0.1,此时将48个比特位中第47位比特位作为选择的比特位,将多个MAC地址按照MAC地址第47位为0还是1的方式进行分类,得到2个MAC地址集合,两个MAC地址集合中包括的MAC地址的数量分别为第一数量和第二数量。如果第一数量和第二数量之间的比值与1之间的差值小于0.1,则表明第一数量和第二数量之间的比值接近1:1,此时可以将48个比特位中第47个比特位的标识作为分类规则中的比特位标识,并将0和1分别作为分类规则中的两个比特值集合中的比特值。依次类推,直至遍历完所有的比特位。If the difference between the ratio between the first number and the second number and 1 is greater than or equal to 0.1, the 47th bit of the 48 bits is used as the selected bit, and the multiple MAC addresses are sorted according to the MAC address. The 47th bit of the address is classified according to whether the 47th bit is 0 or 1, and two sets of MAC addresses are obtained. The numbers of MAC addresses included in the two sets of MAC addresses are the first number and the second number respectively. If the difference between the ratio between the first number and the second number and 1 is less than 0.1, it indicates that the ratio between the first number and the second number is close to 1:1, and at this time, the first number of the 48 bits can be The 47-bit identifier is used as the bit identifier in the classification rule, and 0 and 1 are respectively used as the bit value in the two bit value sets in the classification rule. And so on, until all the bits are traversed.

其中,上述M=48,N=2,P=1时确定分类规则的过程可以采用如下的算法表示:Wherein, the process of determining the classification rules when M=48, N=2, and P=1 can be expressed by the following algorithm:

For(flap=47;flap>=0;flap--){For(flap=47; flap>=0; flap--){

odd_sum←所有MAC地址中第[flap]位上的比特值为1的数量;odd_sum←The number of bits whose value is 1 in the [flap]th bit of all MAC addresses;

even_sum←所有MAC地址中第[flap]位上的比特值为0的数量;even_sum←The number of bits on the [flap]th bit of all MAC addresses whose value is 0;

if(odd_sum:even_sum接近1:1)if(odd_sum:even_sum is close to 1:1)

返回flap值,return; Return the flap value, return;

}//按照第[flap]位确定分类规则。}//According to the [flap] bit determine the classification rule.

flap表示选择的比特位在48个比特位中的位置,比如flap=47,表示选择的比特位为第48位。flap indicates the position of the selected bit in the 48 bits, for example, flap=47, indicating that the selected bit is the 48th bit.

如果按照上述方式遍历完所有的比特位之后,没有确定出分类规则,则可以将P重新设置为2。遍历48个比特位中所有可能的2个比特位,以确定分类规则。在遍历完所有的2个比特位之后,如果没有确定出分类规则,则可以将P重新设置为3,以确定分类规则。循环执行上述操作,直至确定出分类规则。其中,48个比特位中所有可能的2个比特位有1128种情况,在此不再展开说明。If no classification rule is determined after traversing all the bits in the above manner, P can be reset to 2. All possible 2 bits of the 48 bits are traversed to determine the classification rule. After traversing all 2 bits, if no classification rule is determined, P can be reset to 3 to determine the classification rule. Repeat the above operations until the classification rule is determined. Among them, there are 1128 cases of all possible 2 bits in the 48 bits, which will not be described here.

对于任意一次选择的2个比特位,从表1中选择一种分类方式,假设为第一种分类方式,将多个MAC地址按照第一种分类方式进行分类,得到两个MAC地址集合,假设第一个MAC地址集合中的MAC地址的数量为1011,第二个MAC地址集合中的MAC地址的数量为1009,两个MAC地址集合中的MAC地址的数量之间的比值接近1:1,此时可以将根据此次选择的两个比特位在48个比特位中的位置确定分类规则中的比特位标识,并将第一种分类方式对应的2个比特值集合作为分类规则中的两个比特值集合。For the 2 bits selected at any one time, select a classification method from Table 1, assuming the first classification method, and classify multiple MAC addresses according to the first classification method to obtain two sets of MAC addresses. Suppose The number of MAC addresses in the first MAC address set is 1011, the number of MAC addresses in the second MAC address set is 1009, and the ratio between the numbers of MAC addresses in the two MAC address sets is close to 1:1, At this time, the bit identifier in the classification rule can be determined according to the positions of the two bits selected this time in the 48 bits, and the two bit value sets corresponding to the first classification method can be used as the two bits in the classification rule. set of bit values.

其中,上述P=2时确定分类规则的过程可以采用如下的算法表示:Wherein, the process of determining the classification rule when P=2 can be expressed by the following algorithm:

Figure BDA0001792954790000121
Figure BDA0001792954790000121

场景二:网路中部署有3个或更多的BRAS。Scenario 2: Three or more BRASs are deployed in the network.

由于1个比特位的数值要么是0,要么是1,这种情况下,将1个比特位上的比特值是不可能划分为3类或更多类,因此,场景二中上述步骤202的实现方式具体可以为:先将P的初始值设置为2,此时通过上述步骤2021至步骤2025判断能否确定出分类规则,如果不能确定出分类规则,则重新设置P的数值,例如可以将P设置为P+1,并返回执行上述步骤2021至步骤2025,直至确定出分类规则。Since the value of 1 bit is either 0 or 1, in this case, it is impossible to divide the bit value of 1 bit into 3 or more categories. Therefore, in the second scenario, theabove step 202 The specific implementation method can be as follows: first, the initial value of P is set to 2, and at this time, it is judged whether the classification rule can be determined through theabove steps 2021 to 2025. If the classification rule cannot be determined, the value of P can be reset. P is set to P+1, and returns to execute theabove steps 2021 to 2025 until the classification rule is determined.

下面以N为3为例说明,将P设置为2之后确定分类规则的实现方式,其他情况都可以参考该实现方式,在本申请实施例中,就不一一展开说明。In the following, N is 3 as an example to illustrate, after setting P to 2, an implementation manner of the classification rule is determined. For other situations, reference may be made to this implementation manner, and in this embodiment of the present application, the description will not be provided one by one.

具体地,确定将2个比特位对应的组合比特值划分为3个比特值集合的至少一个分类方式,从M个比特位中依次选择2个比特位,对选择的2个比特位执行以下操作:Specifically, determine at least one classification method for dividing the combined bit value corresponding to 2 bits into 3 bit value sets, select 2 bits in turn from the M bits, and perform the following operations on the selected 2 bits :

对于步骤201中获取的多个MAC地址,确定每个MAC地址在选择的2个比特位上对应的组合比特值。从至少一个分类方式中选择一个分类方式,根据多个MAC地址中每个MAC地址在选择的2个比特位上对应的组合比特值,按照选择的分类方式对多个MAC地址进行分类,得到3个MAC地址集合。如果按照选择的分类方式分类之后的任意两个MAC地址集合中包括的MAC地址的数量的比值与参考数值之间的差值均小于第一数值阈值,则可以根据选择的2个比特位在M个比特位中的位置确定分类规则中的比特位标识,并将选择的分类方式对应的3个比特值集合分别作为分类规则中的3个比特值集合。For the multiple MAC addresses obtained instep 201, determine the corresponding combined bit value of each MAC address on the selected 2 bits. Select a classification method from at least one classification method, and classify the multiple MAC addresses according to the selected classification method according to the combined bit value corresponding to each MAC address in the multiple MAC addresses in the selected 2 bits, and obtain 3 A set of MAC addresses. If the difference between the ratio of the number of MAC addresses included in any two MAC address sets after the classification according to the selected classification method and the reference value is smaller than the first numerical threshold, it can be determined according to the selected 2 bits. The position of the bits determines the bit identifier in the classification rule, and the 3 bit value sets corresponding to the selected classification mode are respectively used as the 3 bit value sets in the classification rule.

如果按照任一分类方式分类之后的任意两个MAC地址集合中包括的MAC地址的数量的比值与参考数值之间的差值大于或等于第一数值阈值,则重新从M个比特位中选择2个比特位,并对选择的2个比特位执行上述操作,以确定能否确定出分类规则。循环执行上述操作,以确定分类规则。If the difference between the ratio of the number of MAC addresses included in any two MAC address sets after classification according to any classification method and the reference value is greater than or equal to the first value threshold, select 2 from the M bits again bits, and perform the above operations on the selected 2 bits to determine whether the classification rule can be determined. The above operations are performed in a loop to determine the classification rules.

例如,在选择出2个比特位之后,从表2中选择一种分类方式,假设为第一种分类方式,将多个MAC地址按照第一种分类方式进行分类,得到三个MAC地址集合,假设第一个MAC地址集合中的MAC地址的数量为1011,第二个MAC地址集合中的MAC地址的数量为1009,第三个MAC地址集合中的MAC地址的数量为1008,显然任意两个MAC地址集合中的MAC地址的数量之间的比值接近1:1,此时可以根据此次选择的两个比特位在M个比特位中的位置确定分类规则中的比特位标识,并将第一种分类方式对应的3个比特值集合作为分类规则中的3个比特值集合。如果按照表2中任一分类方式分类之后均不能确定出分类规则,则重新选择2个比特值,并返回执行从表2中选择一种分类方式的操作,以确定分类规则。For example, after selecting 2 bits, select a classification method from Table 2, assuming the first classification method, classify multiple MAC addresses according to the first classification method, and obtain three MAC address sets, Assuming that the number of MAC addresses in the first MAC address set is 1011, the number of MAC addresses in the second MAC address set is 1009, and the number of MAC addresses in the third MAC address set is 1008, obviously any two The ratio between the number of MAC addresses in the MAC address set is close to 1:1. At this time, the bit identifier in the classification rule can be determined according to the positions of the two bits selected this time in the M bits, and the first The set of 3 bit values corresponding to a classification mode is used as the set of 3 bit values in the classification rule. If no classification rule can be determined after classification according to any classification method in Table 2, 2 bit values are reselected, and the operation of selecting a classification method from Table 2 is returned to determine the classification rule.

步骤203:从分类规则包括的N个比特值集合中确定与第一BRAS对应的比特值集合,并将比特位标识和与第一BRAS对应的比特值集合作为第一BRAS的负载均衡策略,第一BRAS为N个BRAS中的一个。Step 203: Determine the bit value set corresponding to the first BRAS from the N bit value sets included in the classification rule, and use the bit identifier and the bit value set corresponding to the first BRAS as the load balancing strategy of the first BRAS. A BRAS is one of N BRASs.

其中,从分类规则包括的N个比特值集合中确定与第一BRAS对应的比特值集合的实现方式可以为:将分类规则中包括的N个比特值集合进行排序,并将N个BRAS进行排序;将第i个比特值集合作为第i个BRAS对应的比特值集合,得到与第一BRAS对应的比特值集合,i为大于等于1且小于等于N的正整数。由于第一BRAS为N个BRAS中的一个,因此通过上述步骤203可以确定出N个BRAS中每个BRAS的负载均衡策略。其中,本申请并不限定将N个数值集合进行排序,以及将N个BRAS进行排序的具体实现方式。Wherein, the implementation manner of determining the bit value set corresponding to the first BRAS from the N bit value sets included in the classification rule may be: sorting the N bit value sets included in the classification rule, and sorting the N BRASs ; Take the i-th bit value set as the bit value set corresponding to the i-th BRAS, and obtain the bit value set corresponding to the first BRAS, where i is a positive integer greater than or equal to 1 and less than or equal to N. Since the first BRAS is one of the N BRASs, the load balancing policy of each of the N BRASs can be determined through the foregoingstep 203 . Wherein, the present application does not limit the specific implementation manner of sorting N numerical sets and sorting N BRASs.

示例地,N为2,分类规则中的2个比特值集合为表1中的第一种分类方式对应的2个比特值集合,比特位标识为[47,48]。此时,将分类规则中包括的2个比特值集合进行排序,排序后的第一个比特值集合为{(1,0)},第二个比特值集合为{(0,0)、(0,1)、(1,1)}。将2个BRAS进行排序,假设排序后的2个BRAS分别为第一BRAS和第二BRAS,则将第一个比特值集合{(1,0)}作为第一BRAS对应的比特值集合,并将比特位标识[47,48]和比特值集合{(1,0)}作为第一BRAS的负载均衡策略。将第二个比特值集合{(0,0)、(0,1)、(1,1)}作为第二BRAS对应的比特值集合,并将比特位标识[47,48]和比特值集合{(0,0)、(0,1)、(1,1)}作为第二BRAS的负载均衡策略。For example, N is 2, the 2 bit value sets in the classification rule are the 2 bit value sets corresponding to the first classification manner in Table 1, and the bit identifiers are [47, 48]. At this time, the two bit value sets included in the classification rule are sorted, the first bit value set after sorting is {(1,0)}, and the second bit value set is {(0,0), ( 0,1), (1,1)}. Sort the two BRASs, assuming that the sorted two BRASs are the first BRAS and the second BRAS respectively, then the first bit value set {(1,0)} is used as the bit value set corresponding to the first BRAS, and The bit identifier [47, 48] and the set of bit values {(1, 0)} are used as the load balancing strategy of the first BRAS. Take the second bit value set {(0,0), (0,1), (1,1)} as the bit value set corresponding to the second BRAS, and set the bit identifier [47,48] and the bit value set {(0,0), (0,1), (1,1)} are used as the load balancing strategy of the second BRAS.

也即是,通过上述步骤201至步骤203确定出的负载均衡策略是:当第1个BRAS接收到用户终端的接入请求时,判断该用户终端的MAC地址的第47位比特位和第48位比特位的数值是否为(1,0),如果是,则立即响应该用户终端的接入请求,否则延迟响应该用户终端的接入请求。当第2个BRAS接收到用户终端的接入请求时,判断该用户终端的MAC地址的第47位比特位和第48位比特位的数值是否为(0,0)、(0,1)、(1,1)中任一个,如果是,则立即响应该用户终端的接入请求,否则延迟响应该用户终端的接入请求。That is, the load balancing strategy determined through theabove steps 201 to 203 is: when the first BRAS receives the access request of the user terminal, it determines the 47th bit and the 48th bit of the MAC address of the user terminal. Whether the value of the bit bit is (1, 0), if so, immediately respond to the access request of the user terminal, otherwise, delay the response to the access request of the user terminal. When the second BRAS receives the access request of the user terminal, it judges whether the value of the 47th bit and the 48th bit of the MAC address of the user terminal is (0,0), (0,1), Any one of (1, 1), if yes, respond to the access request of the user terminal immediately, otherwise delay to respond to the access request of the user terminal.

步骤204:向第一BRAS发送第一BRAS的负载均衡策略。Step 204: Send the load balancing policy of the first BRAS to the first BRAS.

由步骤201可知,负载均衡策略可以由N个BRAS中的一个BRAS制定,或者,还可以由网络控制器制定。因此,步骤204相应地也有以下两种实现方式:It can be known fromstep 201 that the load balancing policy may be formulated by one of the N BRASs, or may also be formulated by the network controller. Therefore, step 204 also has the following two implementation manners accordingly:

针对步骤201中第一种实现方式,目标BRAS在确定出各个BRAS的负载均衡策略之后,对于其他的BRAS中的第一BRAS,向第一BRAS发送第一BRAS的负载均衡策略,当第一BRAS接收到第一BRAS的负载均衡策略时,存储第一BRAS的负载均衡策略中的比特值标识和与第一BRAS对应的比特值集合,也即是在本端部署本申请实施例提供的负载均衡策略。For the first implementation instep 201, after determining the load balancing policy of each BRAS, the target BRAS sends the load balancing policy of the first BRAS to the first BRAS for the first BRAS in other BRASs. When the load balancing policy of the first BRAS is received, the bit value identifier in the load balancing policy of the first BRAS and the set of bit values corresponding to the first BRAS are stored, that is, the load balancing provided by the embodiment of the present application is deployed at the local end Strategy.

由于第一BRAS可以为除了目标BRAS之外的其他的任一BRAS,因此,通过步骤204可以使得除了目标BRAS之外的其他的任一BRAS都可以在本端部署本申请实施例提供的负载均衡策略。而目标BRAS相应地也在本端存储比特位标识和与自身对应的比特值集合,这样可以实现N个BRAS中每个BRAS的本端均部署有本申请实施例提供的负载均衡策略,以便于每个BRAS后续根据本端存储的比特位标识和与自身对应的比特值集合处理接收到的接入请求。Since the first BRAS may be any other BRAS except the target BRAS,step 204 may enable any other BRAS except the target BRAS to deploy the load balancing provided by this embodiment of the present application at the local end Strategy. The target BRAS correspondingly also stores the bit identifier and the set of bit values corresponding to itself at the local end, so that the local end of each BRAS in the N BRASs can be deployed with the load balancing strategy provided in the embodiment of the present application, so as to facilitate Each BRAS subsequently processes the received access request according to the bit identifier stored at the local end and the set of bit values corresponding to itself.

针对步骤201中第二种实现方式,网络控制器在确定出各个BRAS负载均衡策略之后,对于N个BRAS中的第一BRAS,向第一BRAS发送第一BRAS的负载均衡策略,当第一BRAS接收到第一BRAS的负载均衡策略时,存储第一BRAS的负载均衡策略中的比特值标识和与第一BRAS对应的比特值集合,也即是在本端部署本申请实施例提供的负载均衡策略。For the second implementation instep 201, after determining each BRAS load balancing policy, the network controller sends the load balancing policy of the first BRAS to the first BRAS for the first BRAS among the N BRASs. When the load balancing policy of the first BRAS is received, the bit value identifier in the load balancing policy of the first BRAS and the set of bit values corresponding to the first BRAS are stored, that is, the load balancing provided by the embodiment of the present application is deployed at the local end Strategy.

由于第一BRAS可以为N个BRAS中任一BRAS,因此,通过步骤204可以使得N个BRAS中任一BRAS都可以在本端部署本申请实施例提供的负载均衡策略,以便于每个BRAS后续根据本端存储的比特位标识和与自身对应的比特值集合处理接收到的接入请求Since the first BRAS can be any one of the N BRASs, step 204 can enable any one of the N BRASs to deploy the load balancing policy provided in this embodiment of the present application at the local end, so that each BRAS can follow Process the received access request according to the bit identifier stored at the local end and the set of bit values corresponding to itself

在本申请实施例中,获取多个MAC地址,根据多个MAC地址,确定将多个MAC地址划分为N类的分类规则,根据分类规则确定第一BRAS的负载均衡策略,并向第一BRAS发送第一BRAS的负载均衡策略。由于第一BRAS为N个BRAS中的一个,因此,通过本申请实施例提供的方法可以确定每个BRAS的负载均衡策略。由于分类规则包括比特位标识和N个比特值集合,也即是,本申请提供的负载均衡策略是根据多个MAC地址确定的,这样的话,即使MAC地址的最后一位为奇数的用户终端的数量和MAC地址的最后一位为偶数的用户终端的数量的比例与1:1相差很大,也可以根据其他的比特位制定出能够保证各个BRAS待处理的用户终端的数量分布比较均衡的负载均衡策略,提高了确定出的负载均衡策略的灵活性。进一步地,在各个BRAS根据本申请提供的负载均衡策略处理用户终端的接入请求之后,可以使得通过各个BRAS接入网络的用户终端的数量比较均匀。In the embodiment of the present application, multiple MAC addresses are acquired, a classification rule for classifying the multiple MAC addresses into N classes is determined according to the multiple MAC addresses, a load balancing policy of the first BRAS is determined according to the classification rule, and the first BRAS is sent to the first BRAS. Send the load balancing policy of the first BRAS. Since the first BRAS is one of the N BRASs, the load balancing policy of each BRAS can be determined by the method provided in the embodiment of the present application. Since the classification rule includes bit identifiers and sets of N bit values, that is, the load balancing policy provided by this application is determined based on multiple MAC addresses, so that even if the last digit of the MAC address is an odd number of user terminals The ratio between the number and the number of user terminals whose last digit of the MAC address is an even number is very different from 1:1. It is also possible to formulate a load that can ensure a balanced distribution of the number of user terminals to be processed by each BRAS according to other bits. The balancing strategy improves the flexibility of the determined load balancing strategy. Further, after each BRAS processes the access request of the user terminal according to the load balancing policy provided in the present application, the number of user terminals accessing the network through each BRAS can be made relatively uniform.

图4是本申请实施例提供的一种确定负载均衡策略的装置框图,如图4所示,该装置400包括:FIG. 4 is a block diagram of an apparatus for determining a load balancing policy provided by an embodiment of the present application. As shown in FIG. 4 , the apparatus 400 includes:

第一获取模块401,用于执行图2实施例中的步骤201;a first obtainingmodule 401, configured to performstep 201 in the embodiment of FIG. 2;

第一确定模块402,用于执行图2实施例中的步骤202;a first determiningmodule 402, configured to performstep 202 in the embodiment of FIG. 2;

第二确定模块403,用于执行图2实施例中的步骤203;Thesecond determination module 403 is configured to performstep 203 in the embodiment of FIG. 2;

发送模块404,用于执行图2实施例中的步骤204。The sendingmodule 404 is configured to performstep 204 in the embodiment of FIG. 2 .

可选地,如图5所示,第一确定模块402包括:Optionally, as shown in FIG. 5 , the first determiningmodule 402 includes:

第一确定单元4021,用于执行图3实施例中的步骤2021;a first determiningunit 4021, configured to performstep 2021 in the embodiment of FIG. 3;

选择单元4022,用于执行图3实施例中的步骤2022;aselection unit 4022, configured to performstep 2022 in the embodiment of FIG. 3;

第二确定单元4023,用于执行图3实施例中的步骤2023;The second determiningunit 4023 is configured to performstep 2023 in the embodiment of FIG. 3;

分类单元4024,用于执行图3实施例中的步骤2024;Aclassification unit 4024, configured to performstep 2024 in the embodiment of FIG. 3;

第三确定单元4025,用于执行图3实施例中的步骤2025。The third determiningunit 4025 is configured to performstep 2025 in the embodiment of FIG. 3 .

可选地,分类单元单元4024,还用于:Optionally, theclassification unit unit 4024 is also used for:

在根据多个MAC地址中每个MAC地址在选择的P个比特位上对应的组合比特值,按照选择的分类方式对多个MAC地址进行分类,得到N个MAC地址集合之后,当得到的任意两个MAC地址集合中包括的MAC地址的数量的比值与第一参考数值之间的差值大于或等于第一数值阈值,则重新从至少一个分类方式中选择一个分类方式,并返回执行根据多个MAC地址中每个MAC地址在选择的P个比特位上对应的组合比特值,按照重新选择的分类方式对多个MAC地址进行分类,得到N个MAC地址集合的操作,直至根据重新选择的分类方式确定分类规则。After classifying the multiple MAC addresses according to the selected classification method according to the combined bit value corresponding to each MAC address in the selected P bits, and obtaining N MAC address sets, when any obtained The difference between the ratio of the number of MAC addresses included in the two MAC address sets and the first reference value is greater than or equal to the first value threshold, then re-select a classification method from the at least one classification method, and return to execute the method according to the multiple classification methods. The combined bit value corresponding to each of the MAC addresses in the selected P bits, classify the multiple MAC addresses according to the re-selected classification method, and obtain N MAC address sets until the operation is based on the re-selected The classification method determines the classification rules.

可选地,选择单元4022,还用于:Optionally, theselection unit 4022 is further configured to:

当按照至少一个分类方式中任一分类方式分类之后,任意两个MAC地址集合中包括的MAC地址的数量的比值与参考数值之间的差值均大于或等于第一数值阈值,则从M个比特位中重新选择P个比特位,并返回执行对于确定多个MAC地址中每个MAC地址在重新选择的P个比特位上对应的组合比特值的操作,直至根据重新选择的P个比特位确定分类规则。When the difference between the ratio of the number of MAC addresses included in any two MAC address sets and the reference value is greater than or equal to the first numerical threshold after being classified according to any one of the at least one classification method, the M Reselect P bits from the bits, and return to perform the operation of determining the corresponding combined bit value of each MAC address in the plurality of MAC addresses on the reselected P bits, until the reselected P bits are performed. Determine classification rules.

可选地,装置400还包括:Optionally, apparatus 400 further includes:

设置模块,用于如果在遍历完M个比特位中的所有P个比特位之后没有确定出分类规则,则重新设置P的数值,并返回执行确定将P个比特位对应的组合比特值划分为N个比特值集合的至少一个分类方式的操作,直至确定出分类规则。The setting module is used to reset the value of P if the classification rule is not determined after traversing all P bits in the M bits, and return to execute the determination to divide the combined bit value corresponding to the P bits as The operation of at least one classification mode of the set of N bit values until the classification rule is determined.

可选地,装置400还包括:Optionally, apparatus 400 further includes:

第二获取模块,用于获取在第二时间段通过N个BRAS中每个BRAS接入网络的用户终端的数量,得到每个BRAS的上线用户数量;A second obtaining module, configured to obtain the number of user terminals that access the network through each of the N BRASs in the second time period, and obtain the number of online users of each BRAS;

第一获取模块,还用于如果N个BRAS中任意两个BRAS的上线用户数量的比值与第二参考数值之间的差值超过第二数值阈值,则执行获取N个MAC地址列表的操作。The first obtaining module is further configured to perform the operation of obtaining the N MAC address lists if the difference between the ratio of the number of online users of any two BRASs in the N BRASs and the second reference value exceeds the second numerical threshold.

在本申请实施例中,获取多个MAC地址,根据多个MAC地址,确定将多个MAC地址划分为N类的分类规则,根据分类规则确定第一BRAS的负载均衡策略,并向第一BRAS发送第一BRAS的负载均衡策略。由于第一BRAS为N个BRAS中的一个,因此,通过本申请实施例提供的方法可以确定每个BRAS的负载均衡策略。由于分类规则包括比特位标识和N个比特值集合,也即是,本申请提供的负载均衡策略是根据多个MAC地址确定的,这样的话,即使MAC地址的最后一位为奇数的用户终端的数量和MAC地址的最后一位为偶数的用户终端的数量的比例与1:1相差很大,也可以根据其他的比特位制定出能够保证各个BRAS待处理的用户终端的数量分布比较均衡的负载均衡策略,提高了确定出的负载均衡策略的灵活性。进一步地,在各个BRAS根据本申请提供的负载均衡策略处理用户终端的接入请求之后,可以使得通过各个BRAS接入网络的用户终端的数量比较均匀。In the embodiment of the present application, multiple MAC addresses are acquired, a classification rule for classifying the multiple MAC addresses into N classes is determined according to the multiple MAC addresses, a load balancing policy of the first BRAS is determined according to the classification rule, and the first BRAS is sent to the first BRAS. Send the load balancing policy of the first BRAS. Since the first BRAS is one of the N BRASs, the load balancing policy of each BRAS can be determined by the method provided in the embodiment of the present application. Since the classification rule includes bit identifiers and sets of N bit values, that is, the load balancing policy provided by this application is determined based on multiple MAC addresses, so that even if the last digit of the MAC address is an odd number of user terminals The ratio between the number and the number of user terminals whose last digit of the MAC address is an even number is very different from 1:1. It is also possible to formulate a load that can ensure a balanced distribution of the number of user terminals to be processed by each BRAS according to other bits. The balancing strategy improves the flexibility of the determined load balancing strategy. Further, after each BRAS processes the access request of the user terminal according to the load balancing policy provided in the present application, the number of user terminals accessing the network through each BRAS can be made relatively uniform.

需要说明的是:上述实施例提供的确定负载均衡策略的装置在确定负载均衡策略时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的确定负载均衡策略的装置与确定负载均衡策略的方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that: when the device for determining a load balancing strategy provided in the above embodiment determines the load balancing strategy, only the division of the above functional modules is used as an example for illustration. In practical applications, the above functions can be allocated by different The function module is completed, that is, the internal structure of the device is divided into different function modules, so as to complete all or part of the functions described above. In addition, the device for determining a load balancing policy provided in the above embodiment and the method embodiment for determining a load balancing policy belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

图6是本申请实施例提供的一种网络设备的结构示意图。图1的BRAS或网络控制器可以通过图6所示的网络设备来实现。参见图6,该网络设备包括至少一个处理器601,通信总线602、存储器603以及至少一个通信接口604。FIG. 6 is a schematic structural diagram of a network device provided by an embodiment of the present application. The BRAS or network controller of FIG. 1 may be implemented by the network device shown in FIG. 6 . Referring to FIG. 6 , the network device includes at least oneprocessor 601 , acommunication bus 602 , amemory 603 and at least onecommunication interface 604 .

处理器601可以是一个通用中央处理器(Central Processing Unit,CPU)、微处理器、特定应用集成电路(application-specific integrated circuit,ASIC)或一个或多个用于控制本申请方案程序执行的集成电路。Theprocessor 601 may be a general-purpose central processing unit (Central Processing Unit, CPU), a microprocessor, an application-specific integrated circuit (application-specific integrated circuit, ASIC), or one or more integrated circuits for controlling the execution of programs in the present application. circuit.

通信总线602可包括一通路,在上述组件之间传送信息。Communication bus 602 may include a path to communicate information between the above-described components.

存储器603可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其它类型的静态存储设备,随机存取存储器(random access memory,RAM)或者可存储信息和指令的其它类型的动态存储设备,也可以是电可擦可编程只读存储器(ElectricallyErasable Programmable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)或其它光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其它磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其它介质,但不限于此。存储器603可以是独立存在,通过通信总线602与处理器601相连接。存储器603也可以和处理器601集成在一起。Memory 603 may be read-only memory (ROM) or other type of static storage device that can store static information and instructions, random access memory (RAM), or other type of static storage device that can store information and instructions It can also be an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, optical disk storage ( including compact discs, laser discs, compact discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or capable of carrying or storing desired program code in the form of instructions or data structures and capable of being stored by a computer any other medium taken, but not limited to this. Thememory 603 can exist independently and is connected to theprocessor 601 through thecommunication bus 602 . Thememory 603 may also be integrated with theprocessor 601 .

通信接口604,使用任何收发器一类的装置,用于与其它设备或通信网络通信,如以太网,无线接入网(RAN),无线局域网(Wireless Local Area Networks,WLAN)等。Thecommunication interface 604, using any device such as a transceiver, is used to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN) and the like.

在具体实现中,作为一种实施例,网络设备可以包括多个处理器,例如图6中所示的处理器601和处理器605。这些处理器中的每一个可以是一个单核(single-CPU)处理器,也可以是一个多核(multi-CPU)处理器。这里的处理器可以指一个或多个设备、电路、和/或用于处理数据(例如计算机程序指令)的处理核。In a specific implementation, as an embodiment, the network device may include multiple processors, such as theprocessor 601 and theprocessor 605 shown in FIG. 6 . Each of these processors can be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (eg, computer program instructions).

在具体实现中,作为一种实施例,网络设备还可以包括输出设备606和输入设备607。输出设备606和处理器601通信,可以以多种方式来显示信息。例如,输出设备606可以是液晶显示器(liquid crystal display,LCD)、发光二级管(light emitting diode,LED)显示设备、阴极射线管(cathode ray tube,CRT)显示设备或投影仪(projector)等。输入设备607和处理器601通信,可以以多种方式接收用户的输入。例如,输入设备607可以是鼠标、键盘、触摸屏设备或传感设备等。In a specific implementation, as an embodiment, the network device may further include anoutput device 606 and aninput device 607 . Theoutput device 606 is in communication with theprocessor 601 and can display information in a variety of ways. For example, theoutput device 606 may be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, a projector, or the like .Input device 607 is in communication withprocessor 601 and can receive user input in a variety of ways. For example, theinput device 607 may be a mouse, a keyboard, a touch screen device, a sensor device, or the like.

上述的网络设备可以是一个通用网络设备或者是一个专用网络设备。在具体实现中,网络设备可以是台式机、便携式电脑、网络服务器、掌上电脑(Personal DigitalAssistant,PDA)、移动手机、平板电脑、无线终端设备、通信设备或者嵌入式设备。本申请实施例不限定网络设备的类型。The above-mentioned network device may be a general network device or a dedicated network device. In a specific implementation, the network device may be a desktop computer, a portable computer, a network server, a PDA (Personal Digital Assistant, PDA), a mobile phone, a tablet computer, a wireless terminal device, a communication device, or an embedded device. The embodiments of the present application do not limit the types of network devices.

其中,存储器603用于存储执行本申请方案的程序代码,并由处理器601来控制执行。处理器601用于执行存储器603中存储的程序代码。程序代码中可以包括一个或多个软件模块。图1中所示的BRAS或网络控制器可以通过处理器601以及存储器603中的程序代码中的一个或多个软件模块,来确定用于开发应用的数据。Wherein, thememory 603 is used for storing the program code for executing the solution of the present application, and the execution is controlled by theprocessor 601 . Theprocessor 601 is used to execute program codes stored in thememory 603 . One or more software modules may be included in the program code. The BRAS or network controller shown in FIG. 1 may determine data for developing an application throughprocessor 601 and one or more software modules in program code inmemory 603 .

在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意结合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如:同轴电缆、光纤、数据用户线(Digital Subscriber Line,DSL))或无线(例如:红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如:软盘、硬盘、磁带)、光介质(例如:数字通用光盘(Digital Versatile Disc,DVD))、或者半导体介质(例如:固态硬盘(Solid State Disk,SSD))等。In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented in software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer may be a general purpose computer, special purpose computer, computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server or data center Transmission is performed to another website site, computer, server or data center by wire (eg coaxial cable, optical fiber, Digital Subscriber Line, DSL) or wireless (eg infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes an integration of one or more available media. The usable media may be magnetic media (eg: floppy disk, hard disk, magnetic tape), optical media (eg: Digital Versatile Disc (DVD)), or semiconductor media (eg: Solid State Disk (SSD)) )Wait.

本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps of implementing the above embodiments can be completed by hardware, or can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium. The storage medium mentioned may be a read-only memory, a magnetic disk or an optical disk, etc.

以上所述为本申请提供的实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above-mentioned examples provided for this application are not intended to limit this application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this application shall be included in the protection scope of this application. Inside.

Claims (14)

1. A method of determining a load balancing policy, the method performed by an apparatus for determining a load balancing policy, the method comprising:
acquiring a plurality of MAC addresses, wherein the MAC addresses comprise MAC addresses of user terminals accessing a network through any BRAS of N BRASs in a first time period, N is a positive integer greater than or equal to 2, each MAC address in the MAC addresses comprises M bits, and M is a positive integer greater than or equal to 1;
determining, from the plurality of MAC addresses, a classification rule that divides the plurality of MAC addresses into N classes, the classification rule including a bit identification for classification and N sets of bit values, the bit identification indicating a position of at least one bit for classification among the M bits, the at least one bit corresponding to a plurality of combined bit values, the classification rule including N sets of bit values each including at least one of the plurality of combined bit values;
determining a bit value set corresponding to a first BRAS from N bit value sets included in the classification rule, and using the bit identification and the bit value set corresponding to the first BRAS as a load balancing strategy of the first BRAS, wherein the first BRAS is one of the N BRASs;
and sending the load balancing strategy of the first BRAS to the first BRAS.
2. The method of claim 1, wherein determining a classification rule that divides the plurality of MAC addresses into N classes based on the plurality of MAC addresses comprises:
determining at least one classification mode for dividing combined bit values corresponding to P bits into N bit value sets, wherein P is a positive integer greater than or equal to 1, and the number of the combined bit values corresponding to the P bits is greater than or equal to N;
selecting P bits from the M bits;
determining a corresponding combined bit value of each MAC address in the plurality of MAC addresses on the selected P bits;
selecting one classification mode from the at least one classification mode, and classifying the multiple MAC addresses according to the selected classification mode according to the combined bit value corresponding to each MAC address in the multiple MAC addresses on the selected P bit positions to obtain N MAC address sets;
when the obtained difference value between the ratio of the number of the MAC addresses in any two MAC address sets and a first reference value is smaller than a first value threshold value, determining bit identification in the classification rule according to the positions of the selected P bits in the M bits, and taking N bit value sets corresponding to the selected classification mode as N bit value sets in the classification rule.
3. The method of claim 2, wherein after classifying the plurality of MAC addresses according to the selected classification manner based on the combined bit value corresponding to each MAC address in the plurality of MAC addresses over the selected P bits to obtain N MAC address sets, the method further comprises:
and when the difference value between the obtained ratio of the number of the MAC addresses in any two MAC address sets and the first reference value is larger than or equal to a first value threshold value, reselecting one classification mode from the at least one classification mode, returning to execute a combined bit value corresponding to each MAC address in the plurality of MAC addresses on the selected P bits, classifying the plurality of MAC addresses according to the reselected classification mode to obtain N MAC address sets, and determining a classification rule according to the reselected classification mode.
4. The method of claim 2 or 3, wherein the determining the corresponding combined bit value for each of the plurality of MAC addresses over the selected P bits further comprises:
and after the MAC addresses are classified according to any one of the at least one classification mode, when the difference value between the ratio of the number of the MAC addresses in any two MAC address sets and a first reference value is larger than or equal to a first value threshold, reselecting P bits from the M bits, and returning to execute the operation of determining the corresponding combined bit value of each MAC address in the plurality of MAC addresses on the reselected P bits until a classification rule is determined according to the reselected P bits.
5. The method of claim 4, wherein the method further comprises:
when the classification rule is not determined after all P bits in the M bits are traversed, resetting the value of P, and returning to execute the operation of determining at least one classification mode for dividing the combined bit value corresponding to the P bits into N bit value sets until the classification rule is determined.
6. The method of any of claims 1 to 5, wherein prior to obtaining the plurality of MAC addresses, further comprising:
acquiring the number of user terminals accessing the network through each BRAS in the N BRASs in a second time period to obtain the number of online users of each BRAS;
and when the difference value between the ratio of the number of the on-line users of any two BRASs in the N BRASs and a second reference value exceeds a second value threshold, executing the operation of acquiring a plurality of MAC addresses.
7. An apparatus for determining a load balancing policy, the apparatus comprising:
a first obtaining module, configured to obtain multiple MAC addresses, where the multiple MAC addresses include MAC addresses of user terminals that access a network through any one of N BRAS in a first time period, where N is a positive integer greater than or equal to 2, each MAC address in the multiple MAC addresses includes M bits, and M is a positive integer greater than or equal to 1;
a first determining module, configured to determine, according to the plurality of MAC addresses, a classification rule that divides the plurality of MAC addresses into N classes, where the classification rule includes a bit identification for classification and N bit value sets, where the bit identification indicates a position of at least one bit for classification among the M bits, the at least one bit corresponds to a plurality of combined bit values, and each bit value set of the N bit value sets includes at least one of the plurality of combined bit values;
a second determining module, configured to determine, from N bit value sets included in the classification rule, a bit value set corresponding to a first BRAS, and use the bit identifier and the bit value set corresponding to the first BRAS as a load balancing policy of the first BRAS, where the first BRAS is one of the N BRASs;
and the sending module is used for sending the load balancing strategy of the first BRAS to the first BRAS.
8. The apparatus of claim 7, wherein the first determining module comprises:
a first determining unit, configured to determine at least one classification manner for dividing combined bit values corresponding to P bits into N bit value sets, where P is a positive integer greater than or equal to 1, and the number of combined bit values corresponding to the P bits is greater than or equal to N;
a selection unit for selecting P bits from the M bits;
a second determining unit, configured to determine a corresponding combined bit value of each MAC address in the plurality of MAC addresses over the selected P bits;
a classifying unit, configured to select a classifying manner from the at least one classifying manner, and classify the multiple MAC addresses according to the selected classifying manner according to a combined bit value corresponding to each MAC address in the multiple MAC addresses on the selected P bits, so as to obtain N MAC address sets;
a third determining unit, configured to determine, when the obtained difference between the ratio of the number of MAC addresses included in any two MAC address sets and the first reference value is smaller than a first value threshold, a bit identifier in the classification rule according to the positions of the selected P bits in the M bits, and use N bit value sets corresponding to the selected classification manner as N bit value sets in the classification rule.
9. The apparatus of claim 8, wherein the classification unit is further configured to:
and when the difference value between the obtained ratio of the number of the MAC addresses in any two MAC address sets and the first reference value is larger than or equal to a first value threshold value, reselecting one classification mode from the at least one classification mode, returning to execute a combined bit value corresponding to each MAC address in the plurality of MAC addresses on the selected P bits, classifying the plurality of MAC addresses according to the reselected classification mode to obtain N MAC address sets, and determining a classification rule according to the reselected classification mode.
10. The apparatus according to claim 8 or 9, wherein the selecting unit is further configured to:
and after the MAC addresses are classified according to any one of the at least one classification mode, when the difference value between the ratio of the number of the MAC addresses in any two MAC address sets and a first reference value is larger than or equal to a first value threshold, reselecting P bits from the M bits, and returning to execute the operation of determining the corresponding combined bit value of each MAC address in the plurality of MAC addresses on the reselected P bits until a classification rule is determined according to the reselected P bits.
11. The apparatus of claim 10, wherein the apparatus further comprises:
and the setting module is used for resetting the value of P when the classification rule is not determined after all P bits in the M bits are traversed, and returning to execute the operation of determining at least one classification mode for dividing the combined bit value corresponding to the P bits into N bit value sets until the classification rule is determined.
12. The apparatus of any of claims 7 to 11, further comprising:
a second obtaining module, configured to obtain the number of user terminals accessing the network through each BRAS in the N BRASs in a second time period, to obtain the number of online users of each BRAS;
the first obtaining module is further configured to execute an operation of obtaining a plurality of MAC addresses when a difference between a ratio of the number of online users of any two of the N BRASs and a second reference value exceeds a second value threshold.
13. An apparatus for determining a load balancing policy, the apparatus comprising a processor and a memory;
the memory is for storing a program that enables the apparatus to perform the method of any one of claims 1 to 6;
the processor is configured to execute programs stored in the memory.
14. A computer-readable storage medium having stored therein instructions which, when executed on a computer, cause the computer to perform the method of any one of claims 1 to 6.
CN201811044541.9A2018-09-072018-09-07Method, device and storage medium for determining load balancing strategyActiveCN110891028B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201811044541.9ACN110891028B (en)2018-09-072018-09-07Method, device and storage medium for determining load balancing strategy

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201811044541.9ACN110891028B (en)2018-09-072018-09-07Method, device and storage medium for determining load balancing strategy

Publications (2)

Publication NumberPublication Date
CN110891028Atrue CN110891028A (en)2020-03-17
CN110891028B CN110891028B (en)2021-12-21

Family

ID=69744641

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201811044541.9AActiveCN110891028B (en)2018-09-072018-09-07Method, device and storage medium for determining load balancing strategy

Country Status (1)

CountryLink
CN (1)CN110891028B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN102187627A (en)*2011-04-252011-09-14华为技术有限公司Method, device and broadband access server system for load share
CN103346950A (en)*2013-07-292013-10-09北京傲天动联技术股份有限公司Sharing method and device of load between user service boards of rack-mounted wireless controller
CN105634956A (en)*2015-12-312016-06-01华为技术有限公司Message forwarding method, device and system
CN106060186A (en)*2016-05-252016-10-26杭州迪普科技有限公司Message processing method and device
CN106936729A (en)*2015-12-292017-07-07中国电信股份有限公司Control method, system and broadband access network system that a kind of terminal device is accessed
CN107819602A (en)*2016-09-142018-03-20中国电信股份有限公司Customer flow distribution method and system
WO2018077184A1 (en)*2016-10-262018-05-03新华三技术有限公司Traffic scheduling

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN102187627A (en)*2011-04-252011-09-14华为技术有限公司Method, device and broadband access server system for load share
CN103346950A (en)*2013-07-292013-10-09北京傲天动联技术股份有限公司Sharing method and device of load between user service boards of rack-mounted wireless controller
CN106936729A (en)*2015-12-292017-07-07中国电信股份有限公司Control method, system and broadband access network system that a kind of terminal device is accessed
CN105634956A (en)*2015-12-312016-06-01华为技术有限公司Message forwarding method, device and system
CN106060186A (en)*2016-05-252016-10-26杭州迪普科技有限公司Message processing method and device
CN107819602A (en)*2016-09-142018-03-20中国电信股份有限公司Customer flow distribution method and system
WO2018077184A1 (en)*2016-10-262018-05-03新华三技术有限公司Traffic scheduling

Also Published As

Publication numberPublication date
CN110891028B (en)2021-12-21

Similar Documents

PublicationPublication DateTitle
US10932212B2 (en)Parent node selection method and network node
CN110621045B (en)Method for service routing of Internet of things
US10419531B2 (en)Method for setting gateway device identity, and management gateway device
WO2020043208A1 (en)Network slice selection method, device and system
WO2019200714A1 (en)Server connection method, computer readable storage medium, terminal device, and apparatus
CN112311674B (en)Message sending method, device and storage medium
WO2022127475A1 (en)Data transmission method and apparatus, electronic device, and storage medium
CN113691575B (en) Communication method, device and system
CN106534301A (en)Method and device for balancing network outbound load
CN112314003A (en)Cellular telecommunications network comprising a plurality of network slices
CN105722040B (en) Method, device and system for transmitting business messages
CN105744593B (en) A node network access method and device
US7477630B2 (en)Transmission controller used in media access control processing apparatus and transmission controlling method thereof
CN116112572A (en)Service processing method, device, network equipment and storage medium
CN114595167A (en) Distributed cache system, method and device
CN111488515A (en)Information query method, device, equipment and storage medium
US12218842B2 (en)Data communication method, server device, client device and medium
CN112019492B (en) Access control method, device and storage medium
WO2018188570A1 (en)Data transmission method and apparatus
CN116015583A (en)Automatic AP channel adjustment method, device, equipment and medium
CN115334146A (en)Resource publishing method, device, equipment and storage medium of Internet of things
US11924738B1 (en)Managing connections in a mesh network having multiple provisioner devices
CN112242908B (en) A network function deployment method, system and storage medium
CN110891028B (en)Method, device and storage medium for determining load balancing strategy
CN116669150A (en)Star-ground fusion network selection method and device and computer readable storage medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp