CN109040227B - Service request response method and device based on block chain and computer equipment - Google Patents

Service request response method and device based on block chain and computer equipment Download PDF

Info

Publication number
CN109040227B
CN109040227B CN201810847172.0A CN201810847172A CN109040227B CN 109040227 B CN109040227 B CN 109040227B CN 201810847172 A CN201810847172 A CN 201810847172A CN 109040227 B CN109040227 B CN 109040227B
Authority
CN
China
Prior art keywords
data
block chain
target
task
service
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
CN201810847172.0A
Other languages
Chinese (zh)
Other versions
CN109040227A (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.)
Jiangxi Tanwan Information Technology Co ltd
Original Assignee
Jiangxi Tanwan Information 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 Jiangxi Tanwan Information Technology Co ltd filed Critical Jiangxi Tanwan Information Technology Co ltd
Priority to CN201810847172.0A priority Critical patent/CN109040227B/en
Publication of CN109040227A publication Critical patent/CN109040227A/en
Application granted granted Critical
Publication of CN109040227B publication Critical patent/CN109040227B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a service request response method, a system, computer equipment and a storage medium based on a block chain. The method comprises the following steps: acquiring a service request sent by a client, wherein the service request carries service identification information of target service data; determining a data return type task corresponding to the service request according to the service identification information; sending a data query instruction to a target block chain node in a pre-established block chain according to the data return type task, wherein the data query instruction is used for indicating the target block chain node to query and return the target service data in local storage data; and when the target service data returned by the target block chain node is received, returning the received target service data to the client. By adopting the method, the waiting time of the user can be reduced.

Description

