Data batch preparation method and device
By introducing a time-sharing batch backup mechanism in the transition and control separation scenario, the pressure problem of multiple BRAS-VMs on the network and database when batch backup user information to the redis database is solved, and the system is stable and efficient.
Patent Information
- Application Number
- CN202111246966.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-26
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2041-10-26
AI Technical Summary
In the transition control separation scenario, when multiple BRAS-VMs batch backup user information to the redis database at the same time, it will cause huge pressure on the network and redis database, resulting in link sub-health status and database response delay.
A time-sharing batch preparation mechanism is introduced, and by receiving the ongoing messages or preparing messages sent by other service modules in the first channel, it is determined whether the batch processing is currently performed. The specific steps include receiving messages, judging whether the number reaches the batch threshold, and performing batch processing when the threshold is not reached.
Through the time-sharing batch backup mechanism, the pressure on the network and redis database when a large number of BRAS-VMs are avoided when batch processing is performed simultaneously, ensuring the stability and response performance of the system.
Smart Images

Figure CN113961396B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a data batch preparation method and device. Background Art
[0002] In the scenario of separation of transfer and control, redis is usually used as a database to save user information, such as Figure 1 As shown, Figure 1 This is the networking diagram for the existing forwarding and control separation scenario.
[0003] exist Figure 1 In the process of separating forwarding and control, after the user traffic reaches the forwarding device (i.e., UP device) in the forwarding and control separation, the UP device sends the user traffic to the gateway (English: Gate Way, abbreviated as: GW). After receiving the user traffic, the gateway sends the user traffic to the control device (i.e., CP device) in the forwarding and control separation. Figure 1 All virtual machines in the middle virtual box act as a whole, namely, CP devices, and jointly complete control functions, including authentication, authorization, and billing operations for user terminals.
[0004] After receiving the user traffic, the forwarding virtual machine (FWD-VM) sends the user traffic sent by different UP devices to the corresponding BRAS-VM for processing according to the diversion configuration issued by the control virtual machine (CTRL-VM) in the CP device. After the user terminal successfully goes online, the user information of the user terminal will be stored in the BRAS-VM for subsequent offline and billing processing of the user terminal.
[0005] When the database function is enabled on the BRAS-VM, the BRAS-VM stores user information in the redis database in real time. If the BRAS-VM is restarted, it can obtain user information from the redis database and restore the user information to the memory. In this way, the user terminal does not need to go online again and does not need to detect whether the BRAS-VM has failed.
[0006] Currently, BRAS-VM can store user information in the redis database through real-time backup or batch backup. Real-time backup means that BRAS-VM writes user information to the redis database in real time during the connection between BRAS-VM and the redis database; batch backup means that BRAS-VM writes all user information in memory to the redis database when the connection between BRAS-VM and the redis database is reestablished.
[0007] In actual applications, multiple BRAS-VMs will store user information of tens of millions of users. When the Virtualized Network Function Manager (VNFM) sends a redis database enablement configuration to each BRAS-VM, each BRAS-VM is ready to perform batch backup of user information to the redis database. At this time, the user information of tens of millions of users will be stored in the redis database. Alternatively, when the network where the BRAS-VM is located fluctuates, a large number of BRAS-VMs will write user information to the redis database at the same time.
[0008] In the process of the aforementioned BRAS-VM backing up user information in batches to the redis database, the following problems will also arise: 1) When all BRAS-VMs perform batch backup of user information, packets sent by BRAS-VM and FWD-VM will be lost, causing the links between VMs in the CP device to be in a sub-healthy state; 2) A large amount of user information is written in an instant, and the redis database is under too much pressure, causing the redis database to be unable to respond to the real-time write needs of the BRAS-VM. Summary of the invention
[0009] In view of this, the present application provides a data batch backup method and device to solve the problem in the existing solution that when a large number of BRAS-VMs simultaneously back up user information to the redis database in batches, it will cause huge pressure on the network and the redis database.
[0010] In a first aspect, the present application provides a data batch preparation method, the method is applied to a first service module, the first service module is in a first BRAS-VM in a CP device, the CP device also includes a plurality of second BRAS-VMs, each second BRAS-VM includes a second service module, the first service module has subscribed to a first channel, the method includes:
[0011] When the first service module has been configured with redis database enablement or network oscillation, receiving batch backup messages or batch backup preparation messages sent by multiple second service modules in the first channel;
[0012] Within a first preset time, determining whether a first number of received batch preparation messages has reached a first preparation threshold;
[0013] If the first number does not reach the first preparation threshold, determining whether a second number of received batch preparation messages has reached a second batch preparation threshold, where the second batch preparation threshold is a difference between the first preparation threshold and the first number;
[0014] If the second number does not reach the second batch backup threshold, batch backup processing of the user information is performed on the redis database.
[0015] In a second aspect, the present application provides a data batch preparation device, the device is applied to a first service module, the first service module is in a first BRAS-VM in a CP device, the CP device also includes a plurality of second BRAS-VMs, each second BRAS-VM includes a second service module, the first service module has subscribed to a first channel, and the device includes:
[0016] A receiving unit, configured to receive batch preparation messages or batch preparation messages sent by multiple second business modules in the first channel when the first business module has been configured with redis database enablement or network oscillation;
[0017] A first judging unit, configured to judge, within a first preset time, whether a first number of received batch preparation messages has reached a first preparation threshold;
[0018] a second judgment unit, configured to judge whether a second number of received batch preparation messages has reached a second batch preparation threshold if the first number has not reached the first batch preparation threshold, where the second batch preparation threshold is a difference between the first batch preparation threshold and the first number;
[0019] The batch backup unit is used to perform batch backup processing of user information to the redis database if the second number does not reach the second batch backup threshold.
[0020] In a third aspect, the present application provides a network device, including a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to execute the method provided in the first aspect of the present application.
[0021] Therefore, by applying the data batch backup method and device provided by the present application, when the first business module has configured the redis database to enable or the network oscillates, in the first channel, the first business module receives batch backup messages or batch backup preparation messages sent by multiple second business modules; within the first preset time, the first business module determines whether the first number of received batch backup messages has reached the first batch backup threshold; if the first number does not reach the first batch backup threshold, the first business module determines whether the second number of received batch backup preparation messages has reached the second batch backup threshold, wherein the second batch backup threshold is the difference between the first batch backup threshold and the first number; if the second number does not reach the second batch backup threshold, the first business module performs batch backup processing of user information to the redis database.
[0022] In this way, when multiple BRAS-VMs simultaneously back up user information to the redis database in batches, a time-sharing batch backup mechanism is introduced. Through the batch backup message or batch backup preparation message sent by other business modules, any business module can determine whether to perform batch backup processing at the moment. This solves the problem in the existing solution that when a large number of BRAS-VMs perform batch backup processing at the same time, it puts huge pressure on the network and redis database. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 This is the network diagram for the existing transfer and control separation scenario;
[0024] Figure 2 A flowchart of a data batch preparation method provided in an embodiment of the present application;
[0025] Figure 3 A structural diagram of a data batch preparation device provided in an embodiment of the present application;
[0026] Figure 4 The network device hardware structure provided in the embodiment of the present application. DETAILED DESCRIPTION
[0027] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0028] The terms used in this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more corresponding listed items.
[0029] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0030] The data batch preparation method provided in the embodiment of the present application is described in detail below. Figure 2 , Figure 2 Flow chart of the data batch preparation method provided in the embodiment of the present application. The method is applied to the first business module. The data batch preparation method provided in the embodiment of the present application may include the following steps.
[0031] Step 210: When the first service module has been configured with redis database enablement or network oscillation, batch backup messages or batch backup preparation messages sent by multiple second service modules are received in the first channel.
[0032] Specifically, the first service module is in a first BRAS-VM in the CP device. The first service module has subscribed to a first channel. The CP device also includes a plurality of second BRAS-VMs, each of which includes a second service module. The second service module and the first service module may be modules that process the same service (e.g., user connection management service).
[0033] When the first business module has configured redis database enablement or network oscillation, the first business module pre-batch backup processing of user information to the redis database. At this time, in the first channel, the first business module receives batch backup messages or batch backup preparation messages sent by multiple second business modules.
[0034] Further, in the embodiment of the present application, the CP device further includes a third BRAS-VM, and the third BRAS-VM includes a third service module. The third service module and the first service module and the second service module may be modules for processing the same service. The third BRAS-VM may be a BRAS-VM among the multiple second BRAS-VMs, and the third service module may also be a service module among the multiple second service modules.
[0035] It is understandable that the business module processing the same business is concerned with whether other business modules are currently performing batch preparation or are currently preparing for batch preparation, so as to avoid performing batch preparation of user information at the same time.
[0036] After the third business module establishes a connection with the redis database, a subscription message is sent to the redis database, the subscription message including the module name of the third business module. The subscription message is used to subscribe to the first channel, the channel name of the first channel is the module name of the third business module.
[0037] Furthermore, the process of the third business module sending a subscription message to the redis database is specifically as follows: the third business module initializes its own RMDB Lib, and informs RMDB Lib that it is ready to perform batch backup processing of user information to the redis database.
[0038] After RMDB Lib determines that the third business module is ready to perform batch backup processing of user information to the redis database, RMDB Lib uses the module name of the third business module and the redis database to create the first channel and subscribe to the first channel. For example, the module name of the third business module is user connection management (English: user connection manage, abbreviated as: ucm), RMDB Lib uses ucm and the redis database to create the first channel, and ucm is the channel name of the first channel.
[0039] After the third business module creates the first channel, other business modules related to or with the same business as the third business module are concerned about the messages published in the first channel, and the first business module is used as an example for explanation. Before this step, after the first business module establishes a connection with the redis database, when preparing for batch backup, a subscription message will be sent to the redis database, and the subscription message includes the channel name of the first channel (the module name of the first business module is used as the subscription channel name). After the first business module sends the subscription message, the subscription to the first channel is realized, and the batch backup messages or batch backup messages sent by other business modules (for example, the second business module and the third business module) in the first channel can be received by the first business module.
[0040] Similarly, other second service modules in the second service module except the third service module also subscribe to the first channel.
[0041] It should be noted that the service modules that are related to or have the same service have mutually agreed on the naming rules of the channel names before subscription.
[0042] For example, the module name of the service module is used as the channel name. If the module name of the service module is long, such as "aaaastring1aaaa", it can be expressed in abbreviated form when subscribing, replacing the same number of characters before and after with "*", and retaining the middle characters, "*string1*". The abbreviated string should uniquely represent a type of service and should not be the same as the module name string of other service modules or the abbreviated string.
[0043] Alternatively, each service module agrees on a fixed number or identifier as the channel name. The numbers or identifiers of different services are unique and are not the same as the numbers or identifiers of other services.
[0044] Furthermore, after the first service module subscribes to the first channel, the first service module sends a first batch preparation message in the first channel at a third preset time interval. The first batch preparation message is used to enable other service modules that have subscribed to the first channel to receive the message and determine that the first service module pre-batch prepares user information to the redis database.
[0045] The first preparation batch standby message includes a first slot identification value. The first slot identification value is a slot identification value of a first BRAS-VM where the first service module is located. The third preset time is specifically 1 second.
[0046] Step 220: within a first preset time, determine whether a first number of received batch backup messages has reached a first backup threshold.
[0047] Specifically, according to the description of step 210, in the first channel, after the first service module receives the batch preparation messages or the batch preparation messages sent by the plurality of second service modules, it determines whether the first number of the received batch preparation messages has reached the first preparation threshold within the first preset time. The first preset time is specifically 3 seconds.
[0048] If the first number does not reach the first batch backup threshold, the first business module executes step 230; if the first number reaches the first batch backup threshold, the first business module does not perform batch backup processing of user information to the redis database, and repeats steps 210 and 220.
[0049] Further, in the embodiment of the present application, the server where the redis database is located will set a first batch backup threshold before each business module performs batch backup processing of user information. The first batch backup threshold is the maximum value of the business modules that can currently perform batch backup processing of user information to the redis database at the same time.
[0050] For example, if the first batch backup threshold is 5, the maximum number of business modules that can perform batch backup processing of user information to the redis database at the same time is 5.
[0051] It is understandable that if the first number does not reach the first backup threshold, the first business module determines that the business modules currently performing batch backup processing of user information to the redis database have not reached the maximum value, that is, the batch backup quota is not full. For example, if the first number is 3, the first business module determines that there are currently 3 business modules performing batch backup processing of user information to the redis database. At this time, the first business module executes step 230.
[0052] If the first number reaches the first backup threshold, the first business module determines that the business modules currently performing batch backup processing of user information to the redis database have reached the maximum value, that is, the batch backup quota is full. For example, if the first number is 5, the first business module determines that there are currently 5 business modules performing batch backup processing of user information to the redis database. At this time, the first business module does not perform batch backup processing of user information to the redis database, and repeats step 210 and step 220.
[0053] Step 230: If the first number does not reach the first preparation threshold, determine whether the second number of received batch preparation messages has reached a second batch preparation threshold, where the second batch preparation threshold is the difference between the first preparation threshold and the first number.
[0054] Specifically, according to the description of step 220, if the first number does not reach the first preparation threshold, the first business module determines whether the second number of received preparation batch preparation messages has reached the second preparation threshold, which is the difference between the first preparation threshold and the first number.
[0055] If the second number does not reach the second batch backup threshold, the first service module executes step 240 .
[0056] If the second number reaches the second batch preparation threshold, the first service module obtains the first slot identification value of the first BRAS-VM where the first service module is located, and obtains the slot identification value from each batch preparation message.
[0057] It can be understood that the slot identification value included in the prepare batch standby message is the slot identification value of the BRAS-VM where the service module sending the prepare batch standby message is located.
[0058] The first service module sorts the obtained multiple slot identification values from large to small. Starting from the first slot identification value of the sorting result, the first service module obtains a third number of slot identification values, where the third number is equal to the second batch backup threshold.
[0059] If the first slot identification value is within the third number of slot identification values, the first business module performs batch preparation of user information to the redis database. At the same time, every second preset time, in the first channel, the first business module sends a first batch preparation message. The second preset time is specifically 1 second. The first batch preparation message is used to enable the business module that has subscribed to the first channel to receive the first batch preparation message, and then determine that the first business module is performing batch preparation of user information to the redis database.
[0060] It should be noted that if the first service module has completed the batch preparation process, the first service module will no longer send any message in the first channel.
[0061] Further, according to the above example, the first batch preparation threshold is 5, the first quantity is 3, and the second batch preparation threshold is 2, which is the difference between the first batch preparation threshold and the first quantity. In other words, the batch preparation quota is not full, and 2 quotas are left.
[0062] It is understandable that if the second number does not reach the second batch backup threshold, the first business module determines that the business modules currently performing batch backup processing of user information to the redis database have not reached the maximum value, that is, the batch backup quota is not full. For example, if the second number is 1, the first business module determines that there are currently 3 business modules that are performing batch backup processing of user information to the redis database, and there is currently 1 business module that is about to perform batch backup processing of user information to the redis database. At this time, the total number of batch backup quotas is 5, 4 of which have been occupied by 4 business modules, and 1 batch backup quota remains. The first business module executes step 240.
[0063] If the second number reaches the second batch backup threshold, the first business module determines that the business modules currently performing batch backup processing of user information to the redis database have not reached the maximum value, that is, the batch backup quota is not full. For example, if the second number is 3, the first business module determines that there are currently 3 business modules (these 3 business modules do not include the first business module itself) that are about to perform batch backup processing of user information to the redis database.
[0064] At this time, since the sum of the first number and the second number exceeds the first backup threshold, the three business modules indicated by the second number cannot perform batch backup processing of user information to the redis database at the same time.
[0065] The first service module will obtain the first slot identification value of the first BRAS-VM where it is located (the identification value is the sum of the value corresponding to the slot board number where the service module is located and the current priority of the service module, for example, 8), and obtain the slot identification value from three preparation batch preparation messages (for example, 10, 6, 4). The first service module sorts the 4 obtained slot identification values from large to small (for example, 10, 8, 6, 4). Starting from the first slot identification value of the sorting result, the first service module obtains 2 slot identification values. From the aforementioned sorting result, it can be seen that the first slot identification value is within the first two slot identification values, then the first service module determines that it already has a batch preparation quota, and the first service module performs batch preparation processing of user information to the redis database. At the same time, every second preset time, in the first channel, the first service module sends a first batch preparation message.
[0066] Step 240: If the second number does not reach the second batch backup threshold, batch backup processing of user information is performed to the redis database.
[0067] Specifically, according to the description of step 230, if the second number does not reach the second batch backup threshold, the first business module determines that it has a batch backup quota, and the first business module performs batch backup processing of user information to the redis database.
[0068] Further, every second preset time, the first service module sends a first batch preparation message in the first channel.
[0069] It should be noted that if the first service module has completed the batch preparation process, the first service module will no longer send any message in the first channel.
[0070] Therefore, by applying the data batch backup method and device provided by the present application, when the first business module has configured the redis database to enable or the network oscillates, in the first channel, the first business module receives batch backup messages or batch backup preparation messages sent by multiple second business modules; within the first preset time, the first business module determines whether the first number of received batch backup messages has reached the first batch backup threshold; if the first number does not reach the first batch backup threshold, the first business module determines whether the second number of received batch backup preparation messages has reached the second batch backup threshold, wherein the second batch backup threshold is the difference between the first batch backup threshold and the first number; if the second number does not reach the second batch backup threshold, the first business module performs batch backup processing of user information to the redis database.
[0071] In this way, when multiple BRAS-VMs simultaneously back up user information to the redis database in batches, a time-sharing batch backup mechanism is introduced. Through the batch backup message or batch backup preparation message sent by other business modules, any business module can determine whether to perform batch backup processing at the moment. This solves the problem in the existing solution that when a large number of BRAS-VMs perform batch backup processing at the same time, it puts huge pressure on the network and redis database.
[0072] Optionally, in the embodiment of the present application, the process of sending a second preparation batch message by the first service module in the first channel is also included.
[0073] If the first number reaches the first backup threshold, the first business module does not perform batch backup processing of user information to the redis database; or, if the first slot identifier value is not within the third number of slot identifier values, the first business module does not perform batch backup processing of user information to the redis database. In the process of the aforementioned first business module not performing batch backup processing of user information to the redis database and continuing to execute steps 210-220, the first business module records the time when it does not perform batch backup processing of user information to the redis database.
[0074] If within the fourth preset time, the first business module still fails to perform batch processing of user information to the redis database, the first business module obtains the original priority of the first business module; the first business module adds the original priority to the first value to obtain the current priority; the first business module adds the current priority to the first slot identification value to obtain the current slot identification value; every third preset time, in the first channel, the first business module sends a second preparation batch message, and the second preparation batch message includes the current slot identification value and the slot board number.
[0075] It should be noted that the slot board number is used to enable the service module that receives the second batch preparation message to sort according to the current slot identification value. If multiple slot identification values are the same, the same slot identification values are sorted from large to small according to the slot board number. At the same time, the slot board number can also be used by the service module to distinguish whether the second batch preparation message is sent by itself.
[0076] The fourth preset time is specifically 2 minutes, and the first value is specifically 1. After receiving the second preparation batch preparation message in the first channel, other business modules obtain the current slot identification value from the second preparation batch preparation message, and in subsequent sorting, use the current slot identification value as the slot identification value of the first business module to participate in sorting.
[0077] Optionally, in an embodiment of the present application, after the first business module performs batch backup processing of user information to the redis database, the first business module sends a subscription cancellation message to the redis database, and the subscription cancellation message includes the module name of the first business module. In this way, the first business module cancels the subscription to the first channel and no longer receives batch backup messages or batch backup preparation messages sent by other business modules.
[0078] Based on the same inventive concept, the embodiment of the present application also provides a data batch preparation device corresponding to the data batch preparation method. Figure 3 , Figure 3 A structural diagram of a data batch preparation device provided in an embodiment of the present application. The device is applied to a first service module, the first service module is in a first BRAS-VM in a CP device, the CP device also includes a plurality of second BRAS-VMs, each second BRAS-VM includes a second service module, the first service module has subscribed to a first channel, and the device includes:
[0079] The receiving unit 310 is used to receive batch backup messages or batch backup preparation messages sent by multiple second service modules in the first channel when the first service module has been configured with redis database enablement or network oscillation;
[0080] The first judgment unit 320 is used to judge whether a first number of received batch preparation messages has reached a first preparation threshold within a first preset time;
[0081] A second judgment unit 330 is configured to judge whether a second number of received batch preparation messages has reached a second batch preparation threshold if the first number has not reached the first batch preparation threshold, where the second batch preparation threshold is a difference between the first batch preparation threshold and the first number;
[0082] The batch backup unit 340 is used to perform batch backup processing of user information to the redis database if the second number does not reach the second batch backup threshold.
[0083] Optionally, the batch backup unit 340 is further configured to not perform batch backup processing of user information to the redis database if the first number reaches the first backup threshold.
[0084] Optionally, the device further includes: a sending unit (not shown in the figure), configured to send a first batch preparation message in the first channel at a second preset time interval.
[0085] Optionally, the device further includes: an acquisition unit (not shown in the figure), configured to acquire a first slot identification value of the first BRAS-VM in which the device is located if the second number reaches the second batch preparation threshold, and acquire a slot identification value from each of the prepare batch preparation messages;
[0086] A sorting unit (not shown in the figure), used to sort the obtained multiple slot identification values from large to small;
[0087] The acquisition unit (not shown in the figure) is further used to acquire a third number of slot identification values starting from the first slot identification value of the sorting result, where the third number is equal to the second batch backup threshold;
[0088] The batch backup unit 340 is further configured to perform batch backup processing of user information to the redis database if the first slot identification value is within a third number of slot identification values;
[0089] The sending unit (not shown in the figure) is further used to send a first batch preparation message in the first channel every second preset time.
[0090] Optionally, the sending unit (not shown in the figure) is further used to send a first preparation batch message in the first channel every third preset time, where the first preparation batch message includes the first slot identification value.
[0091] Optionally, the acquisition unit (not shown in the figure) is further used to acquire the original priority of the first business module if the batch backup processing of user information is not performed to the redis database within a fourth preset time;
[0092] The device further comprises: a calculation unit (not shown in the figure), configured to perform an addition operation on the original priority and the first value to obtain a current priority;
[0093] Add the current priority to the first slot identification value to obtain a current slot identification value;
[0094] The sending unit (not shown in the figure) is further used to send a second batch preparation message in the first channel every third preset time, where the second batch preparation message includes the current slot identification value.
[0095] Optionally, the sending unit (not shown in the figure) is further used to, after establishing a connection with the redis database, send a subscription message to the redis database, wherein the subscription message includes the channel name of the first channel;
[0096] Sending a subscription cancellation message to the redis database, wherein the subscription cancellation message includes the channel name of the first channel;
[0097] The first channel is created by the third service module in the third BRAS-VM after establishing a connection with the redis database, and the first channel is associated with the service of the third service module itself.
[0098] Therefore, by applying the data batch backup device provided by the present application, when the first business module has configured the redis database to enable or the network is oscillating, in the first channel, the first business module receives batch backup messages or batch backup preparation messages sent by multiple second business modules; within the first preset time, the first business module determines whether the first number of received batch backup messages has reached the first batch backup threshold; if the first number does not reach the first batch backup threshold, the first business module determines whether the second number of received batch backup preparation messages has reached the second batch backup threshold, wherein the second batch backup threshold is the difference between the first batch backup threshold and the first number; if the second number does not reach the second batch backup threshold, the first business module performs batch backup processing of user information to the redis database.
[0099] In this way, when multiple BRAS-VMs simultaneously back up user information to the redis database in batches, a time-sharing batch backup mechanism is introduced. Through the batch backup message or batch backup preparation message sent by other business modules, any business module can determine whether to perform batch backup processing at the moment. This solves the problem in the existing solution that when a large number of BRAS-VMs perform batch backup processing at the same time, it puts huge pressure on the network and redis database.
[0100] Based on the same inventive concept, the embodiment of the present application also provides a network device, such as Figure 4 As shown, it includes a processor 410, a transceiver 420 and a machine-readable storage medium 430, the machine-readable storage medium 430 stores machine-executable instructions that can be executed by the processor 410, and the processor 410 is prompted by the machine-executable instructions to execute the data batch preparation method provided in the embodiment of the present application. Figure 3 The data batch preparation device shown can be used as follows Figure 4 The network device hardware structure shown is implemented.
[0101] The computer-readable storage medium 430 may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk storage. Optionally, the computer-readable storage medium 430 may also be at least one storage device located away from the processor 410.
[0102] The processor 410 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, or discrete hardware components.
[0103] In the embodiment of the present application, the processor 410 reads the machine executable instructions stored in the machine readable storage medium 430, and the machine executable instructions enable the processor 410 itself and the transceiver 420 to execute the data batch preparation method described in the aforementioned embodiment of the present application.
[0104] In addition, an embodiment of the present application provides a machine-readable storage medium 430, which stores machine-executable instructions. When called and executed by the processor 410, the machine-executable instructions prompt the processor 410 itself and the calling transceiver 420 to execute the data batch preparation method described in the aforementioned embodiment of the present application.
[0105] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0106] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.
[0107] As for the data batch preparation device and the machine-readable storage medium embodiments, since the method contents involved are basically similar to the aforementioned method embodiments, the description is relatively simple, and the relevant parts may refer to the partial description of the method embodiments.
[0108] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A data batch preparation method, It is characterized in that The method is applied to a first service module, the first service module is in a first BRAS-VM in a CP device, the CP device further includes a plurality of second BRAS-VMs, each second BRAS-VM includes a second service module, the first service module has subscribed to a first channel, and the method includes: When the first service module has been configured with redis database enablement or network oscillation, receiving batch backup messages or batch backup preparation messages sent by multiple second service modules in the first channel; Within a first preset time, determining whether a first number of received batch preparation messages has reached a first preparation threshold; If the first number does not reach the first preparation threshold, determining whether a second number of received batch preparation messages has reached a second batch preparation threshold, where the second batch preparation threshold is a difference between the first preparation threshold and the first number; If the second number does not reach the second batch backup threshold, batch backup processing of user information is performed to the redis database; The method further comprises: If the second number reaches the second batch preparation threshold, obtaining the first slot identification value of the first BRAS-VM in which the first BRAS-VM is located, and obtaining the slot identification value from each of the batch preparation messages; Sort the obtained multiple slot identification values from large to small; Starting from the first slot identification value of the sorting result, obtaining a third number of slot identification values, where the third number is equal to the second batch backup threshold; If the first slot identification value is within a third number of slot identification values, batch backup processing of user information is performed on the redis database; A first batch preparation message is sent in the first channel at every second preset time.
2. The method according to claim 1, It is characterized in that The method further comprises: If the first number reaches the first backup threshold, batch backup processing of user information is not performed on the redis database.
3. The method according to claim 1, It is characterized in that The method further comprises: A first batch preparation message is sent in the first channel at every second preset time.
4. The method according to claim 1, It is characterized in that When the first service module has configured redis database enablement or network oscillation, before receiving batch backup messages or batch backup preparation messages sent by multiple second service modules in the first channel, the method further includes: Every third preset time, a first batch preparation message is sent in the first channel, where the first batch preparation message includes a first slot identification value.
5. The method according to claim 4, It is characterized in that The method further comprises: If the batch backup process of the user information is not performed to the redis database within the fourth preset time, the original priority of the first business module is obtained; Adding the original priority to the first value to obtain a current priority; Add the current priority to the first slot identification value to obtain a current slot identification value; At every third preset time, a second batch preparation message is sent in the first channel, where the second batch preparation message includes the current slot identification value.
6. The method according to claim 1, It is characterized in that When the first service module has configured redis database enablement or network oscillation, before receiving batch backup messages or batch backup preparation messages sent by multiple second service modules in the first channel, the method further includes: After establishing a connection with the redis database, sending a subscription message to the redis database, wherein the subscription message includes the channel name of the first channel; After performing batch backup processing of user information in the redis database, the method further includes: Sending a subscription cancellation message to the redis database, wherein the subscription cancellation message includes the channel name of the first channel; The first channel is created by the third service module in the third BRAS-VM after establishing a connection with the redis database, and the first channel is associated with the service of the third service module itself.
7. A data batch preparation device, It is characterized in that The device is applied to a first service module, the first service module is in a first BRAS-VM in a CP device, the CP device further includes a plurality of second BRAS-VMs, each second BRAS-VM includes a second service module, the first service module has subscribed to a first channel, and the device includes: A receiving unit, configured to receive batch preparation messages or batch preparation messages sent by multiple second business modules in the first channel when the first business module has been configured with redis database enablement or network oscillation; A first judging unit, configured to judge, within a first preset time, whether a first number of received batch preparation messages has reached a first preparation threshold; a second judgment unit, configured to judge whether a second number of received batch preparation messages has reached a second batch preparation threshold if the first number has not reached the first batch preparation threshold, where the second batch preparation threshold is a difference between the first batch preparation threshold and the first number; a batch backup unit, configured to perform batch backup processing of user information to a redis database if the second number does not reach the second batch backup threshold; The device also includes: an acquiring unit, configured to acquire a first slot identification value of a first BRAS-VM in which the first BRAS-VM is located if the second number reaches the second batch standby threshold, and acquire a slot identification value from each of the prepare batch standby messages; A sorting unit, used to sort the obtained multiple slot identification values from large to small; The acquisition unit is further configured to acquire a third number of slot identification values starting from the first slot identification value of the sorting result, where the third number is equal to the second batch backup threshold; The batch backup unit is further used for, if the first slot identification value is within a third number of slot identification values, performing batch backup processing of user information on the redis database; The sending unit is further configured to send a first preparation-in-progress message in the first channel at a second preset time interval.
8. The device according to claim 7, It is characterized in that The batch backup unit is further configured to not perform batch backup processing of user information to the redis database if the first number reaches the first backup threshold.
9. The device according to claim 8, It is characterized in that The device also includes: The sending unit is used to send a first batch preparation message in the first channel every second preset time.
10. The device according to claim 7, It is characterized in that The sending unit is further configured to send a first batch preparation message in the first channel at every third preset time, where the first batch preparation message includes the first slot identification value.
11. The device according to claim 10, It is characterized in that The acquisition unit is further configured to, if the batch backup processing of the user information is not performed to the redis database within a fourth preset time, acquire the original priority of the first business module; The device further comprises: a calculation unit, configured to perform an addition operation on the original priority and the first value to obtain a current priority; Add the current priority to the first slot identification value to obtain a current slot identification value; The sending unit is further configured to send a second batch preparation message in the first channel at intervals of the third preset time, wherein the second batch preparation message includes the current slot identification value.
12. The device according to claim 9, It is characterized in that The sending unit is further used to, after establishing a connection with the redis database, send a subscription message to the redis database, wherein the subscription message includes the channel name of the first channel; Sending a subscription cancellation message to the redis database, wherein the subscription cancellation message includes the channel name of the first channel; The first channel is created by the third service module in the third BRAS-VM after establishing a connection with the redis database, and the first channel is associated with the service of the third service module itself.
Citation Information
Patent Citations
Method and system for sending bulk notifications
US20210120378A1
Method and device for transmitting list information
US20210289019A1