CN114356421A - Instruction splitting method and device and electronic equipment - Google Patents

Instruction splitting method and device and electronic equipment Download PDF

Info

Publication number
CN114356421A
CN114356421A CN202210016105.0A CN202210016105A CN114356421A CN 114356421 A CN114356421 A CN 114356421A CN 202210016105 A CN202210016105 A CN 202210016105A CN 114356421 A CN114356421 A CN 114356421A
Authority
CN
China
Prior art keywords
instruction
processing
semaphore
key
splitting
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210016105.0A
Other languages
Chinese (zh)
Inventor
杨冠飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Cloud Network Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN202210016105.0A priority Critical patent/CN114356421A/en
Publication of CN114356421A publication Critical patent/CN114356421A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Computer And Data Communications (AREA)

Abstract

The invention provides an instruction splitting method and device and electronic equipment. The method is applied to a forwarding layer of a distributed server, and comprises the following steps: receiving an instruction to be split, and determining the semaphore of the instruction; wherein, the instruction comprises a plurality of key value pairs, and the semaphore characterizes the processing stage of the instruction; splitting instructions, namely sending the split instructions to a plurality of servers; receiving processing results sent by a plurality of servers, and determining whether the processing of the instruction is finished based on the semaphore; if the processing is finished, the plurality of processing results are gathered to obtain a final processing result, and the final processing result is sent. When splitting and processing the instruction, the processing stage of the instruction is determined by the semaphore, and whether all the split instructions are processed can be determined according to the semaphore. In the mode, distributed processing of the instructions can be realized through instruction splitting, so that the split instructions are uniformly processed, and the instruction processing efficiency is improved.

Description

