CN109508243A - Service request processing method, device, computer equipment and storage medium - Google Patents

Service request processing method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN109508243A
CN109508243A CN201810848301.8A CN201810848301A CN109508243A CN 109508243 A CN109508243 A CN 109508243A CN 201810848301 A CN201810848301 A CN 201810848301A CN 109508243 A CN109508243 A CN 109508243A
Authority
CN
China
Prior art keywords
data
block chain
task
return type
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810848301.8A
Other languages
Chinese (zh)
Inventor
吴旭波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiangxi Greedy Play Information Technology Co Ltd
Original Assignee
Jiangxi Greedy Play 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 Greedy Play Information Technology Co Ltd filed Critical Jiangxi Greedy Play Information Technology Co Ltd
Priority to CN201810848301.8A priority Critical patent/CN109508243A/en
Publication of CN109508243A publication Critical patent/CN109508243A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention relates to a kind of service request processing method, system, computer equipment and storage mediums.The described method includes: obtaining the service request that client is sent, the service identification information of target service data is carried in the service request;The corresponding data return type task of the service request and non-data return type task are determined according to the service identification information;Main thread where non-data return type task from the data return type task is moved to preset task queue.Period of reservation of number can be reduced using this method.

Description

Service request processing method, device, computer equipment and storage medium
Technical field
The present invention relates to network technique fields, more particularly to a kind of service request processing method, device, computer equipment And storage medium.
Background technique
With the development of the network information technology, the service application by the relevant technologies of network information platform progress is also more next It is more, such as network about vehicle, network rent a house etc..And with the fast development of these application of net, it is interacted with server Client device it is also more and more.In addition, being often mingled with a lot of other attached function in the corresponding function of tonic chord of a service request Can, for example, returning again to logging state after going inquiry database to extract user related information when requesting and logging in;It is pushed away in request When recommending list, model content is associated with user, and association thumbs up non-model itself number such as user, comment user, concern user The number of users of the model, sum etc. of leaving a message are paid close attention to according to perhaps needing dynamic to calculate in table.
In traditional mode, the response to service request is by the way of direct synchronous calculate, and this mode is from client End is sent to the service request of server, and function of tonic chord data could be returned to clothes by generally requiring to expend the more time in server Business end, period of reservation of number are longer.
Summary of the invention
Based on this, it is necessary in view of the above technical problems, provide a kind of service request that can reduce period of reservation of number Processing method, device, computer equipment and storage medium.
A kind of service request processing method, which comprises
The service request that client is sent is obtained, the service identification letter of target service data is carried in the service request Breath;
Determine that the corresponding data return type task of the service request and non-data return according to the service identification information Type task;
Main thread where non-data return type task from the data return type task is moved to preset task team Column.
Above-mentioned service request processing method in one of the embodiments, further includes:
The data return type task handled in the main thread obtains the target service data;
After the target service data are returned to the client, the non-data handled in the task queue is returned Hollow task.
It is above-mentioned after the target service data are returned to the client in one of the embodiments, place Manage the non-data return type task in the task queue, comprising:
Count the quantity of the non-data return type task;
After the target service data are returned to the client, the non-data return type task is distributed to pre- The block chain link point of quantity described in the block chain first established carries out parallel processing.
It is above-mentioned in one of the embodiments, that the non-data return type task is distributed to the block chain pre-established Described in quantity block chain link point carry out parallel processing, comprising:
Task process instruction is sent to the block chain node of quantity described in the block chain node pre-established, it is each described Task process instruction carries a non-data return type task, and the task process instruction, which is used to indicate, receives described appoint The non-data return type task carried in task process instruction described in the block chain node processing for process instruction of being engaged in, and will To processing locality result be distributed in the block chain;
Into the block chain node, each block chain node sends data summarization instruction, and data summarization instruction is used to indicate each A block chain node saves after being summarized the processing locality result for receiving the task process instruction.
Above-mentioned non-data return type task includes that data calculating task and data save and appoint in one of the embodiments, Business;Receive the data preservation task that the block chain node for the task process instruction that data save task is obtained and received that carries Corresponding target saves data, and the target that will acquire saves data distribution into the block chain;It receives and carries data meter The corresponding data for the data calculating task that the block chain node docking of the task process instruction of calculation task receives calculate To local computing as a result, obtained local computing result is dealt into the block chain.
The data return type task in the above-mentioned processing main thread obtains the target in one of the embodiments, Business datum, comprising:
Data are sent according to target block chain node of the data return type task into the block chain pre-established to look into Instruction is ask, the data query instruction is used to indicate the target block chain node and inquires in data are locally stored and return to institute State target service data;
When receiving the target service data that the target block chain node returns, the target that will receive Business datum returns to the client.
The data return type task in the above-mentioned processing main thread obtains the target in one of the embodiments, Business datum, comprising:
Data are sent according to target block chain node of the data return type task into the block chain pre-established to return It refers to enable, the data return instruction, which is used to indicate, to be received the block chain node of the data return instruction number is being locally stored According to the middle inquiry target service data, and the target service data inquired are returned into the client.
A kind of service request processing unit, described device include:
Request receiving module carries target industry in the service request for obtaining the service request of client transmission The service identification information for data of being engaged in;
Assessment of tasks module, for determining the corresponding data return type of the service request according to the service identification information Task and non-data return type task;
Task shift module, for moving the main thread where non-data return type task from the data return type task Move preset task queue.
A kind of computer equipment can be run on a memory and on a processor including memory, processor and storage Computer program, the processor perform the steps of when executing the computer program
The service request that client is sent is obtained, the service identification letter of target service data is carried in the service request Breath;
Determine that the corresponding data return type task of the service request and non-data return according to the service identification information Type task;
Main thread where non-data return type task from the data return type task is moved to preset task team Column.
A kind of computer readable storage medium, is stored thereon with computer program, and the computer program is held by processor It is performed the steps of when row
The service request that client is sent is obtained, the service identification letter of target service data is carried in the service request Breath;
Determine that the corresponding data return type task of the service request and non-data return according to the service identification information Type task;
Main thread where non-data return type task from the data return type task is moved to preset task team Column.
Above-mentioned service request processing method, device, computer equipment and storage medium are the business for obtaining client and sending It requests, the service identification information of target service data is carried in the service request, determined according to the service identification information The corresponding data return type task of the service request and non-data return type task, by non-data return type task from the number Preset task queue is moved to according to the main thread where return type task.In this way, the master where the data return type task Task quantity on thread reduces, it is possible to reduce the processing time of task on main thread, can enable main thread as early as possible Process is ended processing, returns to target service data to client, without waiting the processing completion of non-data return type task After return again to target service data client, it is possible to reduce the waiting time of user.
Detailed description of the invention
Fig. 1 is the applied environment figure of service request processing method in one embodiment;
Fig. 2 is the flow diagram of service request processing method in one embodiment;
Fig. 3 is the flow diagram of service request processing method in another embodiment;
Fig. 4 is the applied environment figure of service request processing method in another embodiment;
Fig. 5 is the flow diagram of service request processing method in another embodiment;
Fig. 6 is the refinement flow diagram of the step S504 in one embodiment;
Fig. 7 is the refinement flow diagram of the step S504 in another embodiment;
Fig. 8 is the composed structure schematic diagram of service request processing unit in another embodiment;
Fig. 9 is the internal structure chart of computer equipment in one embodiment.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, with reference to the accompanying drawings and embodiments, right The present invention is further elaborated.It should be appreciated that specific embodiment described herein is only used to explain the present invention, not For limiting the present invention.
Service request response method provided by the invention, can be applied in application environment as shown in Figure 1, including terminal 101 and server 102.Terminal 101 can be communicated by network with server 102.Wherein, terminal 102 can with but it is unlimited Then various personal computers, laptop, smart phone, tablet computer and portable wearable device, server 102 can To be realized with the independent server either server cluster that forms of multiple servers.
Corresponding client software is installed, which can be pre-installed in above-mentioned terminal in terminal 101 101, it is also possible to after terminal 101 starts, is downloaded and installs from third party device or network server.Wherein, third Method, apparatus is not construed as limiting in embodiment.Specifically, the client software of terminal 101, can be used for realizing terminal 101 and server Interaction between 102.It is illustrated for client software is installed in terminal 101 in embodiment.In the examples below, eventually The client software installed in end 101 is known as client.It is the service request for obtaining client and sending in the embodiment of the present invention, The service identification information that target service data are carried in the service request determines the industry according to the service identification information Corresponding data return type task and non-data return type task are requested in business, and non-data return type task is returned from the data Main thread where type task is moved to preset task queue.In this way, task quantity significantly reduces on main thread, can shorten The waiting time of user.
In one embodiment, as shown in Fig. 2, providing a kind of service request response method, it is applied to Fig. 1 in this way In server for be illustrated, comprising the following steps:
Step S201: the service request that client is sent is obtained, carries target service data in the service request Service identification information;
In the embodiment of the present invention, client be may operate in the terminal of Fig. 1;Target industry described in the embodiment of the present invention The service identification information of business data can be understood as the mark for distinguishing the target service data and other data and believe Breath, the identification information can be the title of target service data or type information of target service data etc..The target Business datum refers to the data for needing to return to the client.
Step S202: the corresponding data return type task of the service request and non-is determined according to the service identification information Data return type task;
In the embodiment of the present invention, data return type task can be understood as needing to carry out appointing for data return to client The task of business namely the corresponding request function of tonic chord data of the service request, non-data return type task can be understood as being not required to The corresponding processing task of auxiliary function that the task namely the service request of data return are carried out to client, for example, one It is a little only to need in the task that server local carries out data preservation or data calculate.
Specifically, server determines that the service request manages task everywhere in corresponding according to the service request, according to institute It states service identification information to distinguish reason task everywhere in service request correspondence, obtain and the service identification information This is determined as data return type task with the matched processing task of the service identification information by the processing task matched, will be described The remaining processing task in addition to data return type task everywhere in service request is corresponding in reason task is determined as non-data Return type task.
Step S203: the main thread where non-data return type task from the data return type task is moved to default Task queue;
Specifically, server can be appointed non-data return type task from the data return type by asynchronous operation mode Main thread where business is moved to preset task queue, and the task in the task queue is not handled on the main thread.
In above-mentioned service request processing method, it is the service request for obtaining client and sending, is carried in the service request There is the service identification information of target service data, determines that the corresponding data of the service request are returned according to the service identification information Hollow task and non-data return type task, by the main thread where non-data return type task from the data return type task It is moved to preset task queue.In this way, the task quantity on main thread where the data return type task reduces, it can To reduce the processing time of task on main thread, main thread can be enabled to end processing process as early as possible, return to target service Data are to client, without returning again to target service data consumers after waiting the processing of non-data return type task to complete End, it is possible to reduce the waiting time of user promotes user experience.
In one of the embodiments, as shown in figure 3, providing a kind of service request response method, this method further include:
Step S301: the data return type task handled in the main thread obtains the target service data;
Step S302: it after the target service data are returned to the client, handles in the task queue Non-data return type task.
In the present embodiment, the data return type task in main thread described in priority processing obtains the target service data, Appoint in the non-data return type returned to the target service data in the client and then the processing task queue Business, can be occupied to avoid the resource in the main thread, can further promote the return effect of the target service data Rate is further reduced the waiting time of user.
Service request processing method provided by the invention can also be applied in application environment as shown in Figure 4, including electricity Sub-device 401, terminal 402 and block chain 403.The skill that electronic device 401 can be suitble to by network, near-field communication technology etc. Art and terminal 402 carry out data interaction.Block chain 403 includes distributed multiple block chain nodes, and each block chain node can To be an independent network server respectively, being also possible to any number of block chain nodes is an independent network service Device, or whole block chain nodes and electronic device 401 are an independent network server together.
Terminal 402 includes but is not limited to that any one can pass through keyboard, mouse, remote controler, touch tablet or sound with user The modes such as control equipment carry out the electronic product of human-computer interaction, for example, personal computer, tablet computer, smart phone, individual digital Assistant (Personal Digital Assistant, PDA), game machine, Interactive Internet TV (Internet Protocol Television, IPTV), intellectual wearable device etc..Corresponding client software is installed, the client in terminal 402 Software can be pre-installed in above-mentioned terminal 402, be also possible to after terminal 402 starts, from third party device or network service Device is downloaded and installs.Wherein, third party device is not construed as limiting in embodiment.Specifically, the client of terminal 402 is soft Part can be used for realizing the interaction between terminal 402 and electronic device 401.To install client in terminal 402 in following embodiment It is illustrated for software.In the examples below, the client software installed in terminal 402 is known as client.
Electronic device 401 be it is a kind of can according to the instruction for being previously set or store, automatic progress numerical value calculating and/or The equipment of information processing.Electronic device 401 can be computer, be also possible to single network server, multiple network servers The server cluster of composition or the cloud being made of a large amount of hosts or network server based on cloud computing, wherein cloud computing are One kind of distributed computing, a super virtual computer consisting of a loosely coupled set of computers.
In the present embodiment, electronic device 401 is include but are not limited to can be in communication with each other depositing for connection by system bus Reservoir 4011, processor 4012 and network interface 4013.It should be pointed out that Fig. 3 is illustrated only with component 4011-4013's Electronic device 401, this is only to show component related with the embodiment of the present invention, and as needed, the implementation that can be substituted is more More or less component.
Wherein, memory 4011 includes the readable storage medium storing program for executing of memory and at least one type.Inside save as electronic device 401 Operation provide caching;Readable storage medium storing program for executing can be deposited for such as flash memory, hard disk, multimedia card, the non-volatile of card-type memory Storage media.In some embodiments, readable storage medium storing program for executing can be the internal storage unit of electronic device 401, such as the electronics The hard disk of device 401;In further embodiments, it deposits the outside which is also possible to electronic device 401 The plug-in type hard disk being equipped on reservoir, such as electronic device 401, intelligent memory card (Smart Media Card, SMC), safety Digital (Secure Digital, SD) card, flash card (Flash Card) etc..In the present embodiment, the readable of memory 4011 is deposited Storage media is installed on the operating system and types of applications software of electronic device 401 commonly used in storage, such as the present invention one is implemented The program code etc. of service request processing unit 4040 in example.In addition, memory 4011 can be also used for temporarily storing Various types of data through exporting or will export.
Processor 4012 may include in some embodiments one or more microprocessor, microcontroller, number at Manage device etc..Processor 4012 is commonly used in the operation of control electronic device 401, such as executes and carry out data interaction with terminal 402 Or the relevant control of communication and processing etc..In the present embodiment, processor 4012 is used to store in run memory 4011 Program code or processing data, such as operation service request processing unit 4040 etc..
Network interface 4013 may include radio network interface or wired network interface, is somebody's turn to do and network interface 4013 is commonly used in Communication connection is established between electronic device 401 and other electronic equipments.In the present embodiment, network interface 13 is mainly used for will be electric Sub-device 401 is connected with one or more terminals 402, establishes data between electronic device 401 and one or more terminals 402 Transmission channel and communication connection.
Service request processing unit 4040 includes that at least one is stored in the computer-readable instruction in memory 4011, should At least one computer-readable instruction can be executed by processor 4012, to realize the service request processing side of each embodiment of the application Method.As described in subsequent, at least one computer-readable instruction is different according to the function that its each section is realized, can be divided into not Same logic module.
In one embodiment, it when service request processing unit 4010 is executed by processor 4012, realizes following operation: obtaining The service request that client is sent carries the service identification information of target service data in the service request, according to the industry Business identification information determines the corresponding data return type task of the service request, according to the data return type task to building in advance Target block chain node in vertical block chain sends data query instruction, and the data query instruction is used to indicate the target Block chain node is inquired in data are locally stored and returns to the target service data;Receiving the target block chain link When the target service data that point returns, the target service data received are returned into the client.Relative to Traditional mode for having needed to be implemented all processing tasks and having returned again to target service data, it is possible to reduce the waiting time of user.
In one embodiment, as shown in figure 5, providing a kind of service request processing method, it is applied to Fig. 4 in this way In electronic device for be illustrated, comprising the following steps:
Step S501: the service request that client is sent is obtained, carries target service data in the service request Service identification information;
Step S502: the corresponding data return type task of the service request and non-is determined according to the service identification information Data return type task;
Step S503: the main thread where non-data return type task from the data return type task is moved to default Task queue;
Wherein, step S501~step S503 can be corresponding referring to above-mentioned step S201~step S203, herein not Add and repeats.
Step S504: the data return type task handled in the main thread obtains the target service data, will be described Target service data return to the client;
Specifically, the data return type task in main thread described in priority processing obtains the target service data, When to the target service data, obtained target service data are returned into the client immediately.
Step S505: the quantity of the non-data return type task is counted;
This step S505 is i.e. executable after determining non-data return type task, does not need to have in step S503 It is executed with after step S504.
Step S506: the non-data return type task is distributed to the block of quantity described in the block chain pre-established Chain link point carries out parallel processing.
In the present embodiment, by the block chain link that the non-data return type task is distributed to quantity described in block chain Point carries out parallel processing, can promote treatment effeciency.Meanwhile after the target service data are returned to the client, The block chain link point that the non-data return type task is distributed to quantity described in the block chain is subjected to parallel processing again, It can be impacted to avoid to data return type task processes.
But it should be recognized that being not limited to this side averagely distributed to the ways of distribution of non-data return type task Formula, for example, it is also possible to be handled one or more block chain link point is distributed in the non-data return type task-set.
It is above-mentioned in one of the embodiments, that the non-data return type task is distributed to the block chain pre-established Described in quantity block chain link point carry out parallel processing, may include: to quantity described in the block chain node pre-established Block chain node send task process instruction, each task process instruction carries the non-data return type and appoints Business, the task process instruction, which is used to indicate, receives the processing of task described in the block chain node processing of the task process instruction The non-data return type task carried in instruction, and obtained processing locality result is distributed in the block chain;To Each block chain node sends data summarization instruction in the block chain node, and data summarization instruction is used to indicate each block chain link Point saves after being summarized the processing locality result for receiving the task process instruction.
Wherein, after non-data return type task is distributed to block chain node, appointed by handling the non-data return type Processing locality result is distributed in the block chain by the block chain node of business, by each block chain node in the block chain It is saved after the processing locality result for handling the block chain node of the non-data return type task is summarized.
For example, for include block chain node 1, block chain node 2, block chain node 3 ..., block chain node n Block chain has m non-data return type task, can m block according to some preset rules or at random into block chain Chain node distribute non-data return type task, one non-data return type task of each block chain node processing, m handle described in Respective processing locality result is distributed in block chain by the block chain node of non-data return type task respectively.Then, block chain In the sheet distributed respectively according to the block chain node of this m processing non-data return type task of n block chain node Ground processing result is summarized, and summarized results is saved respective be locally stored in data.Usually summarized results is aggregated into The form of one account book is saved, and the account book is encrypted before summarizing, and is saved to encrypted account book.
The non-data return type task includes that data calculating task and data save and appoint in one of the embodiments, Business;Receive the data preservation task that the block chain node for the task process instruction that data save task is obtained and received that carries Corresponding target saves data, and the target that will acquire saves data distribution into the block chain;It receives and carries data meter The corresponding data for the data calculating task that the block chain node docking of the task process instruction of calculation task receives calculate To local computing as a result, obtained local computing result is dealt into the block chain.
Data return type task in the above-mentioned processing main thread obtain the target service data can use it is following Any one mode in two ways is realized:
Mode 1:
The data return type task in the processing main thread obtains the target industry in one of the embodiments, Business data may include: the target block chain node hair according to the data return type task into the block chain pre-established Data query is sent to instruct, the data query instruction is used to indicate the target block chain node and inquires in data are locally stored And return to the target service data;It, will when receiving the target service data that the target block chain node returns The target service data received return to the client.
In the present embodiment, target block chain node is responsible for inquiring target service data, does not need to return to target to client Business datum, but target service data are returned to the electronic device for sending data query instruction, in this way, can be not required to Target block chain node and user client communication are wanted, also there is no need to the software moulds of target block chain node configuration and user client communication Block or hardware (for example, network interface), can save deployment cost.
Mode 2:
The data return type task in the processing main thread obtains the target industry in one of the embodiments, Business data may include: the target block chain node hair according to the data return type task into the block chain pre-established Data return instruction is sent, the data return instruction is used to indicate the block chain node for receiving the data return instruction at this The target service data are inquired in ground storing data, and the target service data inquired are returned into the client End.
In the present embodiment, target block chain node is responsible for inquiring target service data, it is also desirable to return to target to client Business datum can so alleviate the burden of the electronic device, the situation larger especially suitable for amount of access.
Any one mode in above two mode can be selected to realize to described based on amount of access and deployment cost The processing of data return type task in main thread.
In one of the embodiments, it is above-mentioned according to the data return type task into the block chain pre-established Target block chain node sends data query instruction, may include: the area that communication distance is nearest in the block chain that will be pre-established Block chain node is sent as the target block chain node, according to the data return type task to the target block chain node Data query instruction.
Wherein, data query instruction can carry the mark of the service identification information or the data return type task Know information or the data return type task, it, can be according to being taken after target block chain node receives data query instruction The service identification information of band or the identification information of data return type task or data return type task, in target block chain The target service data are inquired and are returned in being locally stored in data for node.
Specifically, the available corresponding IP of electronic device (agreement interconnected between network, the Internet Protocol) address information, by each block chain node in the corresponding IP address information of electronic device and block chain Corresponding IP address letter is compared, and determines the nearest block chain node of communication distance according to comparison result, this operation can be with It after the block chain is established, or is only performed once when the block chain updates, has most determining with the client It after the block chain node of short communication distance, is recorded, redefines communication distance again when the block chain updates again Nearest block chain node.Wherein, the update of the block chain refers to newly-increased block chain node or reduces block chain node.Its In, determine that communication distance distance can be by the way of it arbitrarily may be implemented based on IP address information.
In the present embodiment, according to target block chain node of the data return type task into the block chain pre-established Data query instruction is sent, the receiving time of data query instruction sending time and target service data, Ke Yijin can be saved The waiting time of one step reduction user.
In one of the embodiments, it is above-mentioned according to the data return type task into the block chain pre-established Target block chain node sends data query instruction, can also include: that data be not locally stored in the target block chain link In when inquiring the target service data, using the connected block chain link point of current target block chain link as new target area Block chain link returns to the step for sending data query instruction to the target block chain node according to the data return type task Suddenly.
Specifically, as shown in fig. 6, the above-mentioned mesh according to the data return type task into the block chain pre-established It marks block chain node and sends data query instruction, may include:
Step S601: using the nearest block chain node of communication distance in the block chain pre-established as target block chain link Point;
Step S602: data query instruction is sent to target block chain node according to data return type task;
Step S603: target service data are not inquired in data are locally stored in current target block chain node When, using in the connected block chain link point of current target block chain link as new target block chain link, return step S602.
Here, the block chain link point that is connected refers to the block chain link being connected directly in same block chain with target block chain node Point.Those skilled in the art are it should be appreciated that current target block chain node can be with the client with most short The block chain node of communication distance, but be also not necessarily limited to be the block chain node that there is most short communication distance with the client.Example Such as, the block chain node with the client with most short communication distance is block chain node k, the contiguous area of block chain node k Block chain node is block chain node k+1, and the connected block chain link point of block chain node k+1 is block chain node k+2, with such It pushes away.Block chain node k not block chain node k be locally stored in data inquire the target service data when, to area Block chain node k+1 sends data query instruction, and current target block chain node at this time is block chain node k, i.e., with The client has the block chain node of most short communication distance, in block chain node k+1 not in the local of block chain node k+1 When inquiring the target service data in storing data, the data query instruction is sent to block chain node k+2, at this time Current target block chain node is block chain node k+1.
It wherein, can be by the target if target block chain link does not inquire target service data in data are locally stored The identification information of the connected block chain link point of block chain link returns to the electronic device, which is receiving the mark When knowing information, according to the identification information using the connected block chain link point of target block chain link as new target block chain link.
In the present embodiment, target service data are not inquired in data are locally stored in current target block chain node When, the inquiry of target service data can also be carried out by the connected block chain link point of target block chain link, it can be as fast as possible Speed inquires target service data.
In one of the embodiments, as shown in fig. 7, it is above-mentioned according to the data return type task to pre-establishing Target block chain node in block chain sends data query instruction, may include:
Step S701: each block chain link point in the block chain pre-established is ranked up according to communication distance, is obtained Ranking results;
Here, the communication distance is the communication distance of each block chain node and the electronic equipment.Specifically, may be used Each block chain link point to be ranked up from small to large according to communication distance, ranking results are obtained.
Step S702: a block is successively selected according to the sequence of communication distance from small to large according to the ranking results Chain node is as target block chain node;
Step S703: data query is sent to the target block chain node currently selected according to data return type task and is referred to It enables;
Step S704: target service data are not inquired in data are locally stored in the target block chain link currently selected When, next block chain node is selected as new target block chain node, return step S703 according to ranking results.
Wherein, target service data are not inquired in data are locally stored in the small block chain node of communication distance first When, next block chain node is the small block chain node of communication distance second, in the small block chain node of communication distance second When not inquiring target service data in data are locally stored, next block chain node is the small block of communication distance third Chain node, and so on.
Using the scheme in the present embodiment, communication delay can be reduced as far as possible.In addition, above-mentioned according to the data Target block chain node of the return type task into the block chain pre-established sends data query instruction, can also include: When the current task treating capacity of current target block chain link is more than preset threshold, next block chain is selected according to ranking results Node is as new target block chain node using the connected block chain link point of current target block chain link as new target area Block chain link returns to the step for sending data query instruction to the target block chain node according to the data return type task Suddenly.
Using the scheme in the present embodiment, it can distribute to avoid task and excessively concentrate, can also be further reduced user's Waiting time.
In one of the embodiments, it is above-mentioned according to the data return type task into the block chain pre-established Target block chain node sends data query instruction, can also include: that data be not locally stored in the target block chain link In when inquiring the target service data, using the connected block chain link point of current target block chain link as new target area Block chain link forwards the data query instruction from current target block chain link to new target block chain link.
Using the scheme in the present embodiment, do not need that communication can also be reduced to the electronic device feedback information again Delay.
It is above-mentioned to receive the mesh in one of the embodiments, when the target block chain node is multiple When marking the target service data that block chain node returns, the target service data received are returned into the client End may include: that the target service data returned to each target block chain node receive, will be initially received The target service data return to the client.
In the present embodiment, it is multiple in the target block chain node, is to be returned respectively to each target block chain node The target service data returned are received, and through the target service data being initially received are returned to the client End, this manner it is also possible to reduce the waiting time of user as far as possible.
In one of the embodiments, it is above-mentioned according to the data return type task into the block chain pre-established Target block chain node sends data return instruction, may include: according to the data return type task to the area pre-established With the client there is the block chain node of most short communication distance to send data return instruction in block chain.That is, above-mentioned mesh Marking block chain node is the block chain node for having most short communication distance with the client.
Specifically, the available operation client the corresponding IP of terminal (agreement interconnected between network, Internet Protocol) address information, it will be in the corresponding IP address information of terminal that the client be run and block chain The IP address letter of each block chain node is compared, and has most short communication distance with the client according to comparison result is determining Block chain node.Wherein, determine that communication distance distance can be by the way of it arbitrarily may be implemented based on IP address information.It connects The block chain node for receiving the data return instruction is inquired and the service identification information or institute in data are locally stored The corresponding account book of identification information for stating data return type task, obtains the target service data, by what is obtained after being decrypted The target service data return to the client.
In the present embodiment, by instruction control and the client there is the block chain node of most short communication distance to execute number It operates, can save the processing time of service request according to obtaining and returning, promote service request treatment effeciency, can further subtract The waiting time of few user.Meanwhile in the embodiment of the present invention, it is to be realized based on distributed block chain, is needed when the same time When handling a large amount of service request, treatment effeciency can be significantly improved.
In one of the embodiments, it is above-mentioned according to the data return type task into the block chain pre-established Target block chain node sends data return instruction, can also include: in the block for being currently received the data return instruction When chain node does not inquire the target service data in data are locally stored, to being currently received the data return instruction The connected block chain link point of block chain node send the data return instruction.
When there are multiple connected block chain link points, it can be to any one block chain link point that is connected and send the data Return instruction, to indicate that the block chain link point that is connected inquires the target service data in data are locally stored, and will inquiry To the target service data return to the client.
In one of the embodiments, when the connected block chain link point is multiple, by getting the mesh at first The connected block chain link point for marking business datum returns to target service data to the client.In this way, use can be further reduced The waiting time at family.
Although should be understood that Fig. 2-3 and Fig. 5-7 flow chart in each step according to arrow instruction successively It has been shown that, but these steps are not that the inevitable sequence according to arrow instruction successively executes.Unless expressly state otherwise herein, There is no stringent sequences to limit for the execution of these steps, these steps can execute in other order.Moreover, Fig. 2-3 with And at least part step in Fig. 5-7 may include that perhaps these sub-steps of multiple stages or stage be simultaneously for multiple sub-steps It is not necessarily and executes completion in synchronization, but can execute at different times, the execution in these sub-steps or stage Sequence, which is also not necessarily, successively to be carried out, but can be at least the one of the sub-step or stage of other steps or other steps Part executes in turn or alternately.
In one embodiment, as shown in figure 8, providing a kind of service request processing unit, comprising: request receiving module 801, assessment of tasks module 802 and task shift module 803, in which:
Request receiving module 801 carries target in the service request for obtaining the service request of client transmission The service identification information of business datum;
Assessment of tasks module 802, for determining that the corresponding data of the service request are returned according to the service identification information Hollow task and non-data return type task;
Task shift module 803, for by the main line where non-data return type task from the data return type task Journey is moved to preset task queue.
It in one of the embodiments, as shown in figure 8, can be with task processing and control module 804, processing and control module 804 obtain the target service data for the data return type tasks that handle in the main thread, by the target service After data return to the client, the non-data return type task in the task queue is handled.
Processing and control module 804 can count the quantity of the non-data return type task in one of the embodiments, After the target service data are returned to the client, the non-data return type task is distributed to and is pre-established The block chain link point of quantity described in block chain carries out parallel processing.
Processing and control module 804 can be to number described in the block chain node pre-established in one of the embodiments, The block chain node of amount sends task process instruction, and each task process instruction carries the non-data return type and appoints Business, the task process instruction, which is used to indicate, receives the processing of task described in the block chain node processing of the task process instruction The non-data return type task carried in instruction, and obtained processing locality result is distributed in the block chain;To Each block chain node sends data summarization instruction in the block chain node, and data summarization instruction is used to indicate each block chain link Point saves after being summarized the processing locality result for receiving the task process instruction.
The non-data return type task includes that data calculating task and data save and appoint in one of the embodiments, Business;Receive the data preservation task that the block chain node for the task process instruction that data save task is obtained and received that carries Corresponding target saves data, and the target that will acquire saves data distribution into the block chain;It receives and carries data meter The corresponding data for the data calculating task that the block chain node docking of the task process instruction of calculation task receives calculate To local computing as a result, obtained local computing result is dealt into the block chain.
Processing and control module 804 can be according to the data return type task to building in advance in one of the embodiments, Target block chain node in vertical block chain sends data query instruction, and the data query instruction is used to indicate the target Block chain node is inquired in data are locally stored and returns to the target service data;Receiving the target block chain link When the target service data that point returns, the target service data received are returned into the client.
Processing and control module 804 can be according to the data return type task to building in advance in one of the embodiments, Target block chain node in vertical block chain sends data return instruction, and the data return instruction, which is used to indicate, receives institute The block chain node for stating data return instruction inquires the target service data, and the institute that will be inquired in data are locally stored It states target service data and returns to the client.
In one embodiment, a kind of computer equipment is provided, which can be server, internal junction Composition can be as shown in Figure 7.The computer equipment include by system bus connect processor, memory, network interface and Database.Wherein, the processor of the computer equipment is for providing calculating and control ability.The memory packet of the computer equipment Include non-volatile memory medium, built-in storage.The non-volatile memory medium is stored with operating system, computer program and data Library.The built-in storage provides environment for the operation of operating system and computer program in non-volatile memory medium.The calculating The database of machine equipment is used for storage service request processing data.The network interface of the computer equipment is used for and external terminal It is communicated by network connection.To realize a kind of service request processing method when the computer program is executed by processor.
It will be understood by those skilled in the art that structure shown in Fig. 7, only part relevant to the present invention program is tied The block diagram of structure does not constitute the restriction for the computer equipment being applied thereon to the present invention program, specific computer equipment It may include perhaps combining certain components or with different component layouts than more or fewer components as shown in the figure.
In one embodiment, a kind of computer equipment is provided, including memory, processor and storage are on a memory And the computer program that can be run on a processor, processor perform the steps of acquisition client when executing computer program The service request of transmission carries the service identification information of target service data in the service request;According to the business mark Know information and determines the corresponding data return type task of the service request and non-data return type task;Non-data return type is appointed Business is moved to preset task queue from the main thread where the data return type task.
In one embodiment, it is also performed the steps of when processor executes computer program in the processing main thread Data return type task obtain the target service data;By the target service data return to the client it Afterwards, the non-data return type task in the task queue is handled.
In one embodiment, processor, which executes, returns to described in computer program realization by the target service data After the client, when handling the step of the non-data return type task in the task queue, following steps are implemented: Count the quantity of the non-data return type task;It, will be described after the target service data are returned to the client The block chain link point that non-data return type task is distributed to quantity described in the block chain pre-established carries out parallel processing.
In one embodiment, it is described by non-data return type task distribution to execute computer program realization for processor When carrying out the step of parallel processing to the block chain link point of quantity described in the block chain pre-established, following step is implemented It is rapid: to send task process instruction, each task to the block chain node of quantity described in the block chain node pre-established Process instruction carries a non-data return type task, and the task process instruction, which is used to indicate, to be received at the task It manages the non-data return type task carried in task process instruction described in the block chain node processing of instruction, and will obtain Processing locality result is distributed in the block chain;Into the block chain node, each block chain node sends data summarization and refers to It enables, data summarization instruction is used to indicate the processing locality result that each block chain node will receive the task process instruction It is saved after being summarized.
In one embodiment, processor executes computer program and realizes that the data in the processing main thread return When type task obtains the step of the target service data, implement following steps: according to the data return type task to Target block chain node in the block chain pre-established sends data query instruction, and the data query instruction is used to indicate institute Target block chain node is stated to inquire in data are locally stored and return to the target service data;Receiving the target area When the target service data that block chain node returns, the target service data received are returned into the client.
In one embodiment, processor executes computer program and realizes that the data in the processing main thread return When type task obtains the step of the target service data, implement following steps: according to the data return type task to Target block chain node in the block chain pre-established sends data return instruction, and the data return instruction, which is used to indicate, to be connect The block chain node for receiving the data return instruction inquires the target service data in data are locally stored, and will inquiry To the target service data return to the client.
In one embodiment, a kind of computer readable storage medium is provided, computer program is stored thereon with, is calculated Machine program performs the steps of when being executed by processor obtains the service request that client is sent, and carries in the service request There is the service identification information of target service data;Determine that the corresponding data of the service request are returned according to the service identification information Hollow task and non-data return type task;By the main thread where non-data return type task from the data return type task It is moved to preset task queue.
In one embodiment, the processing main thread is also performed the steps of when processor is executed by computer program In data return type task obtain the target service data;By the target service data return to the client it Afterwards, the non-data return type task in the task queue is handled.
In one embodiment, processor is executed by computer program and is returned described in realization by the target service data After the client, when handling the step of the non-data return type task in the task queue, following step is implemented It is rapid: to count the quantity of the non-data return type task;After the target service data are returned to the client, by institute State the block chain link point progress parallel processing that non-data return type task is distributed to quantity described in the block chain pre-established.
In one embodiment, processor is realized described by the non-data return type task point by computer program execution When issuing the step of block chain link point progress parallel processing of quantity described in the block chain pre-established, following step is implemented It is rapid: to send task process instruction, each task to the block chain node of quantity described in the block chain node pre-established Process instruction carries a non-data return type task, and the task process instruction, which is used to indicate, to be received at the task It manages the non-data return type task carried in task process instruction described in the block chain node processing of instruction, and will obtain Processing locality result is distributed in the block chain;Into the block chain node, each block chain node sends data summarization and refers to It enables, data summarization instruction is used to indicate the processing locality result that each block chain node will receive the task process instruction It is saved after being summarized.
In one embodiment, processor is executed by computer program realizes that the data in the processing main thread are returned When hollow task obtains the step of the target service data, following steps are implemented: according to the data return type task Target block chain node into the block chain pre-established sends data query instruction, and the data query instruction is used to indicate The target block chain node is inquired in data are locally stored and returns to the target service data;Receiving the target When the target service data that block chain node returns, the target service data received are returned into the client End.
In one embodiment, processor is executed by computer program realizes that the data in the processing main thread are returned When hollow task obtains the step of the target service data, following steps are implemented: according to the data return type task Target block chain node into the block chain pre-established sends data return instruction, and the data return instruction is used to indicate The block chain node for receiving the data return instruction inquires the target service data in data are locally stored, and will look into The target service data ask return to the client.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, the computer program can be stored in a non-volatile computer In read/write memory medium, the computer program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, To any reference of memory, storage, database or other media used in each embodiment provided by the present invention, Including non-volatile and/or volatile memory.Nonvolatile memory may include read-only memory (ROM), programming ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include Random access memory (RAM) or external cache.By way of illustration and not limitation, RAM is available in many forms, Such as static state RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate sdram (DDRSDRAM), enhancing Type SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
Each technical characteristic of above embodiments can be combined arbitrarily, for simplicity of description, not to above-described embodiment In each technical characteristic it is all possible combination be all described, as long as however, the combination of these technical characteristics be not present lance Shield all should be considered as described in this specification.
The embodiments described above only express several embodiments of the present invention, and the description thereof is more specific and detailed, but simultaneously It cannot therefore be construed as limiting the scope of the patent.It should be pointed out that coming for those of ordinary skill in the art It says, without departing from the inventive concept of the premise, various modifications and improvements can be made, these belong to protection of the invention Range.Therefore, the scope of protection of the patent of the invention shall be subject to the appended claims.