Service request response method and device based on block chain and computer equipment
Technical Field
The present invention relates to the field of network technologies, and in particular, to a service request response method and apparatus based on a block chain, a computer device, and a storage medium.
Background
With the development of network information technology, the service applications of related technologies performed by network information platforms are increasing, such as network car booking, network house renting, and the like. With the rapid development of these network technology applications, more and more client devices interact with the server. In addition, a main function corresponding to a service request is often mixed with a plurality of other auxiliary functions, for example, when login is requested, a database is queried to extract user related information, and then a login state is returned; when a recommendation list is requested, the post content is associated with the user, and the data table content of non-posts such as praise users, comment users, attention users and the like is associated or the number of users paying attention to the post, the total number of messages and the like need to be dynamically calculated.
In a traditional mode, a direct synchronous calculation mode is adopted for responding to a service request, the service request sent from a client to a server in the mode usually needs to spend more time at the server to return main function data to the server, and the waiting time of a user is longer.
Disclosure of Invention
In view of the foregoing, there is a need to provide a service request response method, apparatus, computer device and storage medium based on a block chain, which can reduce user latency.
A service request response method based on a block chain, the method comprises the following steps:
acquiring a service request sent by a client, wherein the service request carries service identification information of target service data;
determining a data return type task corresponding to the service request according to the service identification information;
sending a data query instruction to a target block chain node in a pre-established block chain according to the data return type task, wherein the data query instruction is used for indicating the target block chain node to query and return the target service data in local storage data;
and when the target service data returned by the target block chain node is received, returning the received target service data to the client.
In one embodiment, the sending a data query instruction to a target blockchain node in a pre-established blockchain according to the data return type task may include: and taking the block chain link point with the closest communication distance in the pre-established block chain as the target block chain node, and sending a data query instruction to the target block chain node according to the data return type task.
In one embodiment, the sending a data query instruction to a target blockchain node in a pre-established blockchain according to the data return type task may further include: when the current target block chain link does not inquire the target service data in the local storage data, taking a block chain node connected with the current target block chain link as a new target block chain link, and returning to the step of sending a data inquiry instruction to the target block chain node according to the data return type task; or when the target block chain link does not inquire the target service data in the local storage data, taking the block chain node connected with the current target block chain link as a new target block chain link, and forwarding the data inquiry instruction to the new target block chain link by the current target block chain link.
In one embodiment, when there are a plurality of target blockchain nodes, the returning the received target service data to the client when receiving the target service data returned by the target blockchain node may include: and receiving the target service data returned by each target block chain node, and returning the target service data received firstly to the client.
In one embodiment, the above method for responding to a service request based on a block chain may further include: determining the non-data return type tasks corresponding to the service request according to the service identification information, and counting the number of the non-data return type tasks; and after the target service data is returned to the client, distributing the non-data-return tasks to the number of block chain link points in the block chain for parallel processing.
In one embodiment, the distributing the non-data-return task to the number of block link points in the block chain for parallel processing includes: sending task processing instructions to the block chain nodes of the number, wherein each task processing instruction carries one non-data-return task, and the task processing instructions are used for indicating the block chain nodes receiving the task processing instructions to process the non-data-return tasks carried in the task processing instructions and distribute obtained local processing results to the block chain; and sending a data summarizing instruction to each block chain node in the block chain nodes, wherein the data summarizing instruction is used for indicating each block chain node to summarize and store the local processing result of the received task processing instruction.
In one embodiment, the non-data-return tasks include data computation tasks and data saving tasks; the method comprises the steps that a block chain link point receiving a task processing instruction carrying a data storage task obtains target storage data corresponding to the received data storage task, and the obtained target storage data are distributed to a block chain; and calculating the corresponding data of the received data calculation task by the block chain link point which receives the task processing instruction carrying the data calculation task to obtain a local calculation result, and sending the obtained local calculation result to the block chain.
A blockchain-based service request response apparatus, the apparatus comprising:
the system comprises a request receiving module, a service request sending module and a service processing module, wherein the request receiving module is used for acquiring a service request sent by a client, and the service request carries service identification information of target service data;
the task distinguishing module is used for determining a data return type task corresponding to the service request according to the service identification information;
the task processing control module is used for sending a data query instruction to a target block chain node in a pre-established block chain according to the data return type task, wherein the data query instruction is used for indicating the target block chain node to query and return the target service data in local storage data;
and the data return module is used for returning the received target service data to the client when receiving the target service data returned by the target block chain node.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
acquiring a service request sent by a client, wherein the service request carries service identification information of target service data;
determining a data return type task corresponding to the service request according to the service identification information;
sending a data query instruction to a target block chain node in a pre-established block chain according to the data return type task, wherein the data query instruction is used for indicating the target block chain node to query and return the target service data in local storage data;
and when the target service data returned by the target block chain node is received, returning the received target service data to the client.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
acquiring a service request sent by a client, wherein the service request carries service identification information of target service data;
determining a data return type task corresponding to the service request according to the service identification information;
sending a data query instruction to a target block chain node in a pre-established block chain according to the data return type task, wherein the data query instruction is used for indicating the target block chain node to query and return the target service data in local storage data;
and when the target service data returned by the target block chain node is received, returning the received target service data to the client.
After a service request sent by a client is obtained, a data return type task corresponding to the service request is determined according to service identification information of target service data carried in the service request, a data query instruction is sent to a target block link node according to the data return type task and used for indicating the target service data queried and returned by the target block link node, and when the target service data returned by the target block link node is received, the received target service data is immediately returned to the client, so that the target service data is returned to the client after the tasks of other types are not required to be completely processed, and the waiting time of a user can be reduced.
Drawings
FIG. 1 is a diagram of an application environment of a block chain-based service request response method in an embodiment;
fig. 2 is a schematic flowchart of a service request response method based on a block chain in an embodiment;
FIG. 3 is a diagram illustrating a detailed flow of step S203 in one embodiment;
FIG. 4 is a detailed flowchart of step S203 in another embodiment;
fig. 5 is a schematic flowchart of a service request response method based on a block chain in another embodiment;
FIG. 6 is a block diagram of a device for responding to a service request based on a block chain in one embodiment;
FIG. 7 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The service request response method based on the block chain provided by the invention can be applied to the application environment shown in fig. 1, and comprises an electronic device 101, a terminal 102 and a block chain 103. The electronic device 101 may interact with the terminal 102 via a network, near field communication technology, or other suitable technology. The blockchain 103 includes a plurality of distributed blockchain nodes, each blockchain node may be an independent network server, or any plurality of blockchain nodes may be an independent network server, or all blockchain nodes and the electronic device 101 together are an independent network server.
The terminal 102 includes, but is not limited to, any electronic product capable of performing human-computer interaction with a user through a keyboard, a mouse, a remote controller, a touch panel, or a voice control device, for example, a Personal computer, a tablet computer, a smart phone, a Personal Digital Assistant (PDA), a game machine, an Internet Protocol Television (IPTV), a smart wearable device, and the like. The terminal 102 has corresponding client software installed therein, and the client software may be installed in the terminal 102 in advance, or may be downloaded and installed from a third-party device or a network server after the terminal 102 is started. The third-party device is not limited in the embodiment. Specifically, the client software of the terminal 102 may be used to implement the interaction between the terminal 102 and the electronic device 101. In the following embodiments, the installation of client software in the terminal 102 is taken as an example for explanation. In the following embodiments, the client software installed in the terminal 102 is referred to as a client.
The electronic apparatus 101 is a device capable of automatically performing numerical calculation and/or information processing in accordance with a command set or stored in advance. The electronic device 101 may be a computer, or may be a single network server, a server cluster composed of a plurality of network servers, or a cloud composed of a large number of hosts or network servers based on cloud computing, where the cloud computing is one of distributed computing and is a super virtual computer composed of a group of loosely coupled computers.
In the present embodiment, the electronic device 101 includes, but is not limited to, a memory 1011, a processor 1012 and a network interface 1013, which are communicatively connected to each other via a system bus. It should be noted that fig. 3 only shows the electronic device 101 having the components 1011 and 1013, which only show the components related to the embodiment of the present invention, and more or less components may be alternatively implemented as needed.
Storage 1011 includes memory and at least one type of readable storage media. The memory provides cache for the operation of the electronic device 101; the readable storage medium may be a non-volatile storage medium such as a flash memory, a hard disk, a multimedia card, a card type memory, and the like. In some embodiments, the readable storage medium may be an internal storage unit of the electronic device 101, such as a hard disk of the electronic device 101; in other embodiments, the non-volatile storage medium may also be an external memory of the electronic device 101, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, provided on the electronic device 101. In this embodiment, the readable storage medium of the memory 1011 is generally used for storing an operating system and various types of application software installed in the electronic device 101, such as the program code of the block chain based service request responding apparatus 1010 in an embodiment of the present invention. Further, the memory 1011 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 1012 may include one or more microprocessors, microcontrollers, digital processors, or the like in some embodiments. The processor 1012 is generally configured to control operations of the electronic device 101, such as performing control and processing related to data interaction or communication with the terminal 102. In this embodiment, the processor 1012 is configured to execute program codes stored in the memory 1011 or process data, such as the service request responding apparatus 1010 based on a block chain.
The network interface 1013 may include a wireless network interface or a wired network interface, and the network interface 1013 is generally used to establish a communication connection between the electronic apparatus 101 and other electronic devices. In this embodiment, the network interface 13 is mainly used to connect the electronic device 101 with one or more terminals 102, and establish a data transmission channel and a communication connection between the electronic device 101 and the one or more terminals 102.
The blockchain-based service request responding apparatus 1010 includes at least one computer readable instruction stored in the memory 1011, and the at least one computer readable instruction can be executed by the processor 1012 to implement the blockchain-based service request responding method according to the embodiments of the present application. As will be described later, the at least one computer readable instruction may be divided into different logic blocks depending on the functionality implemented by the respective portions.
In an embodiment, when executed by the processor 1012, the apparatus 3010 for responding to a service request based on a block chain implements the following operations: acquiring a service request sent by a client, wherein the service request carries service identification information of target service data, determining a data return type task corresponding to the service request according to the service identification information, and sending a data query instruction to a target block link node in a pre-established block link according to the data return type task, wherein the data query instruction is used for indicating the target block link node to query and return the target service data in local storage data; and when the target service data returned by the target block chain node is received, returning the received target service data to the client. Compared with the traditional mode that all processing tasks need to be executed and target service data is returned, the waiting time of the user can be reduced.
In one embodiment, as shown in fig. 2, a block chain based service request response method is provided, which is described by taking the method as an example applied to the electronic device in fig. 1, and includes the following steps:
step S201: acquiring a service request sent by a client, wherein the service request carries service identification information of target service data;
in the embodiment of the present invention, the client may run on the terminal in fig. 1; the service identification information of the target service data described in the embodiment of the present invention may be understood as identification information for distinguishing the target service data from other data, and the identification information may be a name of the target service data or type information of the target service data, or the like. The target service data refers to data which needs to be returned to the client.
Step S202: determining a data return type task corresponding to the service request according to the service identification information;
in the embodiment of the present invention, the data return type task may be understood as a task that needs to return data to the client, that is, a task that requests main function data corresponding to the service request.
Specifically, the electronic device queries each processing task corresponding to the service request according to the service request, distinguishes each processing task corresponding to the service request according to the service identification information, obtains a processing task matched with the service identification information, and determines the processing task matched with the service identification information as a data return type task.
Step S203: sending a data query instruction to a target block chain node in a pre-established block chain according to the data return type task, wherein the data query instruction is used for indicating the target block chain node to query and return the target service data in local storage data;
here, the target blockchain node may be any one or more blockchain nodes in the blockchain, or may be one or more blockchain nodes satisfying a preset condition.
Step S204: and when the target service data returned by the target block chain node is received, returning the received target service data to the client.
Specifically, the electronic device sends a data query instruction to a target blockchain node in a pre-established blockchain according to the data return type task, the target blockchain node queries a corresponding account book in local storage data of the target blockchain node, decrypts the content of the account book to obtain target service data, and returns the obtained target service data to the electronic device, and when receiving the target service data returned by the target blockchain node, the electronic device returns the received target service data to the client.
In the block chain-based service request response method, after a service request sent by a client is obtained, a data return type task corresponding to the service request is determined according to service identification information of target service data carried in the service request, a data query instruction is sent to a target block chain node according to the data return type task and is used for indicating the target service data queried and returned by the target block chain node, and when the target service data returned by the target block chain node is received, the received target service data is immediately returned to the client, so that the target service data is returned to the client after the tasks of other types are completely processed, and the waiting time of a user can be reduced.
In one embodiment, the sending a data query instruction to a target blockchain node in a pre-established blockchain according to the data return type task may include: and taking the block chain link point with the closest communication distance in the pre-established block chain as the target block chain node, and sending a data query instruction to the target block chain node according to the data return type task.
After receiving the data query instruction, the target block link node may query and return the target service data in the local storage data of the target block link node according to the carried service identification information, the identification information of the data return type task, or the data return type task.
Specifically, the IP (Internet Protocol) address information corresponding to the electronic device may be acquired, the IP address information corresponding to the electronic device is compared with IP address information corresponding to each block link point in the block chain, a block link point with a closest communication distance is determined according to a comparison result, the operation may be performed after the block chain is established or only performed once when the block chain is updated, and after a block link point with a shortest communication distance to the client is determined, the operation is recorded until the block chain is updated again, and the block link point with the closest communication distance is determined again. The updating of the block chain refers to newly adding a block chain node or reducing a block chain node. The communication distance can be determined based on the IP address information in any realizable manner.
In this embodiment, the data query instruction is sent to the target block chain node in the pre-established block chain according to the data return type task, so that the sending time of the data query instruction and the receiving time of the target service data can be saved, and the waiting time of the user can be further reduced.
In one embodiment, the sending a data query instruction to a target blockchain node in a pre-established blockchain according to the data return type task may further include: and when the target block chain link does not inquire the target service data in the local storage data, taking the block chain node connected with the current target block chain link as a new target block chain link, and returning to the step of sending a data inquiry instruction to the target block chain node according to the data return type task. Specifically, as shown in fig. 3, the sending a data query instruction to a target blockchain node in a pre-established blockchain according to the data return type task may include:
step S301: taking a block chain link point with the closest communication distance in a pre-established block chain as a target block chain node;
step S302: sending a data query instruction to a target block link node according to the data return type task;
step S303: and when the current target block chain node does not inquire the target service data in the local storage data, taking the block chain node connected with the current target block chain link as a new target block chain link, and returning to the step S302.
Here, the connected block chain node refers to a block link point directly connected to a target block link point in the same block chain. It should be understood by those skilled in the art that the current target blockchain node may be, but is not limited to, the blockchain node having the shortest communication distance with the client. For example, the block chain node having the shortest communication distance with the client is a block link point k, the block chain node connected to the block link point k is a block link point k +1, the block chain node connected to the block link point k +1 is a block link point k +2, and so on. When the block link point k does not inquire the target service data in the local storage data of the block link point k, sending the data inquiry command to a block link point k +1, wherein the current target block link node at this time is the block link point k, namely, the block link node having the shortest communication distance with the client, and when the block link point k +1 does not inquire the target service data in the local storage data of the block link point k +1, sending the data inquiry command to a block link point k +2, wherein the current target block link node at this time is the block link point k + 1.
If the target block link does not inquire the target service data in the local storage data, the identification information of the connected block link node of the target block link can be returned to the electronic device, and when the electronic device receives the identification information, the connected block link node of the target block link is used as a new target block link according to the identification information.
In this embodiment, when the current target block chain node does not inquire the target service data in the local storage data, the target service data can also be inquired through the block chain node connected to the target block chain link, so that the target service data can be inquired as quickly as possible.
In one embodiment, as shown in fig. 4, the sending a data query instruction to a target blockchain node in a pre-established blockchain according to the data return type task may include:
step S401: sequencing each block chain link point in a pre-established block chain according to the communication distance to obtain a sequencing result;
here, the communication distance is a communication distance between each block link point and the electronic device. Specifically, the link points of each block can be sorted according to the communication distance from small to large to obtain a sorting result.
Step S402: sequentially selecting one block chain node as a target block chain node according to the sequencing result in the sequence from small communication distance to large communication distance;
step S403: sending a data query instruction to a currently selected target block chain node according to the data return type task;
step S404: and when the currently selected target block link does not inquire the target service data in the local storage data, selecting the next block link node as a new target block link node according to the sorting result, and returning to the step S403.
When the target service data is not inquired in the local storage data by the blockchain node with the first small communication distance, the next blockchain node is the blockchain node with the second small communication distance, and when the target service data is not inquired in the local storage data by the blockchain node with the second small communication distance, the next blockchain node is the blockchain node with the third small communication distance, and so on.
By adopting the scheme in the embodiment, the communication delay can be reduced as much as possible. In addition, the sending a data query instruction to a target blockchain node in a pre-established blockchain according to the data return type task may further include: and when the current task processing capacity of the current target block chain link exceeds a preset threshold value, selecting a next block chain node as a new target block chain link point according to the sorting result, taking a block chain node connected with the current target block chain link as a new target block chain link, and returning to the step of sending a data query instruction to the target block chain node according to the data return type task.
By adopting the scheme in the embodiment, the task allocation can be prevented from being too concentrated, and the waiting time of the user can be further reduced.
In one embodiment, the sending a data query instruction to a target blockchain node in a pre-established blockchain according to the data return type task may further include: and when the target block chain link does not inquire the target service data in the local storage data, taking the connected block chain node of the current target block chain link as a new target block chain link, and forwarding the data inquiry command to the new target block chain link by the current target block chain link.
By adopting the scheme in the embodiment, information does not need to be fed back to the electronic device, and communication delay can be reduced.
In one embodiment, when there are a plurality of target blockchain nodes, the returning the received target service data to the client when receiving the target service data returned by the target blockchain node may include: and receiving the target service data returned by each target block chain node, and returning the target service data received firstly to the client.
In this embodiment, a plurality of target blockchain nodes are provided, the target service data returned by each target blockchain node is received, and the target service data received first is returned to the client, so that the waiting time of the user can be reduced as much as possible.
In one embodiment, as shown in fig. 5, a block chain based service request response method is provided, which is described by taking the method as an example applied to the electronic device in fig. 1, and includes the following steps:
step S501: acquiring a service request sent by a client, wherein the service request carries service identification information of target service data;
step S502: determining a data return type task corresponding to the service request according to the service identification information;
step S503: sending a data query instruction to a target block chain node in a pre-established block chain according to the data return type task, wherein the data query instruction is used for indicating the target block chain node to query and return the target service data in local storage data;
step S504: when the target business data returned by the target block chain node is received, returning the received target business data to the client;
step S505: determining the non-data return type tasks corresponding to the service request according to the service identification information, and counting the number of the non-data return type tasks;
step S502 and step S505 may not be executed in the above-mentioned order, or may be executed simultaneously.
The non-data-return type task may be understood as a task that does not need to return data to the client, that is, a processing task corresponding to an attached function of the service request, for example, some tasks that only need to perform data storage or data calculation locally at the server.
Specifically, each processing task corresponding to the service request may be determined according to the service request, each processing task corresponding to the service request may be distinguished according to the service identification information, a processing task matched with the service identification information is obtained, the processing task matched with the service identification information is determined as a data return type task, and the remaining processing tasks except the data return type task in each processing task corresponding to the service request are determined as non-data return type tasks.
Step S506: and after the target service data is returned to the client, distributing the non-data-return tasks to the number of block chain link points in the block chain for parallel processing.
In this embodiment, the non-data-return task is distributed to the number of block link points in the block chain to be processed in parallel, so that the processing efficiency can be improved. Meanwhile, after the target service data is returned to the client, the non-data-return tasks are distributed to the block chain link points of the number in the block chain for parallel processing, so that the influence on the processing process of the data-return tasks can be avoided.
However, the distribution method of the non-data-return type task is not limited to such an average distribution method, and for example, the non-data-return type task may be collectively distributed to one or more blockchain nodes to be processed.
In one embodiment, the distributing the non-data-return task to the number of block link points in the block chain for parallel processing may include: sending task processing instructions to the block chain nodes of the number, wherein each task processing instruction carries one non-data-return task, and the task processing instructions are used for indicating the block chain nodes receiving the task processing instructions to process the non-data-return tasks carried in the task processing instructions and distribute obtained local processing results to the block chain; and sending a data summarizing instruction to each block chain node in the block chain nodes, wherein the data summarizing instruction is used for indicating each block chain node to summarize and store the local processing result of the received task processing instruction.
After the non-data-return task is distributed to the blockchain nodes, the blockchain nodes which process the non-data-return task distribute local processing results to the blockchain, and the local processing results of the blockchain nodes which process the non-data-return task are collected and stored by all the blockchain nodes in the blockchain.
For example, for a block chain including a block chain node 1, a block chain node 2, a block chain node 3, a.... and a block chain node n, there are m non-data-return tasks, the non-data-return tasks may be distributed to the m block chain nodes in the block chain according to some preset rules or randomly, each block chain node processes one non-data-return task, and the m block chain nodes processing the non-data-return tasks respectively distribute respective local processing results to the block chain. Then, n block chain link points in the block chain are summarized respectively according to the local processing results distributed by the m block chain nodes for processing the non-data return task, and the summarized results are stored in respective local storage data. Generally, the summary results are collected into an account book for storage, the account book is encrypted before the summary, and the encrypted account book is stored.
In one embodiment, the non-data-return tasks include data computation tasks and data preservation tasks; the method comprises the steps that a block chain link point receiving a task processing instruction carrying a data storage task obtains target storage data corresponding to the received data storage task, and the obtained target storage data are distributed to a block chain; and calculating the corresponding data of the received data calculation task by the block chain link point which receives the task processing instruction carrying the data calculation task to obtain a local calculation result, and sending the obtained local calculation result to the block chain.
In one embodiment, the method for responding to a service request based on a block chain of the present invention may further include: and transferring the non-data-return task from the main thread where the data-return task is located to a task queue in an asynchronous operation mode, and processing the non-data-return task in the task queue after the block link node receiving the data query instruction returns the target request data to the client.
Wherein processing the non-data-return task in the task queue may include: and distributing the non-data return tasks to the number of block chain link points in the block chain for parallel processing.
According to the scheme of the embodiment, the non-data return type task is moved to the task queue from the main thread where the data return type task is located, so that the rest tasks in the main thread can be processed and completed as soon as possible, and the waiting time of a user is shortened.
It should be understood that although the various steps in the flow charts of fig. 2-5 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-5 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternating with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 6, there is provided a service request response device based on a block chain, including: a request receiving module 601, a task distinguishing module 602, a task processing control module 603 and a data returning module 604, wherein:
a request receiving module 601, configured to obtain a service request sent by a client, where the service request carries service identification information of target service data;
a task distinguishing module 602, configured to determine, according to the service identifier information, a data return type task corresponding to the service request;
a task processing control module 603, configured to send a data query instruction to a target block chain node in a pre-established block chain according to the data return type task, where the data query instruction is used to instruct the target block chain node to query in local storage data and return the target service data;
a data returning module 604, configured to, when receiving the target service data returned by the target blockchain node, return the received target service data to the client.
In one embodiment, the task processing control module 603 may use a block link point with the closest communication distance in a pre-established block chain as the target block chain node, and send a data query instruction to the target block chain node according to the data return type task.
In one embodiment, when the current target block link does not inquire the target service data in the local storage data, the task processing control module 603 may further take a block link node connected to the current target block link as a new target block link, and send a data inquiry command to the target block link node again according to the data return type task.
In one embodiment, when the target block link does not inquire the target service data in the local storage data, the task processing control module 603 may further take a connected block chain node of the current target block link as a new target block link, and forward the data inquiry command to the new target block link by the current target block link.
In one embodiment, when there are multiple target blockchain nodes, the data returning module 604 may receive the target service data returned by each target blockchain node, and return the target service data received first to the client.
In one embodiment, the task differentiating module 602 may be further configured to determine, according to the service identification information, a non-data-return task corresponding to the service request, and count the number of the non-data-return tasks; the task processing control module 603 may be further configured to, after the data returning module 604 returns the target service data to the client, distribute the non-data-returning type task to the number of block link points in the block chain for parallel processing.
In one embodiment, the task processing control module 603 may send task processing instructions to the number of block chain nodes in the block chain nodes, where each task processing instruction carries one non-data-returning type task, and the task processing instruction is configured to instruct the block chain node that receives the task processing instruction to process the non-data-returning type task carried in the task processing instruction, and distribute an obtained local processing result to the block chain; and sending a data summarizing instruction to each block chain node in the block chain nodes, wherein the data summarizing instruction is used for indicating each block chain node to summarize and store the local processing result of the received task processing instruction.
In one embodiment, the non-data-return tasks include data computation tasks and data preservation tasks; the method comprises the steps that a block chain link point receiving a task processing instruction carrying a data storage task obtains target storage data corresponding to the received data storage task, and the obtained target storage data are distributed to a block chain; and calculating the corresponding data of the received data calculation task by the block chain link point which receives the task processing instruction carrying the data calculation task to obtain a local calculation result, and sending the obtained local calculation result to the block chain.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing service request processing data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a blockchain based service request response method.
Those skilled in the art will appreciate that the architecture shown in fig. 7 is merely a block diagram of some of the structures associated with the inventive arrangements and is not intended to limit the computing devices to which the inventive arrangements may be applied, as a particular computing device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
acquiring a service request sent by a client, wherein the service request carries service identification information of target service data;
determining a data return type task corresponding to the service request according to the service identification information;
sending a data query instruction to a target block chain node in a pre-established block chain according to the data return type task, wherein the data query instruction is used for indicating the target block chain node to query and return the target service data in local storage data;
and when the target service data returned by the target block chain node is received, returning the received target service data to the client.
In one embodiment, when the processor executes a computer program to implement the step of sending a data query instruction to a target block chain node in a pre-established block chain according to the data return type task, the following steps are specifically implemented: and taking the block chain link point with the closest communication distance in the pre-established block chain as the target block chain node, and sending a data query instruction to the target block chain node according to the data return type task.
In one embodiment, when the processor executes a computer program to implement the step of sending a data query instruction to a target block chain node in a pre-established block chain according to the data return type task, the following steps are further specifically implemented: and when the current target block chain link does not inquire the target service data in the local storage data, taking the connected block chain node of the current target block chain link as a new target block chain link, and returning to the step of sending a data inquiry instruction to the target block chain node according to the data return type task.
In one embodiment, when the processor executes a computer program to implement the step of sending a data query instruction to a target block chain node in a pre-established block chain according to the data return type task, the following steps are further specifically implemented: and when the target block chain link does not inquire the target service data in the local storage data, taking the connected block chain node of the current target block chain link as a new target block chain link, and forwarding the data inquiry command to the new target block chain link by the current target block chain link.
In an embodiment, when there are a plurality of target blockchain nodes, the processor executes the computer program to implement the step of returning the received target service data to the client when receiving the target service data returned by the target blockchain node, which specifically implements the following steps: and receiving the target service data returned by each target block chain node, and returning the target service data received firstly to the client.
In one embodiment, the processor, when executing the computer program, further performs the steps of: determining the non-data return type tasks corresponding to the service request according to the service identification information, and counting the number of the non-data return type tasks; and after the target service data is returned to the client, distributing the non-data-return tasks to the number of block chain link points in the block chain for parallel processing.
In one embodiment, when the processor executes a computer program to implement the step of sending a data query instruction to a target block chain node in a pre-established block chain according to the data return type task, the following steps are further specifically implemented: sending task processing instructions to the block chain nodes of the number, wherein each task processing instruction carries one non-data-return task, and the task processing instructions are used for indicating the block chain nodes receiving the task processing instructions to process the non-data-return tasks carried in the task processing instructions and distribute obtained local processing results to the block chain; and sending a data summarizing instruction to each block chain node in the block chain nodes, wherein the data summarizing instruction is used for indicating each block chain node to summarize and store the local processing result of the received task processing instruction.
In one embodiment, the non-data-return tasks include data computation tasks and data preservation tasks; the method comprises the steps that a block chain link point receiving a task processing instruction carrying a data storage task obtains target storage data corresponding to the received data storage task, and the obtained target storage data are distributed to a block chain; and calculating the corresponding data of the received data calculation task by the block chain link point which receives the task processing instruction carrying the data calculation task to obtain a local calculation result, and sending the obtained local calculation result to the block chain.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring a service request sent by a client, wherein the service request carries service identification information of target service data;
determining a data return type task corresponding to the service request according to the service identification information;
sending a data query instruction to a target block chain node in a pre-established block chain according to the data return type task, wherein the data query instruction is used for indicating the target block chain node to query and return the target service data in local storage data;
and when the target service data returned by the target block chain node is received, returning the received target service data to the client.
In one embodiment, when the step of sending a data query instruction to a target block chain node in a pre-established block chain according to the data return type task is executed by a processor, the following steps are specifically implemented: and taking the block chain link point with the closest communication distance in the pre-established block chain as the target block chain node, and sending a data query instruction to the target block chain node according to the data return type task.
In an embodiment, when the computer program is executed by the processor to implement the step of sending the data query instruction to the target blockchain node in the pre-established blockchain according to the data return type task, the following steps are also specifically implemented: and when the current target block chain link does not inquire the target service data in the local storage data, taking the connected block chain node of the current target block chain link as a new target block chain link, and returning to the step of sending a data inquiry instruction to the target block chain node according to the data return type task.
In an embodiment, when the computer program is executed by the processor to implement the step of sending the data query instruction to the target blockchain node in the pre-established blockchain according to the data return type task, the following steps are also specifically implemented: and when the target block chain link does not inquire the target service data in the local storage data, taking the connected block chain node of the current target block chain link as a new target block chain link, and forwarding the data inquiry command to the new target block chain link by the current target block chain link.
In one embodiment, when there are a plurality of target blockchain nodes, the computer program is executed by the processor to implement the step of returning the received target service data to the client when receiving the target service data returned by the target blockchain node, and specifically implement the following steps: and receiving the target service data returned by each target block chain node, and returning the target service data received firstly to the client.
In one embodiment, the computer program when executed by the processor further performs the steps of: determining the non-data return type tasks corresponding to the service request according to the service identification information, and counting the number of the non-data return type tasks; and after the target service data is returned to the client, distributing the non-data-return tasks to the number of block chain link points in the block chain for parallel processing.
In an embodiment, when the computer program is executed by the processor to implement the step of sending the data query instruction to the target blockchain node in the pre-established blockchain according to the data return type task, the following steps are also specifically implemented: sending task processing instructions to the block chain nodes of the number, wherein each task processing instruction carries one non-data-return task, and the task processing instructions are used for indicating the block chain nodes receiving the task processing instructions to process the non-data-return tasks carried in the task processing instructions and distribute obtained local processing results to the block chain; and sending a data summarizing instruction to each block chain node in the block chain nodes, wherein the data summarizing instruction is used for indicating each block chain node to summarize and store the local processing result of the received task processing instruction.
In one embodiment, the non-data-return tasks include data computation tasks and data preservation tasks; the method comprises the steps that a block chain link point receiving a task processing instruction carrying a data storage task obtains target storage data corresponding to the received data storage task, and the obtained target storage data are distributed to a block chain; and calculating the corresponding data of the received data calculation task by the block chain link point which receives the task processing instruction carrying the data calculation task to obtain a local calculation result, and sending the obtained local calculation result to the block chain.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, databases, or other media used in embodiments provided herein may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A service request response method based on a block chain is characterized in that the method comprises the following steps:
acquiring a service request sent by a client, wherein the service request carries service identification information of target service data, and the service identification information comprises the name of the target service data or the type information of the target service data;
determining a data return type task corresponding to the service request according to the service identification information; the data return type task comprises a processing task which is matched with the service identification information in each processing task corresponding to the service request;
sending a data query instruction to a target block chain node in a pre-established block chain according to the data return type task, wherein the data query instruction is used for indicating the target block chain node to query and return the target service data in local storage data, and the data query instruction comprises identification information of the data return type task or the data return type task; the data return type task is data;
and when the target service data returned by the target block chain node is received, returning the received target service data to the client.
2. The method according to claim 1, wherein the sending a data query instruction to a target blockchain node in a pre-established blockchain according to the data return type task comprises:
and taking the block chain link point with the closest communication distance in the pre-established block chain as the target block chain node, and sending a data query instruction to the target block chain node according to the data return type task.
3. The blockchain-based service request response method according to claim 2, wherein the sending a data query instruction to a target blockchain node in a pre-established blockchain according to the data return type task further comprises:
when the current target block chain link does not inquire the target service data in the local storage data, taking a block chain node connected with the current target block chain link as a new target block chain link, and returning to the step of sending a data inquiry instruction to the target block chain node according to the data return type task;
or
And when the target block chain link does not inquire the target service data in the local storage data, taking the connected block chain node of the current target block chain link as a new target block chain link, and forwarding the data inquiry command to the new target block chain link by the current target block chain link.
4. The blockchain-based service request responding method according to any one of claims 1 to 3, wherein when there are a plurality of target blockchain nodes, when the target blockchain node receives the target service data returned by the target blockchain node, returning the received target service data to the client, includes:
and receiving the target service data returned by each target block chain node, and returning the target service data received firstly to the client.
5. The blockchain-based service request response method according to claim 4, wherein the method further comprises:
determining the non-data return type tasks corresponding to the service request according to the service identification information, and counting the number of the non-data return type tasks; the non-data-returning task is a task which does not need to return data to the client;
and after the target service data is returned to the client, distributing the non-data-return tasks to the number of block chain link points in the block chain for parallel processing.
6. The method according to claim 5, wherein the distributing the non-data-return task to the number of block chain nodes in the block chain for parallel processing comprises:
sending task processing instructions to the block chain nodes of the number, wherein each task processing instruction carries one non-data-return task, and the task processing instructions are used for indicating the block chain nodes receiving the task processing instructions to process the non-data-return tasks carried in the task processing instructions and distribute obtained local processing results to the block chain;
and sending a data summarizing instruction to each block chain node in the block chain nodes, wherein the data summarizing instruction is used for indicating each block chain node to summarize and store the local processing result of the received task processing instruction.
7. The blockchain-based service request response method according to claim 6, wherein the non-data-return type task includes a data calculation task and a data saving task; the method comprises the steps that a block chain link point receiving a task processing instruction carrying a data storage task obtains target storage data corresponding to the received data storage task, and the obtained target storage data are distributed to a block chain; and calculating the corresponding data of the received data calculation task by the block chain link point which receives the task processing instruction carrying the data calculation task to obtain a local calculation result, and sending the obtained local calculation result to the block chain.
8. A blockchain-based service request response apparatus, the apparatus comprising:
a request receiving module, configured to obtain a service request sent by a client, where the service request carries service identification information of target service data, and the service identification information includes a name of the target service data or type information of the target service data;
the task distinguishing module is used for determining a data return type task corresponding to the service request according to the service identification information; the data return type task comprises a processing task which is matched with the service identification information in each processing task corresponding to the service request;
the task processing control module is used for sending a data query instruction to a target block chain node in a pre-established block chain according to the data return type task, wherein the data query instruction is used for indicating the target block chain node to query and return the target service data in local storage data, and the data query instruction comprises identification information of the data return type task or the data return type task; the data return type task is data;
and the data return module is used for returning the received target service data to the client when receiving the target service data returned by the target block chain node.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of any of claims 1 to 7 are implemented when the computer program is executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN201810847172.0A 2018-07-27 2018-07-27 Service request response method and device based on block chain and computer equipment Active CN109040227B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810847172.0A CN109040227B (en) 2018-07-27 2018-07-27 Service request response method and device based on block chain and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810847172.0A CN109040227B (en) 2018-07-27 2018-07-27 Service request response method and device based on block chain and computer equipment