Instruction splitting method and device and electronic equipment
Technical Field
The present invention relates to the technical field of distributed data processing, and in particular, to a method and an apparatus for instruction splitting, and an electronic device.
Background
Currently, an instruction to be processed may include multiple key-value pairs, and only a single key-value pair may be processed when the instruction is processed, so that the instruction needs to be split into multiple key-value pairs and each key-value pair needs to be processed separately.
However, the instruction splitting and processing method in the prior art cannot ensure uniform processing of the split instructions, and the efficiency of instruction processing is low.
Disclosure of Invention
In view of this, the present invention provides an instruction splitting method, an instruction splitting apparatus, and an electronic device, so as to ensure that split instructions are uniformly processed and improve instruction processing efficiency.
In a first aspect, an embodiment of the present invention provides an instruction splitting method, which is applied to a forwarding layer of a distributed server, and the method includes: receiving an instruction to be split, and determining the semaphore of the instruction; wherein, the instruction comprises a plurality of key value pairs, and the semaphore characterizes the processing stage of the instruction; splitting instructions, namely sending the split instructions to a plurality of servers; receiving processing results sent by a plurality of servers, and determining whether the processing of the instruction is finished based on the semaphore; if the processing is finished, the plurality of processing results are gathered to obtain a final processing result, and the final processing result is sent.
In a preferred embodiment of the present invention, the client, the load balancer, the at least one forwarding layer, and the plurality of servers are communicatively coupled in sequence.
In a preferred embodiment of the present invention, the step of receiving the instruction to be split includes: receiving an instruction to be split sent by a load balancer; the instruction is sent to a load balancer by a client; the step of sending the final processing result includes: and sending the final processing result to the client.
In a preferred embodiment of the present invention, the step of splitting the instruction includes: splitting the instruction according to a preset hash rule to obtain split key value pairs and residues corresponding to the key value pairs; the step of sending the split instruction to a plurality of servers includes: and sending the key value pair to a server corresponding to the remainder.
In a preferred embodiment of the present invention, after the step of splitting the instruction by using the preset hash rule to obtain the split key-value pair and the remainder corresponding to the key-value pair, the method further includes: the semaphore for the key-value pair is adjusted.
In a preferred embodiment of the present invention, the step of receiving the processing results sent by the plurality of servers includes: receiving processing results corresponding to the key value pairs sent by the plurality of servers; determining whether processing of the instruction is complete based on the semaphore, comprising: and adjusting the semaphore of the key value pair corresponding to the processing result, and determining whether the instruction is processed or not based on the semaphore of the key value pair.
In a preferred embodiment of the present invention, the step of determining whether the processing of the instruction is completed based on the semaphore of the key-value pair includes: if the semaphore of the key-value pair represents that the key-value pair is processed, the instruction processing is finished; if there is at least one key-value pair semaphore not indicating that key-value pair processing is complete, instruction processing is not complete.
In a preferred embodiment of the present invention, the step of summarizing the plurality of processing results to obtain the final processing result includes: and summarizing the plurality of processing results through a preset aggregation function to obtain a final processing result.
In a second aspect, an embodiment of the present invention further provides an instruction splitting apparatus, which is applied to a forwarding layer of a distributed server, and the apparatus includes: the instruction receiving module is used for receiving an instruction to be split and determining the semaphore of the instruction; wherein, the instruction comprises a plurality of key value pairs, and the semaphore characterizes the processing stage of the instruction; the instruction splitting module is used for splitting the instruction and sending the split instruction to a plurality of servers; the processing result receiving module is used for receiving processing results sent by the plurality of servers and determining whether the processing of the instruction is finished or not based on the semaphore; and the processing result sending module is used for summarizing the plurality of processing results to obtain a final processing result and sending the final processing result if the processing is finished.
In a third aspect, an embodiment of the present invention further provides an electronic device, which includes a processor and a memory, where the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the steps of the instruction splitting method described above.
In a fourth aspect, the embodiments of the present invention also provide a computer-readable storage medium, which stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the steps of the instruction splitting method described above.
The embodiment of the invention has the following beneficial effects:
according to the instruction splitting method, the instruction splitting device and the electronic equipment, the processing stage of the instruction is determined through the semaphore when the instruction is split and processed, and whether all split instructions are processed can be determined according to the semaphore. In the mode, distributed processing of the instructions can be realized through instruction splitting, so that the split instructions are uniformly processed, and the instruction processing efficiency is improved.
Additional features and advantages of the disclosure will be set forth in the description which follows, or in part may be learned by the practice of the above-described techniques of the disclosure, or may be learned by practice of the disclosure.
In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart of an instruction splitting method according to an embodiment of the present invention;
FIG. 2 is a flowchart of another instruction splitting method according to an embodiment of the present invention;
fig. 3 is a schematic diagram illustrating an overall architecture of an instruction splitting method according to an embodiment of the present invention;
fig. 4 is a schematic diagram illustrating an overall flow of an instruction splitting method according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an instruction splitting apparatus according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of another instruction splitting apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Currently, an instruction to be processed may include multiple key-value pairs, and only a single key-value pair may be processed when the instruction is processed, so that the instruction needs to be split into multiple key-value pairs and each key-value pair needs to be processed separately. The existing instruction splitting and processing method can not ensure uniform processing of split instructions, and the efficiency of instruction processing is low. Based on this, the instruction splitting method, the instruction splitting device and the electronic device provided by the embodiment of the invention can be applied to various devices such as a physical server, a cloud server, a mobile phone, a tablet computer and a computer, and the technology can be implemented by adopting corresponding software and hardware, and the embodiment of the invention is described in detail below.
For the convenience of understanding the embodiment, a detailed description will be given to an instruction splitting method disclosed in the embodiment of the present invention.
This embodiment provides an instruction splitting method, which is applied to a forwarding layer of a distributed server, and referring to a flowchart of the instruction splitting method shown in fig. 1, the instruction splitting method includes the following steps:
step S100, receiving an instruction to be split, and determining the semaphore of the instruction; wherein the instruction comprises a plurality of key-value pairs, and the semaphore characterizes a processing stage of the instruction.
The method provided by the embodiment can be applied to a forwarding layer proxy of a distributed server, wherein the distributed server refers to a theoretical calculation model server form in which data and programs can be dispersed to a plurality of servers instead of being located on one server, and geographic information data which are dispersedly distributed on a network and database operations influenced by the data are used as research objects. The distributed system is beneficial to the distribution and optimization of tasks on the whole computer system, overcomes the defects of central host resource shortage and response bottleneck caused by the traditional centralized system, and solves the problems of data isomerism, data sharing, complex operation and the like in the network.
In which proxy may be understood as setting a layer of "interception" before a target object, and external accesses to the object must pass through this layer of interception, and may filter and rewrite external accesses (meaning that it may "proxy" some operations, which may be understood as "proxy").
The instruction to be split may be generated by a client, and the client in this embodiment may be a terminal device with a communication function, such as a mobile phone, a computer, and a tablet computer. The instruction to be split may contain multiple key value pairs, for example: mset k1 v1, k2 v2, k3v3 and k4 v 4. The client may send the instruction to be split to a load balancer (LoadBalance) VIP, where the load balancer VIP may be connected to at least one proxy forwarding layer proxy, and the load balancer VIP may send the received instruction to be split to one proxy forwarding layer proxy connected to the load balancer VIP.
After the proxy forwarding layer proxy receives an instruction to be split, a semaphore of the instruction may be determined, where the semaphore represents a processing stage of the instruction, and the processing stage may include: originally non-split requests, when a single request is distributed, and when processing of a single request is complete.
Step S102, splitting the instruction, and sending the split instruction to a plurality of servers.
The proxy forwarding layer proxy can split the received instruction, and when the received instruction is split, a preset hash rule can be used to calculate a plurality of key value pairs included in the instruction and a server corresponding to each key value pair, and the server is used to process the corresponding key value pairs. After determining the split instruction (i.e., a plurality of key-value pairs included in the instruction) and the processor corresponding to each key-value pair, the proxy forwarding layer proxy may send the split instruction to a plurality of servers; the server processes the corresponding key value pair to obtain a processing result, and the server can send the processing result to the proxy forwarding layer proxy.
And step S104, receiving the processing results sent by the plurality of servers, and determining whether the processing of the instruction is finished or not based on the semaphore.
After the proxy forwarding layer proxy receives the processing results sent by the plurality of servers, the semaphore of the key value pair corresponding to each processing result can be adjusted, and the adjusted semaphore indicates that the key value pair has been processed. An instruction may be determined to have processed completely if the semaphore for all key-value pairs that the instruction includes characterizes that the token-value pair has processed completely. Otherwise, as long as the semaphore of one key value pair in all key value pairs included in the instruction represents that the processing of the token key value pair is not completed, the instruction is considered to be not completed.
And step S106, if the processing is finished, summarizing a plurality of processing results to obtain a final processing result, and sending the final processing result.
If the instruction is processed, the processing results of the plurality of key value pairs are summarized through a preset aggregation function, a final processing result is obtained through summarization, the final processing result can be regarded as the processing result of the instruction, and then the proxy forwarding layer proxy can send the final processing result to the server. In addition, if the instruction has not been processed, it may continue to wait for the processing result sent by the receiving server until the instruction has been completed.
According to the instruction splitting method provided by the embodiment of the invention, the processing stage of the instruction is determined through the semaphore when the instruction is split and processed, and whether all the split instructions are processed can be determined according to the semaphore. In the mode, distributed processing of the instructions can be realized through instruction splitting, so that the split instructions are uniformly processed, and the instruction processing efficiency is improved.
The embodiment provides another instruction splitting method, which is implemented on the basis of the above embodiment; the embodiment focuses on a split instruction, and sends the split instruction to a specific implementation manner in a plurality of servers. Referring to a flowchart of another instruction splitting method shown in fig. 2, the instruction splitting method in this embodiment includes the following steps:
step S200, receiving an instruction to be split, and determining the semaphore of the instruction; wherein the instruction comprises a plurality of key-value pairs, and the semaphore characterizes a processing stage of the instruction.
Specifically, in the embodiment of the present invention, a client, a load balancer, at least one forwarding layer, and multiple servers are sequentially connected in a communication manner, referring to a schematic diagram of an overall architecture of an instruction splitting method shown in fig. 3, the overall architecture in fig. 3 includes 2 proxy forwarding layers and 3 servers, the load balancer is connected in a communication manner to each proxy forwarding layer, each proxy forwarding layer is connected in a communication manner to each server, and an instruction to be split may be transmitted through the following steps: receiving an instruction to be split sent by a load balancer; wherein the instructions are sent by the client to the load balancer. The end result may be transmitted as follows: and sending the final processing result to the client.
Specifically, the server according to the embodiment of the present invention may be a memory cache service redis server, and correspondingly, the instruction according to the embodiment of the present invention may be a redis instruction. As shown in fig. 3, this embodiment may provide a solution for processing a distributed redis instruction, where a bottom layer is a pair of master-slave redis services, a front end uses a proxy as a proxy to forward an instruction and summarize a distributed processing result of the instruction, and after the proxy processing is completed, a final processing result may be returned to a client, and the final processing result is sent to the client.
redis is a key-value storage system. The method supports more stored value types, including string, list, set, zset and hash. These data types all support push/pop, add/remove, and intersect union and difference, and richer operations, and these operations are all atomic. On this basis, redis supports various different ways of ordering. To ensure efficiency, the data of the redis is cached in the memory.
In order to implement distributed processing of redis instructions, a proxy forwarding layer may be added, and according to a certain hash rule (key hash rule), the key instructions are forwarded to a back-end server (server) for processing according to a processing result (hash result), wherein some related instructions are split, such as mset k1 v2 and k2 v2, and similar instructions may be split by the proxy layer.
Step S202, splitting the instruction through a preset Hash rule to obtain split key value pairs and residues corresponding to the key value pairs; and sending the key value pair to a server corresponding to the remainder.
The instruction to be split in this embodiment may be an mset instruction, the mset instruction may set a plurality of key value pairs, the server architecture in this embodiment is a distributed redis server, keys need to be dispersed on each server at the back end, and are uniformly distributed as much as possible, so that a server per second query rate supporting a large capacity is achieved.
For example, the mset command may set multiple key value pairs for one time, such as mset k1 v1, k2 v2, k3v3, and k4 v4, and needs to be calculated by a preset hash (hash) rule, for example: the crc32 algorithm may calculate a key and then balance the number of tiles to get a remainder based on which tile the remainder falls on. The back-end fragments are composed of redis master-slave services, each redis master-slave pair is responsible for a certain fragment number (when the fragment number is created, it is determined in advance according to the selected fragment number, if there are 1024 fragments in total, and there are 3 pairs of master-slave redis services, then 1024 fragments are all distributed on 3 pairs of redis services, the reds service No. 1 is responsible for 0-341, the reds service No. 2 is responsible for 342-.
The split form of the mset instruction is as follows 4: mset k1 v1, Mset k2 v2, Mset k3v3 and Mset k4 v 4. And then carrying out crc32 algorithm on k1, k2, k3 and k4 to calculate a hash value, and taking the rest of 1024 fragments according to the calculated hash value, wherein the value is seen to fall on any server of No. 1, No. 2 and No. 3 and is forwarded to the corresponding server.
And step S204, receiving the processing results sent by the plurality of servers, and determining whether the processing of the instruction is finished or not based on the semaphore.
In the process of splitting and processing the instruction, the semaphore may be updated, for example, after the step of splitting the instruction by a preset hash rule to obtain the split key-value pair and a remainder corresponding to the key-value pair, the method further includes: the semaphore for the key-value pair is adjusted. For another example, the result may be received by the following steps to determine whether the instruction is complete: receiving processing results corresponding to the key value pairs sent by the plurality of servers; and adjusting the semaphore of the key value pair corresponding to the processing result, and determining whether the instruction is processed or not based on the semaphore of the key value pair.
Specifically, the semaphore such as sg sync.waitgroup in go language can be used to control the distribution of requests and the result summary after the processing is completed, and by using the semaphore such as sg sync.waitgroup, the codes which are executed in sequence originally can be executed in multiple Goroutine concurrently, so that the speed of program processing is increased. For example: the semaphore when a single request is distributed may be sg.add (1), the semaphore when processing of a single request is completed may be sg.done (), and the semaphore of an originally non-split request may be sg.wait ().
And step S206, if the processing is finished, summarizing a plurality of processing results to obtain a final processing result, and sending the final processing result.
In this embodiment, after all the request processing is completed, the results required by the initial request may be summarized and returned to the client according to the processing result of the single request after the processing is completed, for example: if the semaphore of the key-value pair represents that the key-value pair is processed, the instruction processing is finished; if there is at least one key-value pair semaphore not indicating that key-value pair processing is complete, instruction processing is not complete.
An instruction may be determined to have processed completely if the semaphore for all key-value pairs that the instruction includes characterizes that the token-value pair has processed completely. Otherwise, as long as the semaphore of one key value pair in all key value pairs included in the instruction represents that the processing of the token key value pair is not completed, the instruction is considered to be not completed.
For example, the mest instruction has 4 key value pairs, where the first 3 key value pairs return the processing result to the corresponding server, and then the semaphore of the first 3 key value pairs may be adjusted, and the adjusted semaphore represents that the token value pair has been processed. However, if the server corresponding to the 4 th key value does not return the processing result, the instruction is considered to be not processed completely; the 4 th key value also returns a processing result to the corresponding server, and the instruction is considered to be processed completely. In addition, if the instruction has not been processed, it may continue to wait for the processing result sent by the receiving server until the instruction has been completed.
In addition, when a plurality of processing results are aggregated to obtain a final processing result, aggregation functions may be used for aggregation, for example: and summarizing the plurality of processing results through a preset aggregation function to obtain a final processing result. An aggregation function may perform a computation on a set of values and return a single value, also referred to as a group function.
The finishing process of the instruction splitting method provided by the embodiment of the present invention may refer to a schematic diagram of an overall process of the instruction splitting method shown in fig. 4, where a client may first send a mset instruction to a VIP of a load balancer, and the VIP selects a proxy forwarding layer to send the mset instruction to the selected proxy forwarding layer.
The proxy forwarding layer may perform the splitting of the mset instruction, where the request field contains the aggregation function and semaphore to return the result. For example, the mset instruction may be: for mset k1 v1 and k2 v2, the specific splitting work is hash according to key and sent to different redis servers for processing, for example: the method can be executed through a preset hash rule, split key value pairs and remainders are obtained through the hash rule, and a redis server corresponding to each key value pair is determined according to the remainders. And the proxy forwarding layer can send the plurality of key value pairs obtained by splitting to the redis servers corresponding to the remainders of the key value pairs respectively after the splitting operation.
After the redis server performs processing, the processing result can be returned to the proxy forwarding layer, and the proxy forwarding layer can judge whether the instruction is processed or not according to the semaphore; if the instruction processing is completed, the proxy forwarding layer can call the aggregation function to collect the processing result of each key value pair, obtain the final processing result, and return the final processing result to the client. If the instruction is not processed completely, the proxy forwarding layer needs to continue to obtain the instruction until the processing results of all the key value pairs are received, and the step of calling the aggregation function to collect the processing results of each key value pair is executed to obtain the final processing result.
The method provided by the embodiment of the invention can be used for adding a proxy forwarding layer, processing the instruction according to a certain hash rule, and forwarding the key instruction to the back-end server for processing according to the processing result, wherein the splitting of some related instructions can be split by the proxy layer. In the method, when the instruction is split and processed, the processing stage of the instruction is determined through the semaphore, and whether all the split instructions are processed can be determined according to the semaphore. In the mode, distributed processing of the instructions can be realized through instruction splitting, so that the split instructions are uniformly processed, and the instruction processing efficiency is improved.
Corresponding to the foregoing method embodiment, an embodiment of the present invention provides an instruction splitting device, which is applied to a forwarding layer of a distributed server, and referring to a schematic structural diagram of the instruction splitting device shown in fig. 5, the instruction splitting device includes:
the instruction receiving module 51 is configured to receive an instruction to be split, and determine a semaphore of the instruction; wherein, the instruction comprises a plurality of key value pairs, and the semaphore characterizes the processing stage of the instruction;
the instruction splitting module 52 is configured to split an instruction, and send the split instruction to a plurality of servers;
a processing result receiving module 53, configured to receive processing results sent by the plurality of servers, and determine whether the processing of the instruction is completed based on the semaphore;
and a processing result sending module 54, configured to, if the processing is completed, sum up the multiple processing results to obtain a final processing result, and send the final processing result.
According to the instruction splitting device provided by the embodiment of the invention, the processing stage of the instruction is determined through the semaphore when the instruction is split and processed, and whether all the split instructions are processed can be determined according to the semaphore. In the mode, distributed processing of the instructions can be realized through instruction splitting, so that the split instructions are uniformly processed, and the instruction processing efficiency is improved.
The client, the load balancer, the at least one forwarding layer and the servers are sequentially in communication connection.
The instruction receiving module is used for receiving an instruction to be split sent by the load balancer; the instruction is sent to a load balancer by a client; and the instruction receiving module is used for sending the final processing result to the client.
The instruction splitting module is used for splitting the instruction according to a preset hash rule to obtain split key value pairs and residues corresponding to the key value pairs; and the instruction splitting module is used for sending the key value pair to the server corresponding to the remainder.
Referring to a schematic structural diagram of another instruction splitting apparatus shown in fig. 6, the instruction splitting apparatus further includes: and the semaphore adjusting module 55 is connected with the instruction splitting module 52, and the semaphore adjusting module 55 is used for adjusting the semaphore of the key value pair.
The processing result receiving module is used for receiving processing results corresponding to the key value pairs sent by the plurality of servers; the processing result receiving module is configured to adjust a semaphore of a key value pair corresponding to the processing result, and determine whether the instruction is processed based on the semaphore of the key value pair.
The processing result receiving module is used for finishing command processing if the semaphore of the key value pair represents that the key value pair processing is finished; if there is at least one key-value pair semaphore not indicating that key-value pair processing is complete, instruction processing is not complete.
The processing result sending module is used for summarizing a plurality of processing results through a preset aggregation function to obtain a final processing result.
The implementation principle and the technical effect of the instruction splitting device provided by the embodiment of the present invention are the same as those of the foregoing embodiment of the instruction splitting method, and for the sake of brief description, reference may be made to corresponding contents in the foregoing embodiment of the instruction splitting method where no part of the embodiment of the instruction splitting device is mentioned.
The embodiment of the invention also provides electronic equipment, which is used for operating the instruction splitting method; referring to fig. 7, a schematic structural diagram of an electronic device includes a memory 100 and a processor 101, where the memory 100 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor 101 to implement the instruction splitting method.
Further, the electronic device shown in fig. 7 further includes a bus 102 and a communication interface 103, and the processor 101, the communication interface 103, and the memory 100 are connected through the bus 102.
The Memory 100 may include a high-speed Random Access Memory (RAM) and may further include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, and the like can be used. The bus 102 may be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 7, but this does not indicate only one bus or one type of bus.
The processor 101 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 101. The Processor 101 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 100, and the processor 101 reads the information in the memory 100, and completes the steps of the method of the foregoing embodiment in combination with the hardware thereof.
The embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the instruction splitting method.
The instruction splitting method, the instruction splitting device, and the computer program product of the electronic device provided in the embodiments of the present invention include a computer-readable storage medium storing a program code, where instructions included in the program code may be used to execute the method in the foregoing method embodiments, and specific implementations may refer to the method embodiments and are not described herein again.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and/or the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In addition, in the description of the embodiments of the present invention, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, an electronic device, or a network device) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (11)