Claims (10)

1. a kind of service request processing method, which is characterized in that the described method includes:
The service request that client is sent is obtained, the service identification information of target service data is carried in the service request;
Determine that the corresponding data return type task of the service request and non-data return type are appointed according to the service identification information Business;
Main thread where non-data return type task from the data return type task is moved to preset task queue.
2. according to service request processing method described in claims 1, which is characterized in that the method also includes:
The data return type task handled in the main thread obtains the target service data;
After the target service data are returned to the client, the non-data return type in the task queue is handled Task.
3. service request processing method according to claim 2, which is characterized in that described by the target service number After returning to the client, the non-data return type task in the task queue is handled, comprising:
Count the quantity of the non-data return type task;
After the target service data are returned to the client, the non-data return type task is distributed to and is built in advance The block chain link point of quantity described in vertical block chain carries out parallel processing.
4. service request processing method according to claim 3, which is characterized in that described to appoint the non-data return type The block chain link point that business is distributed to quantity described in the block chain pre-established carries out parallel processing, comprising:
Task process instruction, each task are sent to the block chain node of quantity described in the block chain node pre-established Process instruction carries a non-data return type task, and the task process instruction, which is used to indicate, to be received at the task It manages the non-data return type task carried in task process instruction described in the block chain node processing of instruction, and will obtain Processing locality result is distributed in the block chain;
Into the block chain node, each block chain node sends data summarization instruction, and data summarization instruction is used to indicate each area Block chain node saves after being summarized the processing locality result for receiving the task process instruction.
5. service request processing method according to claim 4, which is characterized in that the non-data return type task includes Data calculating task and data save task;The block chain node for receiving the task process instruction for carrying data preservation task obtains Target corresponding with the data preservation task received is taken to save data, the target that will acquire saves data distribution to the area In block chain;The block chain node for receiving the task process instruction for carrying data calculating task docks the data calculating task received Corresponding data carry out that local computing is calculated as a result, obtained local computing result is dealt into the block chain.
6. service request processing method according to claim 2, which is characterized in that in the processing main thread Data return type task obtains the target service data, comprising:
Data query is sent according to target block chain node of the data return type task into the block chain pre-established to refer to It enables, the data query instruction is used to indicate the target block chain node and inquires in data are locally stored and return to the mesh Mark business datum;
When receiving the target service data that the target block chain node returns, the target service that will receive Data return to the client.
7. service request processing method according to claim 2, which is characterized in that in the processing main thread Data return type task obtains the target service data, comprising:
Data return is sent according to target block chain node of the data return type task into the block chain pre-established to refer to It enables, the data return instruction is used to indicate the block chain node for receiving the data return instruction in data are locally stored The target service data are inquired, and the target service data inquired are returned into the client.
8. a kind of service request processing unit, which is characterized in that described device includes:
Request receiving module carries target service number in the service request for obtaining the service request of client transmission According to service identification information;
Assessment of tasks module, for determining the corresponding data return type task of the service request according to the service identification information With non-data return type task;
Task shift module, for the main thread where non-data return type task from the data return type task to be moved to Preset task queue.
9. a kind of computer equipment including memory, processor and stores the meter that can be run on a memory and on a processor Calculation machine program, which is characterized in that the processor realizes any one of claims 1 to 7 institute when executing the computer program The step of stating method.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program The step of method described in any one of claims 1 to 7 is realized when being executed by processor.
CN201810848301.8A 2018-07-27 2018-07-27 Service request processing method, device, computer equipment and storage medium Pending CN109508243A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810848301.8A CN109508243A (en) 2018-07-27 2018-07-27 Service request processing method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810848301.8A CN109508243A (en) 2018-07-27 2018-07-27 Service request processing method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN109508243A true CN109508243A (en) 2019-03-22