Publications (2)

Publication Number Publication Date
CN109040227A CN109040227A (en) 2018-12-18
CN109040227B true CN109040227B (en) 2021-08-03

Family

ID=64646349

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810847172.0A Active CN109040227B (en) 2018-07-27 2018-07-27 Service request response method and device based on block chain and computer equipment

Country Status (1)

Country Link
CN (1) CN109040227B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110046036A (en) * 2018-12-25 2019-07-23 阿里巴巴集团控股有限公司 A kind of operation requests distribution method, device and equipment
CN109922079B (en) * 2019-03-29 2022-05-03 北京乐蜜科技有限责任公司 Service agent method and device based on block chain
CN110138586A (en) * 2019-04-04 2019-08-16 平安科技(深圳)有限公司 Block chain node administration method, electronic device, system and readable storage medium storing program for executing
CN110290168B (en) * 2019-05-08 2022-04-12 深圳壹账通智能科技有限公司 Data transmission method, device, server and storage medium
CN110380919B (en) * 2019-08-30 2021-11-05 望海康信(北京)科技股份公司 Processing method and device for block chain request, electronic equipment and readable storage medium
CN110602515B (en) * 2019-09-16 2021-08-10 腾讯科技(深圳)有限公司 Data processing method based on block chain, server and storage medium
CN110597818B (en) * 2019-09-19 2023-11-14 腾讯科技(深圳)有限公司 File inquiry method, device, equipment and storage medium based on block chain
CN111639108A (en) * 2020-05-27 2020-09-08 中国建设银行股份有限公司 Data query method and device, electronic equipment and computer readable storage medium
CN111813857A (en) * 2020-07-02 2020-10-23 珑门汽车科技(上海)有限公司 Detection data management system and method based on block chain technology
CN114489513A (en) * 2022-02-11 2022-05-13 上海驻云信息科技有限公司 Data return method and system based on local disk transfer

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107315786A (en) * 2017-06-12 2017-11-03 腾讯科技(深圳)有限公司 Business datum storage method and device
CN107527285A (en) * 2016-06-20 2017-12-29 惠众商务顾问(北京)有限公司 The polymorphic link of community's block chain and Intelligent processing system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9967096B2 (en) * 2016-05-23 2018-05-08 Accenture Global Solutions Limited Rewritable blockchain

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107527285A (en) * 2016-06-20 2017-12-29 惠众商务顾问(北京)有限公司 The polymorphic link of community's block chain and Intelligent processing system
CN107315786A (en) * 2017-06-12 2017-11-03 腾讯科技(深圳)有限公司 Business datum storage method and device

