A task routing method, apparatus and device across groups
By generating uniformly distributed logical group tags and routing tasks, the problem of uneven task scheduling in message middleware is solved, and uniform scheduling and resource optimization of cross-group tasks are achieved.
Patent Information
- Application Number
- CN202310141126.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-20
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2043-02-20
AI Technical Summary
In existing technologies, message middleware task scheduling cannot achieve uniform scheduling across logical groups, resulting in resource waste and uneven task distribution.
By generating evenly distributed logical grouping tags, messages are split to generate multiple tasks to be executed, and these tasks are routed to the corresponding logical groups, ensuring that tasks are evenly distributed within the logical groups.
It achieves uniform scheduling of cross-group tasks, avoids resource waste and task duplication, and improves resource utilization efficiency.
Smart Images

Figure CN116302596B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of Internet technology, and in particular to a cross-group task routing method, apparatus, and device. Background Technology
[0002] In message middleware task scheduling, multiple machines are often logically grouped into zones. Within each logical zone, the scheduled tasks execute independently without interfering with each other, and cross-zone task scheduling is generally not supported. As the workload increases, uneven distribution of tasks across logical zones can occur, leading to wasted resources.
[0003] Therefore, a cross-group task routing scheme that achieves uniform scheduling is needed. Summary of the Invention
[0004] This specification provides a cross-group task routing method, apparatus, device, and storage medium to address the following technical problem: the need for a cross-group task routing scheme that achieves uniform scheduling.
[0005] To solve the above-mentioned technical problems, one or more embodiments of this specification are implemented as follows:
[0006] In a first aspect, embodiments of this specification provide a cross-group task routing method applied to a message middleware containing multiple logical groups. The method includes: obtaining a message sequence to be executed; generating a logical group marker corresponding to a single logical group for any message in the message sequence, wherein the logical group markers are evenly distributed in the message sequence; splitting the message to generate multiple tasks to be executed, each containing the logical group marker; and routing the multiple tasks to be executed to the logical group corresponding to the logical group marker.
[0007] In a second aspect, embodiments of this specification provide a cross-group task routing apparatus applied in a message middleware containing multiple logical groups. The method includes: an acquisition module for acquiring a message sequence to be executed; a generation module for generating a logical group marker corresponding to a single logical group for any message in the message sequence, wherein the logical group markers are evenly distributed in the message sequence; a splitting module for generating multiple tasks to be executed, each containing the logical group marker; and a routing module for routing the multiple tasks to be executed to the logical group corresponding to the logical group marker.
[0008] In a third aspect, one or more embodiments of this specification provide an electronic device, comprising:
[0009] At least one processor; and,
[0010] A memory communicatively connected to the at least one processor; wherein,
[0011] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method as described in the first aspect.
[0012] In a fourth aspect, embodiments of this specification provide a non-volatile computer storage medium storing computer-executable instructions, which, when read by a computer from the storage medium, cause one or more processors to perform the method described in the first aspect.
[0013] The above-described at least one technical solution adopted in one or more embodiments of this specification can achieve the following beneficial effects: by obtaining a message sequence to be executed; for any message in the message sequence, generating a logical group marker corresponding to a single logical group, wherein the logical group marker is evenly distributed in the message sequence; splitting the message to generate multiple tasks to be executed containing the logical group marker; and routing the multiple tasks to be executed to the logical group corresponding to the logical group marker, thereby realizing uniform scheduling of tasks across groups by calculating the evenly distributed logical group marker. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0015] Figure 1 This is a schematic diagram of the framework of a task routing system involved in the embodiments of this specification;
[0016] Figure 2 This is a flowchart illustrating a cross-group task routing method provided in the embodiments of this specification;
[0017] Figure 3 This is a schematic diagram illustrating a task execution as provided in an embodiment of this specification.
[0018] Figure 4 This is a schematic diagram of the structure of a cross-group task routing device provided in an embodiment of this specification;
[0019] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this specification. Detailed Implementation
[0020] This specification provides a cross-group task routing method, apparatus, device, and storage medium through its embodiments.
[0021] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this application.
[0022] In the process of routing messages or tasks using message middleware, a multi-layered distribution execution framework is generally adopted, specifically including a splitter, a loader, and an executor, such as... Figure 1 As shown, Figure 1 This is a schematic diagram of the framework of a task routing system involved in the embodiments of this specification. In this framework, the machines where the loader and executor reside are usually logically grouped (zones). Different groups typically load messages independently and execute the loaded messages.
[0023] The commonly used timed scheduling method involves a segmenter generating multiple messages, creating a message sequence. Each zone is given a time period, and the loader loads messages into the message sequence based on the given time period, which are then executed in the executor. Since each zone is independent, if the generated message sequence is unevenly distributed over time, uneven loading will occur between zones, resulting in some zones' machine resources not being effectively utilized. Enabling cross-group scheduling across all zones will lead to message duplication. Therefore, this specification provides an embodiment of a cross-group task routing method to achieve uniform task execution without interference across multiple logical groups.
[0024] like Figure 2 As shown, Figure 2 This is a flowchart illustrating a cross-group task routing method provided in an embodiment of this specification. Figure 2 The process may include the following steps:
[0025] S101: Obtain the message sequence to be executed.
[0026] The messages contained in the message sequence may take different forms depending on the implementation scenario. For example, they may be a submission form containing features to be detected, or a push instruction containing feature information, etc.
[0027] For example, in a risk decision-making platform, applications or mini-programs need to undergo content inspection before deployment. In this case, the message sequence can be a sequence of inspection forms. Each inspection form contains the characteristics of the application or mini-program to be inspected, such as the application or mini-program's name, code, included media resources (including images, videos, or text), and access ports, etc.
[0028] S103, for any message in the message sequence, generate a logical group tag corresponding to a single logical group, wherein the logical group tags are evenly distributed in the message sequence.
[0029] Each logical group label corresponds one-to-one with a single logical group. Logical group labels can be in the form of numbers, letters, or strings. For example, assuming there are four logical groups 0 through 3, the one-to-one correspondence of their logical group labels could be: 0: GZ00C, 1: GZ00D, 2: GZ00E, 3: GZ00G.
[0030] For a message sequence, uniform distribution of logical group markers means that the number of messages corresponding to each logical group marker should be uniform. Continuing the previous example, assuming the message sequence contains 10,000 messages, then the number of messages corresponding to logical group markers GZ00C, GZ00D, GZ00E, and GZ00G should each be around 2,500 (with a small range of deviation).
[0031] There are several ways to achieve a uniform distribution of logical grouping markers in the message sequence. For example, random number extraction, unique time calculation, or remainder calculation can be used.
[0032] By using random number extraction, elements can be randomly selected from a uniformly distributed set within a given range, and these selected elements serve as message tags. Simultaneously, each selected element corresponds to a logical block tag, ensuring that the logical block tags are uniformly distributed throughout the message sequence.
[0033] By using the remainder calculation method, message markers that are evenly distributed in the message can be generated first, and then logical group markers can be generated based on the remainders of the evenly distributed message markers, so that the logical group markers are evenly distributed in the message sequence.
[0034] For example, for each inspection order, a continuous sequence generation mechanism can be used to generate monotonically increasing message markers with the same intervals (i.e., generate uniformly distributed message markers). Then, based on the remainders of the uniformly distributed message markers, the logical group markers corresponding to a single logical group can be calculated, thereby making the logical group markers uniformly distributed in the message sequence.
[0035] In practical applications, the zdal sequence generation component can be used to set the starting value, step size, and period of message tags, etc., to generate monotonically increasing message tags with the same intervals. For example, assuming the starting value is 1000 and the step size is 1, the message tags of the messages in the message sequence should be a sequence of natural numbers starting from 1000.
[0036] Then, the mantissa of the specified length of the message tag can be obtained, as well as the number of logical groups; the remainder of the mantissa relative to the number can be determined, and the logical group tag corresponding to a single logical group can be determined based on the remainder. Continuing the previous example, the mantissa of the last two digits of the specified message tag (in practical applications, the generated message tag is longer, usually the last eight digits can be obtained), and the remainder of the mantissa can be taken according to the number of logical groups (the remainder and the logical group tag are in one-to-one correspondence), thereby determining the logical group tag corresponding to a single logical group based on the remainder.
[0037] Continuing with the previous example, suppose a message is marked as 1022, and the last two digits are 22. When the number of logical blocks is 4, the result of taking 22 modulo 4 is 2. Therefore, the logical block mark corresponding to this message is GZ00E (the remainder 2 corresponds one-to-one with the logical block mark GZ00E).
[0038] S105, split the message to generate multiple tasks to be executed, each containing the logical grouping marker.
[0039] The message splitting method can be determined based on the specific form of the message, and the generated task to be executed is the smallest unit for the message middleware to push.
[0040] For example, when a message is composed of multiple independent sub-messages, the splitting method can divide the message into multiple sub-messages. In this case, the generated sub-messages are the tasks to be executed. The message middleware pushes the sub-messages to the message consumer, or the message consumer pulls the generated sub-messages for consumption.
[0041] For example, when the message is a submission form containing multiple message features as described above, the message features (which are the features to be detected in the submission form at this time) are such as the name, code, media resources, and calling port of the application or mini-program contained in the submission form.
[0042] Therefore, the message splitting method can be based on the message characteristics contained in the inspection form to generate multiple corresponding tasks to be executed. For example, the message middleware calls the port provided by the decision platform to generate a first task to be executed based on the media resources contained in the message. This detection task is used to check the legality of the media resources. Alternatively, a second task to be executed can be generated based on the code or call port contained in the message. This detection task is used to check the functional integrity of the code or call port. Or, a third task to be executed can be generated based on the name of the mini-program or application contained in the message. This task is used to check the compliance or duplication of the name of the mini-program or application, and so on.
[0043] Each of the generated tasks to be executed should contain the logical grouping tag corresponding to the message. For example, assuming the logical grouping tag corresponding to message 1022 is GZ00E and the logical grouping tag corresponding to message 1023 is GZ00G, then each of the tasks to be executed obtained from splitting message 1022 should contain the logical grouping tag GZ00E, and each of the tasks to be executed obtained from splitting message 1023 should contain the logical grouping tag GZ00G.
[0044] S109, the plurality of tasks to be executed are routed to the logical group corresponding to the logical group marker.
[0045] Routing can be done by pushing messages through the message middleware or by pulling messages from logical groups to the message middleware. As mentioned earlier, since there is a one-to-one correspondence between logical group tags and logical groups, it can be guaranteed that each task to be executed will only be routed to its corresponding logical group for execution, thus avoiding duplicate execution caused by a task being routed to multiple groups. At the same time, since logical group tags are evenly distributed in the message sequence, logical group tags are also evenly distributed in the tasks to be executed obtained from message splitting, thus ensuring that the tasks to be executed are also evenly distributed in the logical groups, achieving uniform scheduling of resources across multiple logical groups.
[0046] The above-described at least one technical solution adopted in one or more embodiments of this specification can achieve the following beneficial effects: by obtaining a message sequence to be executed; for any message in the message sequence, generating a logical group marker corresponding to a single logical group, wherein the logical group marker is evenly distributed in the message sequence; splitting the message to generate multiple tasks to be executed containing the logical group marker; and routing the multiple tasks to be executed to the logical group corresponding to the logical group marker, thereby realizing uniform scheduling of tasks across groups by calculating the evenly distributed logical group marker.
[0047] In one implementation, when generating a logical group tag corresponding to a single logical group for any message in the message sequence, a set can be pre-defined, where each element in the set corresponds to a logical group tag. For example, the elements in the set can be strings of arbitrary length, with the last character of each string being C, D, E, or G. The number of strings ending with C, D, E, or G is the same in the set. C, D, E, or G correspond to logical group tags GZ00C, GZ00D, GZ00E, and GZ00G, respectively.
[0048] Therefore, for any message in the message sequence, an element can be randomly selected from a preset set, and the logical grouping tag corresponding to the last character of the selected string can be determined as the logical grouping tag corresponding to that message. In this way, even when there are a large number of messages, uniform execution can be achieved without interference between multiple logical groups.
[0049] Furthermore, in this implementation, to ensure a more even distribution of logical grouping markers within a short period, the following approach can be adopted: Check if the last string of the currently selected string was selected in the previous N random selections (N being a natural number not exceeding the number of logical groups). If it was selected in the previous N selections, discard the currently selected string and proceed with another random selection. This method avoids short-term uneven distribution where a particular logical grouping marker is selected multiple times, resulting in a smoother resource allocation.
[0050] In one implementation, multiple tasks to be executed, derived from splitting multiple different messages, may be stored in the same relational database. The relational database stores these tasks in a table format, where each row represents a task through multiple distinct fields. These fields include the task identifier, message identifier, logical grouping identifier, message characteristics, execution result of the task, and so on.
[0051] Since multiple different messages may overlap in time when they are split, the tasks to be executed obtained from splitting the same message may be arranged in a cross-arranged manner in the table. In order to facilitate routing, an index can be created for the tasks to be executed and the logical group markers. The index stores the location of the data path where the task to be executed is located, including the table name and row number, as shown in Table 1. Table 1 is an example of an index provided by an embodiment of this specification.
[0052] Table 1. Location Index of Tasks to be Executed
[0053] Message tags Logical grouping tags Location ID001 GZ00C (name1, line 12) ID005 GZ00C (name 1, line 30) ID001 GZ00C (name 1, line 31) ID002 GZ00D (name 1, line 27)
[0054] At this point, when the message middleware performs routing, it can look up tasks from their locations based solely on the logical group markers contained in the index table, and route the multiple tasks to be executed to the logical groups corresponding to those logical group markers. As shown in Table 1, the tasks obtained by splitting messages ID001 and ID005 can be retrieved from rows 12 and 30 of table name1 and routed to the logical group GZ00C, thereby achieving efficient and fast grouping.
[0055] In one embodiment, multiple different executors may exist within the same logical group, i.e., Figure 1 As shown, if there are multiple executers in a zone that can execute tasks, then in order to better summarize the results, tasks to be executed that contain the same message tag can be serially routed to the same executer in the logical group for execution, and the executer can summarize the execution results of the tasks to be executed that contain the same message tag.
[0056] like Figure 3 As shown, Figure 3 This diagram illustrates a task execution process provided in an embodiment of this specification. During task routing, multiple tasks derived from different message splits are routed to the same logical group. In this diagram, the tasks derived from messages 001 and 005 are both routed to logical group GZ00C. Simultaneously, multiple executors exist within this logical group. Therefore, message tags of the tasks routed to executors can be recorded. When a message tag is first routed to an executor, subsequent tasks containing that message tag within that logical group will be assigned to that executor for serial execution. Furthermore, tasks containing different message tags will be executed in parallel among different executors within the logical group.
[0057] Furthermore, when summarizing after the executors have finished executing, for any message, the summary can be performed within the same executor's execution results, without needing to call results across executors. For example, the tasks to be executed obtained from the breakdown of message 001 are all executed by executor 1 after being routed to logical group GZ00C. Therefore, during the summary, only internal summarization is needed within executor 1 to obtain all the execution results of message 001, avoiding cross-executor calls and improving efficiency.
[0058] Based on the same idea, one or more embodiments of this specification also provide apparatus and devices corresponding to the above methods, such as... Figure 4 , Figure 5 As shown.
[0059] In the second aspect, such as Figure 4 As shown, Figure 4 This is a schematic diagram of a cross-group task routing device provided in an embodiment of this specification, applied in a message middleware containing multiple logical groups. The device includes:
[0060] Module 401 retrieves the message sequence to be executed;
[0061] The generation module 403 generates a logical group marker corresponding to a single logical group for any message in the message sequence, wherein the logical group marker is evenly distributed in the message sequence;
[0062] The splitting module 405 splits the message and generates multiple tasks to be executed, each containing the logical grouping marker.
[0063] The routing module 407 routes the plurality of tasks to be executed to the logical group corresponding to the logical group marker.
[0064] Optionally, the generation module 403 generates a message tag for any message in the message sequence, wherein the message tag is continuously incremented in the message sequence; and generates a logical group tag corresponding to a single logical group based on the message tag.
[0065] Optionally, the generation module 403 obtains the tail number of the specified length of the message tag, and obtains the number of logical groups; determines the remainder of the tail number relative to the number, and determines the logical group tag corresponding to a single logical group based on the remainder.
[0066] Optionally, the generation module 403 randomly selects an element from a preset set for any message in the message sequence, wherein the element corresponds to a logical grouping tag; and determines the logical grouping tag corresponding to the selected element as the logical grouping tag corresponding to the message.
[0067] Optionally, the routing module 407 establishes an index of the tasks to be executed and the logical group markers; and routes the multiple tasks to be executed to the logical groups corresponding to the logical group markers based on the logical group markers from the index.
[0068] Optionally, the routing module 407 serially routes tasks to be executed that contain the same message tag to the same executor in the logical group.
[0069] Optionally, the splitting module 405 obtains the message features contained in the message and generates multiple tasks to be executed that contain the logical grouping markers and correspond one-to-one with the message features.
[0070] In the third aspect, such as Figure 5 As shown, Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this specification. The device includes:
[0071] At least one processor; and,
[0072] A memory communicatively connected to the at least one processor; wherein,
[0073] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method as described in the first aspect.
[0074] In a fourth aspect, based on the same idea, embodiments of this specification also provide a non-volatile computer storage medium corresponding to the above method, storing computer-executable instructions, which, when read by a computer from the storage medium, cause one or more processors to execute the method described in the first aspect.
[0075] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should understand that by simply performing some logic programming on the method flow using one of these hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.
[0076] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, ASICs, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0077] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0078] For ease of description, the above devices are described in terms of function, divided into various units. Of course, in implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware components.
[0079] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, the embodiments of this specification can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the embodiments of this specification can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0080] This specification is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this specification. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0081] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0082] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0083] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0084] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0085] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0086] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0087] This specification can be described in the general context of computer-executable instructions that are executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This specification can also be practiced in distributed computing environments, where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0088] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, devices, and non-volatile computer storage media are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0089] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0090] The above description is merely one or more embodiments of this specification and is not intended to limit this specification. Various modifications and variations can be made to the one or more embodiments of this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of one or more embodiments of this specification should be included within the scope of the claims of this specification.
Claims
1. A task routing method across groups, applied to a message middleware comprising a plurality of logical groups, the method comprising: obtaining a message sequence to be executed; generating, for any message in the message sequence, a logical group label corresponding to a single logical group, including: predefining a set, elements in the set corresponding to logical group labels, elements in the given set being strings of arbitrary length, for any message in the message sequence, randomly selecting an element from the preset set, and determining the logical group label corresponding to the last bit of the selected string as the logical group label corresponding to the message, and determining whether the tail string of the current selected string has been selected in the previous N times of random selection, if it has been selected in the previous N times, discarding the string selected this time for random selection again, wherein the logical group labels are uniformly distributed in the message sequence; splitting the message to generate a plurality of tasks to be executed containing the logical group labels; routing the plurality of tasks to be executed to the logical group corresponding to the logical group label.
2. The method of claim 1, wherein, The generating, for any message in the message sequence, a logical group label corresponding to a single logical group includes: generating, for any message in the message sequence, a message label, wherein the message labels are continuously increasing in the message sequence; generating, according to the message label, a logical group label corresponding to a single logical group.
3. The method of claim 1, wherein, The generating, according to the message label, a logical group label corresponding to a single logical group includes: obtaining a specified length of the tail of the message label, and obtaining the number of logical groups; determining the remainder of the tail relative to the number, and determining the logical group label corresponding to a single logical group according to the remainder.
4. The method of claim 1, wherein, The generating, for any message in the message sequence, a logical group label corresponding to a single logical group includes: for any message in the message sequence, randomly selecting an element from a preset set, wherein the element corresponds to a logical group label; determining the logical group label corresponding to the selected element as the logical group label corresponding to the message.
5. The method of claim 1, wherein, The routing the plurality of tasks to be executed to the logical group corresponding to the logical group label includes: establishing an index of the tasks to be executed and the logical group labels; routing the plurality of tasks to be executed to the logical group corresponding to the logical group label according to the logical group label from the index.
6. The method of claim 2, wherein, After routing the plurality of tasks to be executed to the logical group corresponding to the logical group label, the method further comprises: serially routing tasks to be executed containing the same message label to the same executor in the logical group.
7. The method of claim 1, wherein, The splitting the message to generate a plurality of tasks to be executed containing the logical group labels includes: obtaining message features contained in the message, and generating a plurality of tasks to be executed containing the logical group labels and corresponding one by one to the message features according to the message features.
8. A task routing apparatus across groups, applied in a message middleware comprising a plurality of logical groups, the apparatus comprising: an obtaining module, obtaining a message sequence to be executed; a generating module, for any message in the message sequence, generating a logical group label corresponding to a single logical group, comprising: predefining a set, elements in the set have a corresponding relationship with the logical group label, elements in the given set are strings of arbitrary length, for any message in the message sequence, randomly selecting an element from the preset set, and determining the logical group label corresponding to the last bit of the selected string as the logical group label corresponding to the message, and determining whether the tail string of the current selected string has been selected in the previous N times of random selection, if it has been selected in the previous N times, discarding the randomly selected string this time for re-random selection, wherein the logical group labels are uniformly distributed in the message sequence; a splitting module, splitting the message into a plurality of tasks to be executed containing the logical group label; a routing module, routing the plurality of tasks to be executed to the logical group corresponding to the logical group label.
9. An electronic device, comprising: at least one processor; and a memory in communication connection with the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 7.
Citation Information
Patent Citations
Message sending method, system, routing device and server
CN107547601A