+

CN110955523B - Service processing method and device - Google Patents

Service processing method and device Download PDF

Info

Publication number
CN110955523B
CN110955523B CN201911158973.7A CN201911158973A CN110955523B CN 110955523 B CN110955523 B CN 110955523B CN 201911158973 A CN201911158973 A CN 201911158973A CN 110955523 B CN110955523 B CN 110955523B
Authority
CN
China
Prior art keywords
task
node
hash calculation
hash
request
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.)
Active
Application number
CN201911158973.7A
Other languages
Chinese (zh)
Other versions
CN110955523A (en
Inventor
刘铁
姜丰
高建斌
杨燕明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Unionpay Co Ltd
Original Assignee
China Unionpay 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 China Unionpay Co Ltd filed Critical China Unionpay Co Ltd
Priority to CN201911158973.7A priority Critical patent/CN110955523B/en
Publication of CN110955523A publication Critical patent/CN110955523A/en
Application granted granted Critical
Publication of CN110955523B publication Critical patent/CN110955523B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • G06F9/5088Techniques for rebalancing the load in a distributed system involving task migration
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Economics (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Marketing (AREA)
  • General Business, Economics & Management (AREA)
  • Finance (AREA)
  • Development Economics (AREA)
  • Accounting & Taxation (AREA)
  • General Engineering & Computer Science (AREA)
  • Hardware Redundancy (AREA)

Abstract

本发明实施例提供了一种业务处理方法及装置,涉及数据处理技术领域,该方法可以应用于服务器系统中的第一节点,该第一节点包括至少一个服务器。该方法包括:第一节点接收来自客户端的任务请求。因任务请求包括任务参数,所以第一节点对任务参数进行哈希计算,生成哈希计算结果。第一节点向服务器系统中的其它节点发送通知消息,该通知消息用于指示第一节点已完成哈希计算。其它节点向第一节点发送反馈消息,该反馈消息用于指示确认任务由第一节点执行,第一节点接收来自其它节点的反馈消息后,确定反馈消息的个数超过设定阈值时,执行任务,并生成任务执行结果。该方法用以解决现有技术的中心管理服务器集群系统存在容错性低、抗攻击性弱的问题。

Figure 201911158973

Embodiments of the present invention provide a service processing method and device, which relate to the technical field of data processing. The method can be applied to a first node in a server system, where the first node includes at least one server. The method includes: the first node receives a task request from a client. Because the task request includes task parameters, the first node performs hash calculation on the task parameters to generate a hash calculation result. The first node sends a notification message to other nodes in the server system, where the notification message is used to indicate that the first node has completed the hash calculation. Other nodes send a feedback message to the first node, and the feedback message is used to indicate that the confirmation task is performed by the first node. After the first node receives the feedback message from other nodes and determines that the number of feedback messages exceeds the set threshold, the task is executed. , and generate the task execution result. The method is used to solve the problems of low fault tolerance and weak attack resistance in the central management server cluster system in the prior art.

Figure 201911158973

Description

Service processing method and device
Technical Field
The embodiment of the invention relates to the technical field of data processing, in particular to a service processing method and device.
Background
With the development of computer technology, more and more technologies are applied in the financial field, and due to the requirements of the financial industry on safety and real-time performance, the requirements of users on a business processing system are higher and higher. Currently, in the financial field, for example, a financial transaction processing system, as shown in fig. 1, a dedicated central management server is generally provided to uniformly manage the financial transactions of the whole cluster. However, such systems have the following disadvantages: 1) if the central management server fails, the whole system cannot continue to work, so that the fault tolerance is low; 2) if the central management server is illegally attacked, the whole system is crashed, so that the attack resistance is weak.
Therefore, there is a need for a transaction processing system that overcomes the above problems to process financial transactions quickly and efficiently.
Disclosure of Invention
The embodiment of the invention provides a service processing method and a service processing device, which are used for solving the problems of low fault tolerance and weak attack resistance of a cluster system with a central management server in the prior art.
In a first aspect, an embodiment of the present invention provides a service processing method, where the method includes:
the method comprises the steps that a first node receives a task request including task parameters from a client, and then carries out Hash calculation on the task parameters to generate a Hash calculation result; further, the first node sends a notification message to other nodes in the server system (the other nodes refer to other nodes not including the first node in the server system) to indicate that the first node of the other nodes has completed the hash calculation; and then the first node receives feedback messages from other nodes, and the feedback messages are used for indicating and confirming that the task is executed by the first node, so after the first node receives the feedback messages from other nodes, when the number of the feedback messages is determined to exceed a set threshold value, the task is executed, and a task execution result is generated.
In the embodiment of the invention, the method does not need to arrange a special central server, each server processes the service according to the method, and even if a certain server is illegally attacked or fails, the whole system can not be crashed, thereby not only overcoming the problems in the prior art, but also improving the efficiency of service processing.
In one possible design, the mission parameters include at least one of the following parameters: user identification, operation time, task request type, task operation type and temporary operator; further, the first node performs hash calculation on the task parameter to generate a hash calculation result, including: and performing hash calculation on at least one of the user identifier, the operation time, the request type, the operation type and the temporary operator to generate a hash calculation result.
In the embodiment of the invention, the task parameter comprises at least one of a user identifier, operation time, a task request type, a task operation type and a temporary operator, and the first node further performs hash calculation according to the task parameter to generate a hash result, so that the fairness of the selection of the execution node is ensured. Because for different tasks, parameters used for decision calculation of the same node are different; however, for the same task, the parameters used for decision calculation by all nodes are the same, so that the initial conditions for calculation by all nodes are the same, the decision of the execution node is completed, the fairness in the decision process is ensured, and the high efficiency and the availability of the decision of the execution node are also ensured.
In one possible design, the hash calculation performed by the first node on at least one of the user identifier, the operation time, the request type, the operation type, and the temporary operator includes: splicing at least two of the user identification, the operation time, the request type, the operation type and the temporary operator into a character string; further, the first node performs hash calculation on the character string by using hash calculation to generate a hash value; when the hash value is a preset value, determining the hash value as a hash calculation result; and when the hash value is not a preset value, adjusting the value of the temporary operator, and then returning to execute to splice at least two of the user identifier, the operation time, the request type, the operation type and the temporary operator into a character string.
In the embodiment of the invention, the process that the node performs hash calculation on the character string to obtain a hash calculation result so as to decide the execution node is further described, so that the high efficiency of the decision process is ensured, and the scheme is simple and feasible.
In one possible design, before the first node performs the task, the method further includes: acquiring task attribute information, wherein the task attribute information comprises at least one of the following attributes: business name, group name, whether concurrency, asynchronous log, batch log, task timeout time, according to fixed period/based on expression; further, when the number of the feedback messages received by the first node exceeds a set threshold, the task is executed according to the task attribute information.
In the embodiment of the invention, the first node executes the task according to the task attribute information and the feedback message, thereby ensuring the accuracy of task execution and the high efficiency of executing node selection;
in a possible design, after the execution result is generated according to the method of the present application, that is, after the first node executes the task, the method further includes: the first node sends the execution result to other nodes in the client and server system.
On one hand, the first node sends the execution result to other nodes, so that the data stored in the database of other nodes and the data stored in the database of the first node are synchronous, even if any one or more nodes in the server system are in failure or attacked, as long as the nodes in the service system work normally, the normal operation of the task can be ensured, namely, the nodes which are not attacked are not affected or are affected little basically. That is, for example, when the second node is attacked or fails, the first node and the third node still work normally and continue to execute tasks, thereby avoiding the situation that the whole cluster system is directly paralyzed when the central server fails or is attacked in the cluster system with the central server. Therefore, the invention not only improves the service processing speed of the server system, enhances the user experience, but also reduces the risk of the server system crash.
On the other hand, the application also realizes that the influence of adding the nodes is minimum. That is to say, in the server system of the present invention, the influence of the added node on the decision calculation is constant time complexity, the influence of the added node on the overall operation efficiency of the server system is reduced to the minimum, and the efficient and orderly service processing is ensured.
In one possible embodiment, when an execution node is attacked or fails, only a constant multiple of the time complexity is needed to perform the calculation again to decide a new execution node. That is, when a problem occurs in the executing node, the task is terminated and task state information is sent to other nodes, and after other nodes receive the message, the normal nodes in the whole server system perform decision calculation of the task again to complete decision of the executing node, so that the overall working efficiency of the server system is not affected, and the service processing efficiency and the reliability of the service processing system are improved.
In a second aspect, an embodiment of the present invention provides a service processing apparatus, and the technical effect of the apparatus can refer to the foregoing method embodiment, where the apparatus includes:
the system comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving a task request from a client, and the task request comprises task parameters;
the processing unit is used for carrying out Hash calculation on the task parameters to generate a Hash calculation result;
a sending unit, configured to send a notification message to other nodes in the server system, where the notification message is used to indicate that the first node has completed the hash calculation;
the receiving unit is further configured to receive a feedback message from the other node, where the feedback message is used to indicate that the task is confirmed to be executed by the first node;
the processing unit is further configured to: and when the number of the feedback messages exceeds a set threshold value, executing the task and generating an execution result.
In one possible design, the mission parameters include at least one of the following parameters: user identification, operation time, task request type, task operation type and temporary operator; further, the processing unit performs hash calculation on the task parameter to generate a hash calculation result, including: and performing hash calculation on at least one of the user identifier, the operation time, the request type, the operation type and the temporary operator to generate a hash calculation result.
In one possible design, the processing unit is further configured to: splicing at least two of the user identification, the operation time, the request type, the operation type and the temporary operator into a character string; then the processing unit calculates the character string by using Hash operation to generate a Hash value; further, when the hash value is a preset value, determining the hash value as a hash calculation result; and when the hash value is not a preset value, adjusting the value of the temporary operator, and returning to execute to splice at least two of the user identifier, the operation time, the request type, the operation type and the temporary operator into a character string.
In one possible design, the processing unit is further configured to: and acquiring task attribute information. Wherein at least one of the following attributes is included: service name, packet name, whether concurrency is supported, asynchronous log, batch log, task timeout time, per fixed period/expression based.
The processing unit is further configured to: and when the number of the feedback messages exceeds a set threshold value, executing the task according to the task attribute information.
In one possible design, the processing unit is further configured to: and sending the execution result to the client and other nodes in the server system.
In a third aspect, an embodiment of the present invention provides a computing device, which includes at least one processing unit and at least one storage unit, where the storage unit stores a computer program, and when the program is executed by the processing unit, the processing unit is caused to execute the service processing method according to any of the above first aspects.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores a computer program executable by a computing device, and when the program runs on the computing device, the computer program causes the computing device to execute the business processing method according to any of the first aspects.
These and other aspects of the invention are apparent from and will be elucidated with reference to the embodiments described hereinafter.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a diagram of a prior art system architecture provided by an embodiment of the present application;
FIG. 2 is a schematic diagram of a possible system architecture provided by an embodiment of the present application;
fig. 3 is a schematic diagram of a system module according to an embodiment of the present application;
fig. 4 is a schematic view of a service processing flow provided in an embodiment of the present application;
fig. 5 is a schematic view of a business processing flow provided in an embodiment of the present application;
fig. 6 is a schematic structural diagram of a service processing apparatus according to an embodiment of the present application;
fig. 7 is a schematic diagram of a computing device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. 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.
Fig. 1 is a schematic diagram of a system architecture in the prior art, which performs unified coordination management on services of an entire cluster system by setting a special central management server 101; the central management server 101 manages the nodes 102, 103, and 104 as a manager of the cluster system. For example, after receiving a task request sent by a client, the central management server 101 selects an execution node according to a preset rule (for example, preferentially selecting a node server with a high processing speed) according to the operating states of the node 102, the node 103, and the node 104. Further, the node that executes the task returns the task execution result to the central management server 101.
As can be seen, once the central management server 101 fails, the task request cannot be distributed, and the node 102, the node 103, and the node 104 cannot work, or once the central management server 101 is illegally attacked, the whole system may also be crashed.
Therefore, the embodiment of the present application provides a service processing method, which is suitable for a decentralized system architecture. FIG. 2 is a schematic diagram of a system architecture suitable for use in the embodiment of the present invention, wherein the server system comprises a plurality of servers; each group of servers may act as a node, where a node may consist of one or more servers. In addition, each node is corresponding to an independent database for storing the calculation result of the current node. Exemplarily, as shown in fig. 2, a system is provided with a first node 201, a second node 202, and a third node 203, each node is provided with a first database 204, a second database 205, and a third database 206, respectively, for storing relevant execution results of executing tasks; a node administrator can monitor and manage the whole system through the client server, so that efficient operation of the service processing system is ensured.
It should be noted that fig. 2 is only an exemplary and simple illustration, and does not constitute a limitation to the scheme, and in the specific implementation, the number of nodes and the structure and function of the nodes may be set by those skilled in the art as needed, and are not specifically limited.
Fig. 3 is a schematic diagram of system modules of each server in a node, and in fig. 3, the server includes 7 modules for implementing functions such as monitoring tasks, performing permission determination, performing monitoring, and state synchronization, and the specific modules and functions are as follows.
The task parameter loading module 301 is configured to load task configuration parameters, customize various attributes of the task, and use the customized task when the task is executed.
A task listening module 302, configured to listen to a task request from a client, where the task request may be a task request initiated by a user on the client or a task request automatically triggered by a timer on the client.
The task execution right determining module 303 is a core module of the server system, and is configured to decide an execution node for executing the task through a hash algorithm.
And the task execution module 304 is used for executing the current task according to the task request.
And the task monitoring module 305 is configured to monitor an operation condition of the currently executed task according to the task parameter.
And the task state synchronization module 306 is used for synchronizing the task execution result to the client and other servers.
And the system management module 307 is used for providing functions of human-computer interaction, task regulation and control by an administrator and the like.
Fig. 4 is a schematic flow chart of a service processing method according to an embodiment of the present invention, where the method may be executed by each node shown in fig. 2, and is exemplarily described below with an execution subject as a first node 201, where the method includes the following steps.
In step 401, a first node receives a task request from a client, where the task request includes task parameters.
In connection with fig. 3, the task listening module 302 of the first server in the first node listens for a task request from the client, where the task request may be a task request initiated by a user on the client or a task request triggered automatically by a timer on the client.
Illustratively, the task request may be a task sent by the user, such as user a is conducting a card-swiping payment consumption; or a timing task sent by the client, such as bank's accounting clearing for all users at 8 o' clock every night; for example, the administrator may implement a task restart through the system management module 307 when monitoring a task execution failure. For example, the administrator sends a command of "restart task number 001" to the server system through the machine room. For example, now the clearing time of a new specified bank in a certain department is changed from 20 to 22, or the clearing is suspended, the administrator can modify the task execution time by modifying the configuration parameters of the task through the machine room, and adjust the task request.
Wherein the task parameter may include at least one of the following parameters: user identification, operation time, task request type, task operation type and temporary operator. After receiving the task request, the node may determine, in combination with the task parameter, whether the task may be executed, for example, by "user identification" and "operation time", to distinguish whether the task may be executed by the first node.
And 402, performing hash calculation on the task parameters by the first node to generate a hash calculation result.
In this embodiment, referring to fig. 3, the task execution right determining module 303 may splice at least two of the user identifier, the operation time, the request type, the operation type, and the temporary operator into a character string; and then carrying out hash calculation on the character string to generate a hash calculation result. When the task execution right determination module 303 can generate the hash calculation result faster, for example, the first node is the first hash calculation result generated in the entire system, it indicates that the processing speed of the first node is fast and the task request has enough computing power to be processed. Otherwise, it means that the processing speed of the first node is slow and there is not enough computing power to process the task request.
Illustratively, the task execution right determining module 303 splices the user name, the operation time, the operation type, the request type, and the temporary operator (the initial value of the temporary operator is 000) into a character string, then calculates the character string using SHA256 (hash algorithm), and stops calculating if the first three bits (the upper limit of the support node is 1 thousand) of the obtained hash calculation result are pure numbers, and determines that the first node has completed the hash calculation; and if the first four non-pure digits of the obtained hash calculation result are obtained, adjusting the initial value of the temporary operator, and returning to execute the splicing character string again.
In other words, when the hash calculation result is a preset value, it is determined that the first node has completed the calculation; and when the Hash calculation result is not a preset value, adjusting the value of the temporary operator, returning to execute to splice at least two of the user identifier, the operation time, the request type, the operation type and the temporary operator into a character string, and performing Hash calculation again.
In step 403, the first node sends a notification message to other nodes in the server system, where the notification message is used to indicate that the first node has completed the hash calculation.
That is, when the task execution right determination module 303 obtains the hash calculation result, the calculation is stopped. And the first node sends a notification message to other nodes (e.g. the second node and the third node), wherein the notification message is used for notifying the second node and the third node that the computation is completed (the other nodes stop the computation after receiving the notification). Optionally, during the calculation process of the first node, notification messages from other nodes may also be received.
In step 404, the first node receives a feedback message from the other nodes, the feedback message indicating confirmation that the task was performed by the first node.
Optionally, the first node completes the hash calculation first, and generates a hash calculation result, and then the second node and the third node receive the notification message of the first node in the calculation process, and then the second node and the third node stop calculating, and send a feedback message to the first node, so as to indicate that the task is executed by the first node. That is, the second node and the third node no longer process the task.
And 405, when the number of the feedback messages exceeds a set threshold, executing the task by the first node, and generating a task execution result.
Referring to fig. 3, after the task execution right determining module 303 determines that the received feedback message exceeds the set threshold, it is determined that the first node executes the task request. Illustratively, the second node and the third node both send feedback messages to the first node, and then the first node confirms that the task request is executed by itself. In practical applications, if there are N nodes in the system shown in fig. 2, after the first node receives the feedback messages of more than half (for example, N × 50%) of the nodes, it may be determined that the task is executed by itself.
In one possible embodiment, after the first node generates the task execution result, the first node may synchronize the task execution result to the database of the other node. Specifically, the task monitoring module 305 monitors the running condition of the currently executed task, and when it is determined that the task execution module 304 generates a task execution result, the notification task state synchronization module 306 sends a notification message including the task execution result to the other node, so that the other node synchronously saves the task execution result in the notification message to the database.
Optionally, after the first node executes the task, for example, after the user a completes the card swiping operation through the first node, the task state synchronization module 306 sends the task state information to other nodes. Illustratively, "000" represents a task in progress, "001" represents a task execution completion, "002" represents a task execution failure; if the task fails to be executed, after receiving the message including "002" sent by the task state synchronization module 306 of the first node, the task monitoring modules 305 of the second node and the third node re-determine the execution node of the task.
In a possible embodiment, before performing step 401, the first node needs to determine whether the task request includes an identifier of a designated execution node, and if the task request does not include the identifier of the designated execution node, the first node performs the processing according to the method, otherwise, if the task request includes the identifier of the designated execution node (e.g., the second node), the first node does not perform the method, but the designated execution node, such as the second node, performs the task in the task request.
In a possible embodiment, after the first node determines that the first node executes the task, the first node may obtain the task configuration parameter, and execute the task according to the task configuration parameter. Wherein the task configuration parameter may include at least one of the following attributes: service name, packet name, whether concurrency is supported, asynchronous log, batch log, task timeout time, per fixed period/expression based.
Illustratively, the task execution module 304 executes a task, wherein the task monitoring module 305 monitors the execution time of the task, determines that the task fails to execute if the execution time of the task exceeds the "task timeout time" in the task configuration parameter information of the task, and then the task state synchronization module 306 synchronizes the information of the task failed to execute to other nodes. Illustratively, the task execution module 304 determines relevant information of the task according to the "service name", "packet name", "name" and the like in the task configuration parameter, and executes the corresponding task.
Exemplarily, in the method described above, referring to fig. 2, it is assumed that the first node 201, the second node 202, and the third node 203 all receive a task request, and the first node 201, the second node 202, and the third node 203 all perform hash calculation according to the method described above, and it is assumed that the first node 201 calculates the hash calculation result first, and the first node 201 does not receive a notification message in the calculation process, and after the first node sends the notification message to other nodes, receives two feedback messages sent from the second node 202 and the third node 203, so that the first node confirms that the task is executed by itself. The first node performs the task and then synchronizes the results of the execution to the second database 205 of the second node 202 and to the third database 206 of the third node 203.
In order to describe the service processing method more systematically, an embodiment of the present invention further provides a schematic flow chart of the service processing method shown in fig. 5, which is described by taking the first server in the first node 201 in fig. 2 as an example, and specific steps are as follows.
In step 501, the task parameter loading module 301 in the first server of the first node 201 loads task configuration parameters, so that the task execution module 304 executes a task, and the task monitoring module 305 monitors the execution of the task.
The task configuration parameters comprise service names, packet names, whether concurrency is supported or not, asynchronous logs, batch logs, task timeout time, task attribute information according to fixed periods/expressions and the like. Step 502, the task monitoring module 305 in the first server starts a task monitoring service, and monitors the task execution state in the node by combining the task configuration parameters.
For example, the task monitoring module 305 monitors the task execution according to the information related to the task execution in the task configuration parameters. Illustratively, a three-digit number at a position in the task configuration parameter, "000" represents that the task is in progress, "001" represents that the task execution is completed, and "002" represents that the task execution fails.
In step 503, the system management module 307 in the first server receives the task request sent by the client.
In step 504, the task listening module 302 in the first server may listen to the task request received from the client by the system management module 307.
Specifically, when the task listening module 302 listens to a task request, the task execution module 304 is triggered to create an instance program of the task, so as to perform the subsequent steps. For example, a task instance of "user a pay by swiping a card in 2019 at 11, 5, 17 o' clock 05" is created.
In step 505, the task execution right determination module 303 in the first server determines the execution node, and selects the node for executing the task.
Specifically, the determination rule of the task execution right determination may be any one or more of the following manners.
In a first mode, if the task request is of a specified class, that is, the task request includes information specifying a certain node as an executing node, for example, "the first node executes the task. Firstly, each node compares the number of a first node in a task request with the number of the node, executes a corresponding task when the comparison result is consistent, otherwise, abandons the execution; illustratively, the user A purchases goods at the carrefour and performs a card swiping payment operation, wherein the carrefour designates the first node as an execution node, and then the task request of the user A is directly executed by the first node.
In a second mode, if the task request is of a timing type, namely the task request is scheduled to be executed at a certain time, an execution node is determined according to the unique identifier of the task request through the distributed database; illustratively, the bank fixes 10 o ' clock at night each day to carry out fund clearing on the account, the task request of ' fund clearing ' generates a unique time information identifier, and the node determines the execution node by using the time information identifier.
In a third mode, if the task request does not belong to the above categories, the task execution weight determination module 303 calculates and splices the obtained character string through a hash algorithm. And the first server sends the calculated information to other nodes after calculation, the other nodes stop calculation after receiving the information and feed back the information to the node as a feedback message, and when the first node where the first server is located receives the feedback message exceeding a set threshold value, the first node is determined to be an execution node.
Illustratively, the task execution right determining module 303 reads the attribute information of the task request to obtain a decision computation input operator: user identification, operation time, operation type, request type and temporary operator, wherein the initial value of the temporary operator is 000. The decision computation input operators are then spliced into a string, and the SHA256 is used to compute the hash value for the string.
Further, if the first three bits (upper limit of the support node is 1 thousand) N of the obtained hash value are pure numbers, the hash value is a hash calculation result, the calculation is stopped, and other nodes are informed that the calculation is finished (the calculation is stopped after the other nodes receive the notification), and meanwhile, the other nodes feed back and approve the node; and if the first four non-pure digits of the result are obtained, updating the value of the temporary operator to the calculation result N, recalculating the hash value until the first three digits (the upper limit of the support node is 1 thousand) N of the result are obtained to be pure digits, returning to the previous step, or receiving a notice that other nodes finish the calculation, and stopping the calculation.
Finally, after the first server receives the feedback messages of more than 50% of the nodes, the first node where the first server is located is determined to be the execution node, and the rest nodes do not execute the task any more.
In step 506, the task execution module 304 executes the task according to the task configuration parameters loaded by the task parameter loading module 301.
In step 507, after the task is executed, the task state synchronization module 306 synchronizes the task execution result to the database of another node.
Based on the same technical concept, the embodiment of the invention also provides a service processing device, and the device can execute the embodiment of the method. As shown in fig. 6, the apparatus provided in the embodiment of the present invention includes:
a receiving unit 601, configured to receive a task request from a client, where the task request includes task parameters;
a processing unit 602, configured to perform hash calculation on the task parameter to generate a hash calculation result;
a sending unit 603, configured to send a notification message to other nodes in the server system, where the notification message is used to indicate that the first node has completed the hash calculation;
a receiving unit 601, further configured to receive a feedback message from another node, where the feedback message is used to indicate that it is confirmed that the task is executed by the first node;
the processing unit 602 is further configured to execute the task and generate an execution result when the number of the feedback messages exceeds a set threshold.
In one possible design, the mission parameters include at least one of the following parameters: user identification, operation time, task request type, task operation type and temporary operator; the processing unit 602 is specifically configured to perform hash calculation on at least one of the user identifier, the operation time, the request type, the operation type, and the temporary operator, and generate a hash calculation result.
In a possible design, the processing unit 602 is specifically configured to splice at least two of the user identifier, the operation time, the request type, the operation type, and the temporary operator into a character string; then the first node calculates the character string by using Hash operation to generate a Hash value; when the hash value is a preset value, determining the hash value as a hash calculation result; and when the hash value is not a preset value, adjusting the value of the temporary operator, and returning to execute to splice at least two of the user identifier, the operation time, the request type, the operation type and the temporary operator into a character string.
In one possible design, the processing unit 602 is further configured to obtain task attribute information, where the task attribute information includes at least one of the following attribute information: service name, packet name, whether concurrency is supported, asynchronous log, batch log, task timeout time, per fixed period/expression based.
And when the number of the feedback messages exceeds a set threshold value, executing the task according to the task attribute information.
In a possible design, the sending unit 603 is further configured to send the execution result to other nodes in the client and server system after generating the execution result.
Based on the same technical concept, the embodiment of the present invention provides a computing device, as shown in fig. 7, including at least one processor 701 and a memory 702 connected to the at least one processor, where a specific connection medium between the processor 701 and the memory 702 is not limited in the embodiment of the present invention, and the processor 701 and the memory 702 are connected through a bus in fig. 7 as an example. The bus may be divided into an address bus, a data bus, a control bus, etc.
In the embodiment of the present invention, the memory 702 stores instructions executable by the at least one processor 701, and the at least one processor 701 may execute the steps included in the aforementioned settlement method by executing the instructions stored in the memory 702.
The processor 701 is a control center of the terminal device, and may connect various parts of the terminal device by using various interfaces and lines, and process data by executing or executing instructions stored in the memory 702 and calling data stored in the memory 702. Optionally, the processor 701 may include one or more processing units, and the processor 701 may integrate an application processor and a modem processor, wherein the application processor mainly handles an operating system, a user interface, an application program, and the like, and the modem processor mainly handles wireless communication. It will be appreciated that the modem processor described above may not be integrated into the processor 701. In some embodiments, processor 701 and memory 702 may be implemented on the same chip, or in some embodiments, they may be implemented separately on separate chips.
The processor 701 may be a general-purpose processor, such as a Central Processing Unit (CPU), a digital signal processor, an Application Specific Integrated Circuit (ASIC), a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof, configured to implement or perform the methods, steps, and logic blocks disclosed in embodiments of the present invention. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.
Memory 702, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The Memory 702 may include at least one type of storage medium, and may include, for example, a flash Memory, a hard disk, a multimedia card, a card-type Memory, a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Programmable Read Only Memory (PROM), a Read Only Memory (ROM), a charge Erasable Programmable Read Only Memory (EEPROM), a magnetic Memory, a magnetic disk, an optical disk, and so on. The memory 702 is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to such. The memory 702 of embodiments of the present invention may also be circuitry or any other device capable of performing a storage function to store program instructions and/or data.
Based on the same technical concept, embodiments of the present invention provide a computer-readable medium storing a computer program executable by a terminal device, the program causing the terminal device to perform steps of a settlement method when the program runs on the terminal device.
It should be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may 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 means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (12)

1.一种业务处理方法,应用于服务器系统中的第一节点,所述第一节点包括至少一个服务器,其特征在于,包括:1. A service processing method, applied to a first node in a server system, the first node comprising at least one server, characterized in that, comprising: 接收来自客户端的任务请求,所述任务请求包括任务参数;receiving a task request from a client, the task request including task parameters; 对所述任务参数进行哈希计算,生成哈希计算结果;Hash calculation is performed on the task parameters to generate a hash calculation result; 向所述服务器系统中的其它节点发送通知消息,所述通知消息用于指示所述第一节点已完成所述哈希计算;sending a notification message to other nodes in the server system, where the notification message is used to indicate that the first node has completed the hash calculation; 接收来自所述其它节点的反馈消息,所述反馈消息用于指示确认所述任务由所述第一节点执行;receiving a feedback message from the other node, the feedback message being used to indicate confirmation that the task is performed by the first node; 当所述反馈消息的个数超过设定阈值时,执行所述任务,并生成任务执行结果。When the number of the feedback messages exceeds the set threshold, the task is executed, and a task execution result is generated. 2.如权利要求1所述的方法,其特征在于,所述任务参数包括如下参数中的至少一个:用户标识、操作时间、任务请求类型、任务操作类型、临时算子;2. The method of claim 1, wherein the task parameter comprises at least one of the following parameters: user ID, operation time, task request type, task operation type, and temporary operator; 对所述任务参数进行哈希计算,生成哈希计算结果,包括:Hash calculation is performed on the task parameters, and a hash calculation result is generated, including: 对所述用户标识、操作时间、请求类型、操作类型、临时算子中的至少一个,进行哈希计算,生成哈希计算结果。Perform a hash calculation on at least one of the user ID, operation time, request type, operation type, and temporary operator to generate a hash calculation result. 3.如权利要求2所述的方法,其特征在于,所述对所述用户标识、操作时间、请求类型、操作类型、临时算子中的至少一个,进行哈希计算,包括:3. The method according to claim 2, wherein, performing hash calculation on at least one of the user identifier, operation time, request type, operation type, and temporary operator, comprising: 将所述用户标识、操作时间、请求类型、操作类型、临时算子中的至少两个拼接成一个字符串;splicing at least two of the user identification, operation time, request type, operation type, and temporary operator into a string; 使用哈希运算对所述字符串进行哈希计算,生成哈希值;Hash calculation is performed on the string using a hash operation to generate a hash value; 当所述哈希值为预设值时,则确定所述哈希值为所述哈希计算结果;When the hash value is a preset value, determine that the hash value is the hash calculation result; 当所述哈希值不为预设值时,调整所述临时算子的取值,返回执行将所述用户标识、操作时间、请求类型、操作类型、临时算子中的至少两个拼接成一个字符串。When the hash value is not the preset value, adjust the value of the temporary operator, and return to execute at least two of the user ID, operation time, request type, operation type, and temporary operator to be spliced into a a string. 4.如权利要求1所述的方法,其特征在于,执行所述任务之前,还包括:4. The method of claim 1, wherein before performing the task, further comprising: 获取任务属性信息,所述任务属性信息包括如下属性中的至少一个:业务名、分组名、名称、是否支持并发、异步日志、批量日志、任务超时时间、按固定周期/基于表达式;Obtain task attribute information, where the task attribute information includes at least one of the following attributes: business name, group name, name, whether to support concurrency, asynchronous logs, batch logs, task timeout, fixed period/expression-based; 当所述反馈消息的个数超过设定阈值时,执行所述任务,包括:When the number of the feedback messages exceeds the set threshold, the task is performed, including: 当所述反馈消息的个数超过设定阈值时,根据所述任务属性信息执行所述任务。When the number of the feedback messages exceeds a set threshold, the task is executed according to the task attribute information. 5.如权利要求1至4任一项所述的方法,其特征在于,所述生成任务执行结果之后,还包括:5. The method according to any one of claims 1 to 4, wherein after the generating the task execution result, the method further comprises: 将所述执行结果发送至所述客户端及所述服务器系统中的其它节点。The execution result is sent to the client and other nodes in the server system. 6.一种业务处理装置,应用于服务器系统中的第一节点,所述第一节点包括至少一个服务器,其特征在于,所述装置包括:6. A service processing device, applied to a first node in a server system, the first node comprising at least one server, wherein the device comprises: 接收单元,用于接收来自客户端的任务请求,所述任务请求包括任务参数;a receiving unit, configured to receive a task request from a client, the task request including task parameters; 处理单元,用于对所述任务参数进行哈希计算,生成哈希计算结果;a processing unit, configured to perform hash calculation on the task parameters, and generate a hash calculation result; 发送单元,用于向所述服务器系统中的其它节点发送通知消息,所述通知消息用于指示所述第一节点已完成所述哈希计算;a sending unit, configured to send a notification message to other nodes in the server system, where the notification message is used to indicate that the first node has completed the hash calculation; 所述接收单元,还用于接收来自所述其它节点的反馈消息,所述反馈消息用于指示确认所述任务由所述第一节点执行;The receiving unit is further configured to receive a feedback message from the other node, where the feedback message is used to indicate confirmation that the task is performed by the first node; 所述处理单元,还用于当所述反馈消息的个数超过设定阈值时,执行所述任务,并生成执行结果。The processing unit is further configured to execute the task and generate an execution result when the number of the feedback messages exceeds a set threshold. 7.如权利要求6所述的装置,其特征在于,所述任务参数包括如下参数中的至少一个:用户标识、操作时间、任务请求类型、任务操作类型、临时算子;7. The apparatus according to claim 6, wherein the task parameter comprises at least one of the following parameters: user ID, operation time, task request type, task operation type, and temporary operator; 所述处理单元具体用于:The processing unit is specifically used for: 对所述用户标识、操作时间、请求类型、操作类型、临时算子中的至少一个,进行哈希计算,生成哈希计算结果。Perform a hash calculation on at least one of the user identifier, operation time, request type, operation type, and temporary operator to generate a hash calculation result. 8.如权利要求7所述的装置,其特征在于,所述处理单元具体用于:8. The apparatus according to claim 7, wherein the processing unit is specifically configured to: 将所述用户标识、操作时间、请求类型、操作类型、临时算子中的至少两个拼接成一个字符串;splicing at least two of the user identification, operation time, request type, operation type, and temporary operator into a string; 使用哈希运算对所述字符串进行哈希计算,生成哈希值;Hash calculation is performed on the string using a hash operation to generate a hash value; 当所述哈希值为预设值时,则确定所述哈希值为所述哈希计算结果;When the hash value is a preset value, determine that the hash value is the hash calculation result; 当所述哈希值不为预设值时,调整所述临时算子的取值,返回执行将所述用户标识、操作时间、请求类型、操作类型、临时算子中的至少两个拼接成一个字符串。When the hash value is not the preset value, adjust the value of the temporary operator, and return to execute at least two of the user ID, operation time, request type, operation type, and temporary operator to be spliced into a a string. 9.如权利要求6所述的装置,其特征在于,所述处理单元还用于:9. The apparatus of claim 6, wherein the processing unit is further configured to: 获取任务属性信息,所述任务属性信息包括如下属性中的至少一个:业务名、分组名、名称、是否支持并发、异步日志、批量日志、任务超时时间、按固定周期/基于表达式;Obtain task attribute information, where the task attribute information includes at least one of the following attributes: business name, group name, name, whether to support concurrency, asynchronous logs, batch logs, task timeout, fixed period/expression-based; 当所述反馈消息的个数超过设定阈值时,根据所述任务属性信息执行所述任务。When the number of the feedback messages exceeds a set threshold, the task is executed according to the task attribute information. 10.如权利要求6至9任一项所述的装置,其特征在于,所述发送单元还用于:10. The device according to any one of claims 6 to 9, wherein the sending unit is further configured to: 将所述执行结果发送至所述客户端及所述服务器系统中的其它节点。The execution result is sent to the client and other nodes in the server system. 11.一种计算设备,其特征在于,包括至少一个处理单元以及至少一个存储单元,其中,所述存储单元存储有计算机程序,当所述程序被所述处理单元执行时,使得所述处理单元执行权利要求1-5任一权利要求所述的方法。11. A computing device, comprising at least one processing unit and at least one storage unit, wherein the storage unit stores a computer program, and when the program is executed by the processing unit, the processing unit is executed. The method of any of claims 1-5 is performed. 12.一种计算机可读存储介质,其特征在于,其存储有可由计算设备执行的计算机程序,当所述程序在所述计算设备上运行时,使得所述计算设备执行权利要求1-5任一权利要求所述的方法。12. A computer-readable storage medium, characterized in that it stores a computer program executable by a computing device, and when the program is executed on the computing device, the computing device is made to perform any one of claims 1-5. A method as claimed in claim.
CN201911158973.7A 2019-11-22 2019-11-22 Service processing method and device Active CN110955523B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911158973.7A CN110955523B (en) 2019-11-22 2019-11-22 Service processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911158973.7A CN110955523B (en) 2019-11-22 2019-11-22 Service processing method and device

Publications (2)

Publication Number Publication Date
CN110955523A CN110955523A (en) 2020-04-03
CN110955523B true CN110955523B (en) 2022-03-08

Family

ID=69978307

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911158973.7A Active CN110955523B (en) 2019-11-22 2019-11-22 Service processing method and device

Country Status (1)

Country Link
CN (1) CN110955523B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111679807B (en) * 2020-06-03 2024-04-16 中国银行股份有限公司 Demand management method and device
CN112256437B (en) * 2020-11-10 2024-10-18 网易(杭州)网络有限公司 Task distribution method and device
CN112202687B (en) * 2020-12-03 2021-05-25 苏州浪潮智能科技有限公司 Node synchronization method, device, equipment and storage medium
CN113742075B (en) * 2021-09-07 2024-04-09 北京百度网讯科技有限公司 Task processing method, device and system based on cloud distributed system
CN115150031B (en) * 2022-06-20 2024-02-27 中国工商银行股份有限公司 Distributed system message response method and device based on distributed message

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107231402B (en) * 2016-08-31 2021-02-12 北京新媒传信科技有限公司 HTTP request processing method, device and system
CN107124278B (en) * 2017-03-30 2021-03-30 腾讯科技(深圳)有限公司 Business processing method, device and data sharing system
CN107395353B (en) * 2017-04-24 2020-01-31 阿里巴巴集团控股有限公司 block chain consensus method and device
CN107846289B (en) * 2017-10-11 2020-08-11 众安信息技术服务有限公司 A method, electronic device and system for supporting human participation in decision-making in blockchain
CN108446976B (en) * 2018-02-07 2019-05-24 平安科技(深圳)有限公司 A kind of common reserve fund transfer method, computer readable storage medium and terminal device
US11531975B2 (en) * 2018-04-13 2022-12-20 International Business Machines Corporation Network node management on a blockchain

Also Published As

Publication number Publication date
CN110955523A (en) 2020-04-03

Similar Documents

Publication Publication Date Title
CN110955523B (en) Service processing method and device
JP5206674B2 (en) Virtual machine management apparatus, virtual machine management method, and virtual machine management program
EP2746948A1 (en) Device and method for optimization of data processing in a MapReduce framework
CN110113387A (en) A kind of processing method based on distributed batch processing system, apparatus and system
CN111897633A (en) Task processing method and device
CN110163554B (en) Workflow operation method, device, server and storage medium
CN103593236A (en) Computer equipment, method and device for scheduling service process
CN111160873A (en) Batch processing device and method based on distributed architecture
CN110381150B (en) Data processing method and device on block chain, electronic equipment and storage medium
CN111831408A (en) Asynchronous task processing method and device, electronic equipment and medium
CN110609749A (en) Distributed task operation method, system and equipment
CN110363663A (en) Block chain-based data batch processing method, device, equipment and storage medium
CN110162407A (en) A kind of method for managing resource and device
CN109885382A (en) Cross-system distributed transaction processing method and system for distributed transaction processing
WO2021121407A1 (en) Capacity changing method and apparatus for virtual machine
CN111782253A (en) Rolling upgrade control method, device, device and storage medium
CN113326153A (en) Service request processing method and device
CN110275767A (en) A batch data processing method and device
CN111754117B (en) Task issuing method and device, electronic equipment and storage medium
CN111698266A (en) Service node calling method, device, equipment and readable storage medium
CN111679899A (en) Task scheduling method, device, platform equipment and storage medium
CN107958414B (en) Method and system for eliminating long transactions of CICS (common integrated circuit chip) system
CN117114613A (en) A process engine, method, equipment and program product for business process control
CN114584567A (en) Block chain-based batch job processing method and device
CN114153610A (en) A thread-based user quota method, device and storage medium

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
GR01 Patent grant
GR01 Patent grant
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载