Family

ID=65745488

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810848301.8A Pending CN109508243A (en) 2018-07-27 2018-07-27 Service request processing method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109508243A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110943993A (en) * 2019-12-02 2020-03-31 北京锐安科技有限公司 Method and device for requesting preposition, computer equipment and storage medium
CN111782350A (en) * 2019-06-25 2020-10-16 北京京东尚科信息技术有限公司 Service processing method and device
CN112764948A (en) * 2021-01-22 2021-05-07 土巴兔集团股份有限公司 Data transmission method, data transmission device, computer device, and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103516536A (en) * 2012-06-26 2014-01-15 重庆新媒农信科技有限公司 Server service request parallel processing method based on thread number limit and system thereof
CN104714835A (en) * 2013-12-16 2015-06-17 中国移动通信集团公司 Data access processing method and device
CN106528293A (en) * 2016-11-04 2017-03-22 武汉斗鱼网络科技有限公司 Database access method and apparatus
CN107291862A (en) * 2017-06-12 2017-10-24 腾讯科技(深圳)有限公司 Business datum storage method, device, storage medium and electronic equipment
CN107633451A (en) * 2017-10-23 2018-01-26 深圳市中润四方信息技术有限公司 A kind of tax-related service processing method, system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103516536A (en) * 2012-06-26 2014-01-15 重庆新媒农信科技有限公司 Server service request parallel processing method based on thread number limit and system thereof
CN104714835A (en) * 2013-12-16 2015-06-17 中国移动通信集团公司 Data access processing method and device
CN106528293A (en) * 2016-11-04 2017-03-22 武汉斗鱼网络科技有限公司 Database access method and apparatus
CN107291862A (en) * 2017-06-12 2017-10-24 腾讯科技(深圳)有限公司 Business datum storage method, device, storage medium and electronic equipment
CN107633451A (en) * 2017-10-23 2018-01-26 深圳市中润四方信息技术有限公司 A kind of tax-related service processing method, system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111782350A (en) * 2019-06-25 2020-10-16 北京京东尚科信息技术有限公司 Service processing method and device
CN110943993A (en) * 2019-12-02 2020-03-31 北京锐安科技有限公司 Method and device for requesting preposition, computer equipment and storage medium
CN112764948A (en) * 2021-01-22 2021-05-07 土巴兔集团股份有限公司 Data transmission method, data transmission device, computer device, and storage medium