1. An instruction splitting method is applied to a forwarding layer of a distributed server, and comprises the following steps:
receiving an instruction to be split, and determining the semaphore of the instruction; wherein the instruction contains a plurality of key-value pairs, the semaphore characterizing a processing stage of the instruction;
splitting the instruction, and sending the split instruction to a plurality of servers;
receiving processing results sent by a plurality of servers, and determining whether the instruction is processed or not based on the semaphore;
if the processing is finished, summarizing the plurality of processing results to obtain a final processing result, and sending the final processing result.
2. The method of claim 1, wherein a client, a load balancer, at least one of the forwarding layers, and a plurality of the servers are communicatively coupled in sequence.
3. The method of claim 2, wherein the step of receiving an instruction to split comprises: receiving an instruction to be split sent by the load balancer; wherein the instruction is sent by the client to the load balancer;
the step of sending the final processing result includes: and sending the final processing result to the client.
4. The method of claim 1, wherein splitting the instruction comprises: splitting the instruction according to a preset hash rule to obtain the split key value pair and a remainder corresponding to the key value pair;
sending the split instruction to a plurality of servers, including: and sending the key value pair to a server corresponding to the remainder.
5. The method according to claim 4, wherein after the step of splitting the instruction by a preset hash rule to obtain the split key-value pair and a remainder corresponding to the key-value pair, the method further comprises: and adjusting the semaphore of the key-value pair.
6. The method of claim 4, wherein the step of receiving the processing results from the plurality of servers comprises: receiving processing results corresponding to the key value pairs sent by a plurality of servers;
determining whether the processing of the instruction is complete based on the semaphore, comprising: and adjusting the semaphore of the key value pair corresponding to the processing result, and determining whether the instruction is processed or not based on the semaphore of the key value pair.
7. The method of claim 6, wherein determining whether the instruction processing is complete based on the semaphore for the key-value pair comprises:
if the semaphore of the key-value pair represents that the key-value pair is processed completely, the instruction processing is completed;
if there is at least one semaphore for the key-value pair that does not characterize completion of the key-value pair processing, the instruction processing is not complete.
8. The method of claim 1, wherein the step of aggregating a plurality of the processing results to obtain a final processing result comprises:
and summarizing the processing results through a preset aggregation function to obtain a final processing result.
9. An instruction splitting apparatus applied to a forwarding layer of a distributed server, the apparatus comprising:
the instruction receiving module is used for receiving an instruction to be split and determining the semaphore of the instruction; wherein the instruction contains a plurality of key-value pairs, the semaphore characterizing a processing stage of the instruction;
the instruction splitting module is used for splitting the instruction and sending the split instruction to a plurality of servers;
the processing result receiving module is used for receiving processing results sent by a plurality of servers and determining whether the processing of the instruction is finished or not based on the semaphore;
and the processing result sending module is used for summarizing the plurality of processing results to obtain a final processing result and sending the final processing result if the processing is finished.
10. An electronic device comprising a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement the steps of the instruction splitting method of any of claims 1-8.
11. A computer-readable storage medium having stored thereon computer-executable instructions that, when invoked and executed by a processor, cause the processor to perform the steps of the instruction splitting method of any of claims 1-8.
CN202210016105.0A 2022-01-07 2022-01-07 Instruction splitting method and device and electronic equipment Pending CN114356421A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210016105.0A CN114356421A (en) 2022-01-07 2022-01-07 Instruction splitting method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210016105.0A CN114356421A (en) 2022-01-07 2022-01-07 Instruction splitting method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN114356421A true CN114356421A (en) 2022-04-15