Also Published As

Publication number Publication date
CN109040227A (en) 2018-12-18

Similar Documents

Publication Publication Date Title
CN109040227B (en) Service request response method and device based on block chain and computer equipment
CN108924250B (en) Service request processing method and device based on block chain and computer equipment
CN108848039B (en) Server, message distribution method and storage medium
CN108965450B (en) Service request response method, device, computer equipment and storage medium
US8818940B2 (en) Systems and methods for performing record actions in a multi-tenant database and application system
CN109542361B (en) Distributed storage system file reading method, system and related device
CN112422702A (en) CDN back-to-source method, system and computer equipment
US20160330299A1 (en) Data distribution method and system and data receiving apparatus
WO2017045450A1 (en) Resource operation processing method and device
CN111722918A (en) Service identification code generation method and device, storage medium and electronic equipment
CN113961510B (en) File processing method, device, equipment and storage medium
CN111339057A (en) Method, apparatus and computer readable storage medium for reducing back-to-source requests
CN115408715A (en) Heterogeneous data processing system, method and equipment based on block chain and IPFS
CN113014608B (en) Flow distribution control method and device, electronic equipment and storage medium
CN112015553A (en) Data processing method, device, equipment and medium based on machine learning model
CN111190727A (en) Asynchronous memory destructuring method and device, computer equipment and storage medium
CN108111598B (en) Cloud disk data issuing method and device and storage medium
CN112969198A (en) Data transmission method, terminal and storage medium
CN109508243A (en) Service request processing method, device, computer equipment and storage medium
CN108173892B (en) Cloud mirror image operation method and device
CN116185578A (en) Scheduling method of computing task and executing method of computing task
CN114328731A (en) Information processing method, device, electronic equipment and storage medium
CN108718285B (en) Flow control method and device of cloud computing cluster and server
CN109582680B (en) Business processing method based on new product development, electronic device and readable storage medium
CN109088913B (en) Method for requesting data and load balancing 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
GR01 Patent grant
GR01 Patent grant