Similar Documents

Publication Publication Date Title
CN108924250A (en) Service request processing method, device and computer equipment based on block chain
CN109040227A (en) Service request response method, device and computer equipment based on block chain
CN103457960B (en) The method and system of load document in web game
CN107395665A (en) A kind of block chain service handling and business common recognition method and device
US20110252461A1 (en) Methods, apparatus and systems for providing secure information via multiple authorized channels to authenticated users and user devices
CN109508243A (en) Service request processing method, device, computer equipment and storage medium
CN108965450A (en) Service request response method, device, computer equipment and storage medium
CN105379206B (en) Message processing method, forwarding device and message handling system in network
CN109040298A (en) Data processing method and device based on edge calculations technology
CN108737570A (en) A kind of information-pushing method, apparatus and system
CN102281320A (en) Method for controlling data redundancy in cloud storage and apparatus thereof
CN106572146A (en) Message sending method and message sending device
CN109873839A (en) Method, server and the distributed system of data access
CN107370684A (en) Business current-limiting method and business current-limiting apparatus
WO2022192559A1 (en) Technologies for managing collaborative and multiplatform media content playlists
CN110930011B (en) Industrial control system and method, electronic equipment and storage medium
CN106657182B (en) Cloud file processing method and device
CN109522462A (en) A kind of cloud querying method, device, equipment and storage medium based on block chain
CN107888663A (en) A kind of method of distribution of document, equipment and computer-readable medium
CN108111598B (en) Cloud disk data issuing method and device and storage medium
CN106843971A (en) BIOS method for refreshing, server, BMC, medium and storage control
CN110168513A (en) The part of big file is stored in different storage systems
CN106790445A (en) Data transmission method, device and electronic equipment based on Samba agreements
CN107968812A (en) The method and device of synchronous local resource and Internet resources
CN108011801A (en) Method, unit and the system of data transfer

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190322