Family

ID=81106783

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210016105.0A Pending CN114356421A (en) 2022-01-07 2022-01-07 Instruction splitting method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN114356421A (en)

Similar Documents

Publication Publication Date Title
CN111367983B (en) Database access method, system, device and storage medium
WO2022068333A1 (en) Access request processing method and apparatus, electronic device, and computer-readable storage medium
CN109461079B (en) Transaction processing method and device based on block chain
CN110659151B (en) Data verification method and device and storage medium
CN112256495A (en) Data transmission method and device, computer equipment and storage medium
CN110650209B (en) Method and device for realizing load balancing
WO2016169237A1 (en) Data processing method and device
CN110727738B (en) Global routing system based on data fragmentation, electronic equipment and storage medium
CN112346871A (en) Request processing method and micro-service system
CN114356421A (en) Instruction splitting method and device and electronic equipment
US11881996B2 (en) Input and output for target device communication
CN111459913A (en) Capacity expansion method and device of distributed database and electronic equipment
CN112887113A (en) Method, device and system for processing data
CN113626472B (en) Method and device for processing order data
CN115914131A (en) Implementation method and device for improving service quality of Internet of things, electronic equipment and medium
CN113377866A (en) Load balancing method and device for virtualized database proxy service
CN112433850A (en) Method, device and equipment for global scheduling of tasks and readable medium
CN114422434A (en) Hot key storage method and device
CN108520025A (en) A kind of service node determines method, apparatus, equipment and medium
CN113709209B (en) Server software downloading method, system and computer readable storage medium
JP6646340B2 (en) Dispersing apparatus and dispersing method
CN118626171A (en) Method, device and system for loading resource file
CN114356579A (en) Analysis method and device for memory cache service node and server
CN116016374A (en) Block chain-based data processing method, device, equipment and readable storage medium
CN115914202A (en) File downloading method, file caching method and server

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination