CN111176866A - Data interaction method and electronic equipment - Google Patents

Data interaction method and electronic equipment Download PDF

Info

Publication number
CN111176866A
CN111176866A CN202010009122.2A CN202010009122A CN111176866A CN 111176866 A CN111176866 A CN 111176866A CN 202010009122 A CN202010009122 A CN 202010009122A CN 111176866 A CN111176866 A CN 111176866A
Authority
CN
China
Prior art keywords
request
server
service
target equipment
interaction
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
CN202010009122.2A
Other languages
Chinese (zh)
Inventor
陈杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing second hand Artificial Intelligence Technology Co.,Ltd.
Original Assignee
Admaster Technology Beijing 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 Admaster Technology Beijing Co ltd filed Critical Admaster Technology Beijing Co ltd
Priority to CN202010009122.2A priority Critical patent/CN111176866A/en
Publication of CN111176866A publication Critical patent/CN111176866A/en
Pending legal-status Critical Current

Links

Images

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
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/32Monitoring with visual or acoustical indication of the functioning of the machine
    • G06F11/324Display of status information
    • G06F11/327Alarm or error message display
    • 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/542Event management; Broadcasting; Multicasting; Notifications
    • 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)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Quality & Reliability (AREA)
  • Computer And Data Communications (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The embodiment of the application provides a data interaction method and electronic equipment, and the method can comprise the following steps: when the current network is in a smooth state, sending an interaction request to a server on the target equipment; judging whether the server on the target device correctly responds to the interactive request; when the server on the target equipment does not correctly respond to the interaction request, initiating a polling request to the server on the target equipment according to the interaction request; and when the polling failure times reach the preset times, storing the interactive request according to the type of the interactive request or closing the service corresponding to the interactive request. Therefore, the problem that the reason for the data request response failure is difficult to know in the prior art is favorably solved.

Description

Data interaction method and electronic equipment
Technical Field
The application relates to the technical field of communication, in particular to a data interaction method and electronic equipment.
Background
With the development of technology and the demand of the era, the interaction of real-time data in the network becomes more and more frequent. However, in an actual network interaction scenario, a phenomenon that one party initiates a data request but cannot wait for data return often occurs, which causes immeasurable loss to real-time data interaction.
One way of the prior art is: when the request is overtime or fails, the relevant error code is prompted to make the caller know the details of the current request response, but the method only can inform the caller of the final calling result, and in fact, a user needs to expend a great deal of effort to find the fault reason, and more data problems are caused by the condition of a great number of request failures in the period.
Disclosure of Invention
An embodiment of the present application provides a data interaction method and an electronic device, so as to solve a problem in the prior art that it is difficult to know a reason for a data request response failure.
In a first aspect, an embodiment of the present application provides a data interaction method, which is applied to a first terminal, and the method includes:
when the current network is in a smooth state, sending an interaction request to a server on the target equipment;
judging whether the server on the target equipment correctly responds to the interaction request;
when the server on the target equipment does not correctly respond to the interaction request, initiating a polling request to the server on the target equipment according to the interaction request;
and when the polling failure times reach preset times, storing the interactive request according to the type of the interactive request or closing the service corresponding to the interactive request.
By the method, the response influence of external factors on the request caused by bandwidth or other network problems can be reduced, whether the operation condition of the server is normal or not can be detected through the interactive request, the follow-up fault removal is facilitated, and the loss of the application terminal caused by the server problem can be reduced when the polling failure times are excessive. Therefore, the probability of interactive request response failure can be reduced, and the request data loss of the application end or the more serious service avalanche effect caused by the problem of the service end can be avoided when the interactive request fails to respond correctly and the polling failure times are too many.
In an alternative embodiment, the method further comprises:
when the polling failure times reach preset times, sending an early warning prompt message to a preset user terminal according to the type of the interaction request;
or when the current network is not in a smooth state, sending an early warning prompt message to a preset user terminal.
Through the embodiment, the corresponding early warning prompt messages can be respectively sent to the preset user terminals according to different conditions, fault troubleshooting is facilitated, and waiting time of the application terminal is shortened.
In an optional implementation manner, before sending the interaction request to the server on the target device, the method further includes:
sending test data to the network address of the target equipment at regular time according to a preset time interval;
and determining the current network state according to the response condition of the target equipment to the test data.
By the implementation mode, the current network state of the target equipment with the server is favorably monitored, so that the current network state of the server is known in time, and more request response failures caused by the network problem of the equipment with the server are avoided as much as possible.
In an optional embodiment, the sending test data to the network address of the target device at regular time according to the preset time interval includes:
regularly sending a test data packet with specified bytes to a network address of the target equipment through an Internet packet explorer according to a preset time interval;
the determining the current network state according to the response condition of the target device to the test data includes:
when a response data packet returned by the target equipment according to the test data packet is received, judging whether the byte number of the response data packet is the same as that of the test data packet or not;
and when the byte number of the response data packet is the same as that of the test data packet, determining that the current network is in a smooth state.
By the implementation method, the current network situation of the deployment equipment of the server can be quickly known.
In an optional embodiment, the storing the interactive request or closing a service corresponding to the interactive request according to the type of the interactive request when the polling failure times reach a preset number includes:
and when the polling failure times reach preset times, storing the service request in a message queue.
By the implementation mode, the loss of the service request data of the application end caused by the problem of the server end can be avoided.
In an alternative embodiment, the method further comprises:
and in response to the recovery operation of the service request, resending the service request stored in the message queue to the target device.
Through the implementation mode, the originally interrupted service request can be rapidly retransmitted to the target equipment, and the service end can continue to process the service of the original terminal as soon as possible.
In an optional implementation manner, the sending the interaction request to the server on the target device when the current network is in a clear state includes:
when the current network is in a smooth state, acquiring an idle time length, wherein the idle time length represents the time length from the last time when data is sent to the target equipment to the current time;
judging whether the idle time reaches a first time threshold value or not;
and when the idle time reaches a first time threshold, sending the appointment request to a server on the target equipment.
By the implementation mode, whether the service of the service terminal deployed on the target equipment is available or not can be detected according to the appointed request, and the service running condition of the service terminal can be known in time.
In an optional implementation manner, the determining whether the server on the target device correctly responds to the interaction request includes:
judging whether a server on the target equipment returns appointed data according to the appointed request within an appointed time period or not;
when the server on the target equipment returns the appointment data according to the appointment request in the appointed time period, the server on the target equipment is determined to correctly respond to the appointment request, and therefore the server on the target equipment is determined to be in the service available state.
Through the implementation mode, the service operation condition of the service end can be known in time.
In an optional embodiment, the storing the interactive request or closing the service corresponding to the interactive request according to the type of the interactive request when the polling failure times reach a preset number of times includes:
and when the polling failure times reach the preset times, closing the specified service of the first terminal according to the appointment request, wherein the specified service is the service corresponding to the appointment request.
Through the embodiment, the service avalanche effect of the application end caused by the problem of the service end is avoided.
In a second aspect, the present application also provides a data interaction apparatus, including:
the interaction module is used for sending an interaction request to a server on the target equipment when the current network is in a smooth state;
the judging module is used for judging whether the server on the target equipment correctly responds to the interaction request;
the polling module is used for initiating a polling request to the server on the target equipment according to the interaction request when the server on the target equipment does not correctly respond to the interaction request;
and the execution module is used for storing the interactive request or closing the service corresponding to the interactive request according to the type of the interactive request when the polling failure times reach a preset time.
The device can execute the method provided by the first aspect, which not only can reduce the probability of response failure of the interactive request, but also can avoid the loss of request data of the application terminal or the more serious service avalanche effect caused by the problem of the service terminal when the interactive request fails to respond correctly and the polling failure times are too many.
In a third aspect, an embodiment of the present application provides an electronic device, including:
a memory;
a processor;
the memory stores a computer program executable by the processor, the computer program, when executed by the processor, performing the method provided by the aforementioned first aspect.
In a fourth aspect, an embodiment of the present application further provides a storage medium, where a computer program is stored on the storage medium, and the computer program, when executed by a processor, performs the method provided in the foregoing first aspect.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic diagram of interaction between an application and a server according to an embodiment of the present disclosure.
Fig. 2 is a block diagram of an electronic device according to an embodiment of the present disclosure.
Fig. 3 is a flowchart of a data interaction method according to an embodiment of the present application.
Fig. 4 is a functional block diagram of a data interaction device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
In general, in an actual network interaction process, an interaction failure may be caused by various unknown reasons, for example, a data request may not be normally responded due to problems such as a format error of a request parameter, a network bandwidth problem, and a limitation of a Virtual Private Network (VPN), or a data request may not be normally responded due to a problem such as a server downtime.
Considering that the response failure of the data request due to the server side is uncontrollable for the application side and the loss caused by the response failure due to the server side is huge, the inventor proposes a solution for the uncontrollable response of the server side to the requested data. Therefore, analysis reference basis can be provided when response fails, so that related personnel can be helped to perform troubleshooting, and loss caused by unavailable service of the application end due to the problem on the side of the service end is reduced as much as possible.
Referring to fig. 1, fig. 1 is a schematic diagram illustrating an interaction between an application 100 and a server 200 according to an embodiment of the present disclosure.
As shown in fig. 1, an application 100 and a server 200 perform data interaction through a network. The application 100 may be a party initiating a data request, and the application 100 may be deployed on a first terminal, and there may be at least one application 100 on the same first terminal. The server 200 is a party that responds according to the data request of the application 100, and the server 200 may be deployed on a target device.
In an application scenario, multiple applications 100 may interact with the same server 200. For example, for 10 applications 100 for code scanning payment, all 10 applications 100 may perform data interaction with the same service 200 providing payment service (e.g., transaction-like service such as pay pal).
In another application scenario, the same application 100 may interact with multiple servers 200. For example, for an application 100 for instant messaging, data interaction can be performed with a server 200 for providing chat service, mail service, game service, and the like.
Referring to fig. 2, fig. 2 is a block diagram of an electronic device 300 according to an embodiment of the present disclosure. The electronic device 300 may be a first terminal in which the application 100 is deployed.
As shown in fig. 2, the electronic device 300 includes: memory 301, processor 302, network element 303. The memory 301, processor 302, network unit 303, etc. communicate among each other via one or more communication buses/signal lines.
The memory 301 is a storage medium and may be used to store a computer program, for example, a computer program corresponding to the data interaction method provided in the embodiments of the present application. The processor 302 has an arithmetic processing capability, and the processor 302 can implement the data interaction method provided by the embodiment of the present application by running the computer program stored in the memory 301.
The memory 301 may be, but is not limited to: random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Read-Only Memory (EPROM), electrically Erasable Read-Only Memory (EEPROM), and the like.
The processor 302 may be, but is not limited to: a Central Processing Unit (CPU), a Network Processor (NP), and other general processors, and may also be a digital signal Processor, an application specific integrated circuit, a field programmable gate array, or a special Processor built by other programmable logic devices and discrete components.
The electronic device 300 may implement a network connection with an external device through the network unit 303.
It is understood that the structure shown in fig. 2 is for illustration only, and the electronic device 300 may have more components than shown in fig. 2 or a different configuration than that shown in fig. 2 for a specific application. In the embodiment of the present application, the electronic device 300 may be a personal computer, a server, a mobile device, a wearable device, an in-vehicle device, or the like, which is capable of connecting to a network and has an arithmetic processing capability.
Referring to fig. 3, fig. 3 is a flowchart of a data interaction method according to an embodiment of the present disclosure. The data interaction method may be applied to the application 100, wherein substantially all the content applied to the application 100 in the embodiment of the present application may also be applied to a first terminal deployed with the application 100, and implemented by the first terminal.
As shown in FIG. 3, the method includes steps S11-S14.
S11: and when the current network is in a smooth state, sending an interaction request to a server on the target equipment.
Wherein, the target device is provided with a server. The first terminal can perform network detection before sending the interaction request to the target device, and can be implemented by an application program on the first terminal during network detection. And when the current network is detected and determined to be in a smooth state, the application end of the first terminal sends an interaction request to the server end deployed on the target equipment, and waits for the server end to return response content according to the interaction request.
The interaction request may be an appointment request for detecting whether a server deployed on the target device is in an available state, or a service request initiated to the server according to an actual service requirement.
S12: and judging whether the server on the target equipment correctly responds to the interactive request.
The response of the target device to the interactive request is realized through the server, and the application end can judge whether the target device responds to the interactive request correctly by combining the time when the server returns data according to the interactive request and the returned specific content.
S13: and when the server on the target equipment does not correctly respond to the interaction request, initiating a polling request to the server on the target equipment according to the interaction request.
The correct response means that the server on the target device returns data required by the application within a specified time. And under the condition that the server on the target equipment does not respond correctly to the interactive request, initiating a polling request to the target equipment according to the interactive request so as to try to make a data request again. The content of the polling request is determined based on the content of the interactive request.
Wherein the frequency of polling requests and the time interval of polling can be arbitrarily configured by those skilled in the art.
S14: and when the polling failure times reach the preset times, storing the interactive request according to the type of the interactive request or closing the service corresponding to the interactive request.
The preset times can be set arbitrarily by those skilled in the art according to actual needs, and the preset times can be 3 times, 5 times, 7 times and the like. The interaction requests that need to be stored may be stored in a Message Queue (MQ) of the first terminal.
When the polling failure times reach the preset times, determining that the interactive request fails, and processing the interactive request initiated by the application terminal or processing the service corresponding to the interactive request by the first terminal according to the specific type of the interactive request, thereby avoiding the occurrence of subsequent more unknown losses.
In one example, payment data interaction may be conducted between application A1 and service B1. When the application A1 determines that the current network is in a smooth state, the first terminal with the application A1 deployed initiates a payment request to the service B1 after scanning the payment identifier, wherein the payment request is a service request in the interactive request. If the server B2 agrees to the payment request within the specified time period and returns the deduction success flag, it indicates that the payment request is responded correctly. If the service B2 does not grant the payment request within the specified time period, a polling request is initiated according to the payment request, and the content of the polling request may be the same as that of the payment request. When the number of failed polling requests reaches 2 times, it is determined that the current payment request of the application end is not successfully responded, and the failed payment request can be stored in a message queue, so that the subsequent data statistical analysis is facilitated or the request is initiated again according to the failed payment request. It will be appreciated that more types of service requests that fail to respond may also be stored in the message queue.
In another example, the application a2 initiates a data migration request to the server B2, where the data migration request is an interactive request to migrate, back up, or merge system service data. When the server B2 does not respond correctly to the data migration request within a specified time period, the application a2 initiates a polling request to the server B2, and if the server B2 responds to the polling request during the polling process, the data migration request may be considered valid, and the system service data may be migrated.
In another example, when the application A3 and the server B3 do not communicate for a long time, in order to confirm that a service Y (e.g., a service corresponding to a chat function, a mail function, a music function, a game function, etc.) provided by the server B3 at this time is still active, the application A3 sends an agreement request to the server B3, and the agreement request is an interaction request. If server A3 responds correctly to the contract request, it indicates that the services provided by server B3 are currently available. If the server B3 does not respond to the contract request correctly, the application A3 polls the server A3 according to the contract request, and if the number of failed polls reaches 4, and if the server B3 still fails to respond, the application A3 may close the service Y corresponding to the contract request at the application A3, thereby avoiding the occurrence of service avalanche effect at the application A3 due to a problem at the side of the server B3. The "service avalanche effect" is a phenomenon in which "service invokers are not available" (as a result) due to "unavailability of service providers" (cause), and the "unavailability" condition is gradually amplified.
Through the method, the first terminal sends the interaction request to the target equipment under the condition that the current network is in a smooth state, the application terminal sends the interaction request to the server terminal under the condition that the current network is in the smooth state, when the interaction request does not obtain the correct response of one side of the server terminal, the first terminal initiates a polling request to the server terminal according to the specific interaction request, and stores the interaction request or closes the service corresponding to the interaction request according to the type of the interaction request when the polling failure times are excessive. Because the interactive request is sent in the state that the current network is unobstructed, the response influence of external factors on the request caused by bandwidth or other network problems can be eliminated, and the follow-up timely remediation is facilitated. And by judging the response condition of the interaction request under the condition of smooth network, whether the operation condition of the server is normal can be detected, and the follow-up fault removal is facilitated. And under the condition that the polling failure times according to the interactive requests are excessive, the interactive requests are stored, so that the loss of request data can be avoided, data checking is facilitated under certain specific service scenes (such as payment services), and the occurrence rate of 'bad accounts' is reduced. By closing the service corresponding to the interactive request under the condition of excessive polling failure times, the more serious service avalanche effect can be avoided. Therefore, the loss of the application terminal caused by the problem of the service terminal can be reduced from multiple aspects, and the influence caused by the failure of the request response is reduced.
Optionally, when the number of polling failures reaches a preset number, the data interaction method may further include: sending an early warning prompt message to a preset user terminal according to the type of the interaction request; or when the current network is not in a smooth state, sending an early warning prompt message to a preset user terminal.
The channel for sending the warning prompt message includes, but is not limited to, mail notification, short message notification, message pushing of an instant messaging tool, and the like.
As an implementation manner, when the polling failure times reach the preset times, it may be determined whether the interactive request corresponding to the current polling request is a service request.
If the interaction request is a service request, it can be determined that a part of service processing of the server fails, and at this time, contact accounts of related service responsible persons configured in advance can be obtained according to the actual service request, and a service early warning prompt message is sent to user terminals corresponding to the contact accounts, so that a user can conveniently troubleshoot and process the failure according to the service early warning prompt message. The reason that the application end encounters a service request failure and the service request response failure is caused by a service end problem includes but is not limited to: code problems of the server, failure of the server to process partial transactions, overload of tasks of the server and the like.
If the interactive request is not a service request, for example, it is identified that the interactive request corresponding to the polling request is an agreed request for testing whether the service of the server is available, it may be determined that the server has an abnormal operation according to the polling condition. At this time, preset contact accounts (which may be accounts of operation and maintenance personnel and administrators) may be acquired, and a service early warning prompt message may be sent to the user terminals corresponding to the contact accounts, so that the user may perform subsequent processing according to the service early warning prompt message.
As another implementation manner, when it is determined that the current network is not in a smooth state, the application terminal may obtain pre-configured contact accounts of the network maintainer, and send a network early warning prompt message to the user terminals corresponding to the contact accounts.
Through the embodiment, for various influence factors which may cause response failure, the early warning prompt messages are respectively sent to the corresponding user terminals under different conditions according to different influence factors, so that fault processing can be performed in time according to the user, and the waiting time of the application terminal can be shortened.
Optionally, before sending the interaction request to the target device, a network testing phase is further included, and the data interaction method may further include S101-S102.
S101: and sending test data to the network address of the target equipment at regular time according to a preset time interval.
The skilled person can set the preset time interval according to actual needs, so as to set the time point for sending the test data, for example, the preset time interval may be 0.5 second, 1 second, 2 seconds, etc.
S102: and determining the current network state according to the response condition of the target equipment to the test data.
Wherein, S101-S102 determines the current network state by the application program periodically sending test data to the network address of the target device. Compared with a mode of manually configuring test data or temporarily calling a test script, the method has the advantages that the network smoothness of the server can be monitored through the application program, an abnormal reason is not searched after the network fails, and the abnormal network of the server can be known as soon as possible (compared with a mode of temporarily manually inquiring or temporarily calling the test script) when the network of the server fails, so that the application can timely shut down some services related to the server when the network of the server is abnormal.
As an implementation manner, the above S101 may include: at preset time intervals, test packets of specified bytes are sent to the network address of the target device through an Internet Packet explorer (ping) at regular time intervals. Accordingly, the S102 may include: when receiving a response data packet returned by the target device according to the test data packet, judging whether the byte number of the response data packet is the same as that of the test data packet or not; and when the byte number of the response data packet is the same as that of the test data packet, determining that the current network is in a smooth state.
In one example, the application may periodically ping the network address of the target device (the device where the server resides) to send a 32-byte test packet to the network address of the target device and wait for the target device to return a 32-byte packet (without knowing the specific content of the packet).
If the target device does not return the data packet or the bytes of the returned data packet are not 32 bytes, the current network of the target device is judged to be abnormal, namely the target device is not in a smooth network state currently, at the moment, the target device is not suitable for sending an interaction request to a server deployed on the target device, the interaction request access to the server is stopped in time, and the problem of more data is avoided. In specific implementation, after polling (ping), the input of the stream is instantiated and converted into a corresponding byte stream, and then the text of the byte stream is read, so as to judge whether the ping is successful. Actually, 32 bytes of data are sent to the network address of the target device where the server is located through the application program, and when the reply content of the 32 bytes of data returned by the target device where the server is located is detected, it is determined that the server is currently in a network unobstructed state.
Ping is a technology for detecting network connectivity and analyzing network speed. In the embodiment of the application, the network of the server is automatically monitored by regularly adopting the ping technology through an application program, and the first terminal where the application is located does not need to be manually configured to implement ping, so that the network condition of the server can be known in time.
Under the condition that the Ping is still failed for many times, the preset user terminal information can be obtained, and the early warning prompt message is sent to the preset user terminal.
As an optional implementation manner, when a service request failing to respond is stored in a message queue of the first terminal, the data interaction method may further include: and in response to the recovery operation for the service request, resending the service request stored in the message queue to the target device.
The message queue can store one or more service requests which are not responded by the server, and when the recovery operation of the service requests in the message queue is received, the specified service requests stored in the message queue are sent to the server on the target device again in response to the recovery operation. The specified service request may be a service request selected by the user or may be the first request in the queue.
In one example, when a system migration task is performed, if migration service requests corresponding to a part of data do not receive a correct response and the polling frequency reaches a preset frequency, the migration service requests are temporarily stored in a message queue. The user can perform recovery operation on part of migration service requests in the message queue when the request amount stored in the message queue reaches a certain condition (for example, when the queue is fast full), so as to resend the migration service requests to the server in an attempt manner, if the server can recover normal work at the moment, the migration service requests are normally executed, the originally interrupted service is continuously executed, and data corresponding to the part of requests can be normally migrated; if the retransmitted request still does not obtain correct response and the polling failure times reach the preset times, the part of the migration service request enters the message queue again or is stored into other storage spaces for processing by the user.
Through the implementation mode, the request data loss of the application end caused by the problem of the service end can be avoided, and the follow-up data verification is convenient to carry out in some application scenes (such as financial industry) with high sensitivity to data.
Optionally, the interactive request includes a contract request, and as a way of sending the contract request, the S11 may include S111-S113.
S111: when the current network is in a smooth state, obtaining an idle time length, wherein the idle time length represents the time length from the last time when data is sent to the target device to the current time.
The data sent to the target device last time may be the test data packet for monitoring the patency of the server network, an appointment request in the interaction request, a service request in the interaction request, or a polling request.
S112: and judging whether the idle time reaches a first time threshold value.
The first time threshold can be set by a person skilled in the art according to actual needs, for example, the first time threshold can be 2 seconds, 5 seconds, 8 seconds, and the like.
S113: and when the idle time reaches a first time threshold, sending the appointment request to a server on the target equipment.
In order to guarantee the service activity of the service end, when the idle time reaches a first time threshold, an appointment request is sent to the service end deployed on the target equipment, and the service end is waited to respond according to the appointment request.
Optionally, the appointment request may be a heartbeat request or a timing request, the heartbeat request is different from the timing request in that the object of the direct request is different, the appointment request is sent by the application terminal through an intermediate application program coordination service, and indirectly tests whether the service of the service terminal is available, while the timing request may be sent by the application terminal directly to the service terminal, and directly tests whether the service of the service terminal is available through a point-to-point transmission manner.
Whether the type of the appointment request is a heartbeat request or a timing request, during specific application, the application end can send a specific request parameter to send the appointment request, the service end returns the appointment data according to the appointment after receiving the appointment request, and the application end judges whether the service end is in a service available state currently or not according to the appointment data returned by the service end and determines whether the operation state of the service end is normal or not.
Accordingly, after sending the contract request to the server, the above-mentioned S12 may include sub-steps S121-S122.
S121: and judging whether the server on the target equipment returns the appointment data according to the appointment request in a specified time period or not.
The designated time period may be a time period agreed in advance between the application terminal and the service terminal.
The appointment data may be a return code and the appointment data may be represented as a number, a string, or a combination of both.
S122: when the server on the target device returns the appointment data according to the appointment request in the appointed time period, the server on the target device is determined to be capable of correctly responding to the appointment request, and therefore the server on the target device is determined to be in the service available state.
When the target equipment does not return the appointed data in the appointed time period or the returned data is not the appointed data, determining that the appointed data is not correctly corresponding currently, and initiating a polling request to the service terminal according to the appointed request. And when the polling failure times reach the preset times, determining that the application service of the server on the target equipment is unavailable, and the server is in a service unavailable state.
Accordingly, the above S14 may include: and when the polling failure times reach the preset times, closing the specified service of the first terminal according to the appointment request, wherein the specified service is the service corresponding to the appointment request.
When the application determines that the service end is in the service unavailable state, the first terminal may close the service corresponding to the appointment request and/or make a friendly prompt (for example, display that the current E service is temporarily unavailable, etc.) according to existing logic in the application program, and may also make a fusing process when determining that the service end is in the service unavailable state, so as to prevent an avalanche effect result caused by downtime of the application end due to a service end problem.
By the implementation mode, whether the application deployed by the server can normally operate or not can be further determined under the condition that the target device where the server is located is ensured to be in a smooth network, and an early warning prompt message is timely sent out when the application deployed by the server fails so as to inform related users to process the application. When the service end is determined to be in the service unavailable state, the corresponding service is processed in time at the application end, and the service avalanche effect is avoided.
In summary, in the above method, the application program regularly pings the target device where the server is located, so as to perform network monitoring on the target device where the server is deployed, quickly discriminate the current network condition of the target device where the server is located, and eliminate the probability of response failure due to factors such as network bandwidth. And by sending the appointed request in the interactive request to the server under the condition of unobstructed network, the server can interact with the server regularly, so that the current service running state of the server can be detected in time, when the unavailability of the service of the server is identified, the corresponding service of the application can be closed in time, and the service avalanche effect of the application caused by the problem of the server can be avoided. In addition, by sending the service request in the interactive request to the server under the condition of unobstructed network, when the service request response fails, the polling request can be used for re-requesting, so that the service shutdown of the application end due to temporary failure of the server is avoided, even if the polling failure times are excessive, the failed request can be temporarily stored in a message queue corresponding to the application end, the loss of the failed request data is avoided, and the interrupted service request can be sent to the server again for processing after the server returns to normal. And no matter which processing link is adopted, corresponding early warning prompt messages can be sent out in time when multiple times of sending fails (polling is carried out for multiple times and after the polling fails), and workers are informed to process the early warning prompt messages in time. The method is favorable for carrying out control in each link which is possibly problematic, saves the processing log and the original request parameters of the application end, and reduces the loss of unavailable application end service caused by the problem of the service end to the maximum extent.
Based on the same inventive concept, please refer to fig. 4, an embodiment of the present application further provides a data interaction apparatus 400, including: an interaction module 401, a judgment module 402, a polling module 403 and an execution module 404. The software functional module provided by the device can be packaged in a storage medium or packaged to be imported into some components.
The interaction module 401 is configured to send an interaction request to a server on the target device when the current network is in a smooth state.
A determining module 402, configured to determine whether the server on the target device responds correctly to the interaction request.
A polling module 403, configured to initiate a polling request to the server on the target device according to the interaction request when the server on the target device does not correctly respond to the interaction request.
And the executing module 404 is configured to store the interactive request according to the type of the interactive request or close a service corresponding to the interactive request when the polling failure times reach a preset number.
The device can execute the data interaction method, can reduce the response influence of external factors on the request caused by bandwidth or other network problems, can detect whether the running condition of the server is normal or not, is favorable for subsequent fault removal, and can reduce the loss of the application terminal caused by the problems of the server.
Optionally, the apparatus may further include an early warning prompt module, configured to send an early warning prompt message to a preset user terminal according to the type of the interaction request when the number of polling failures reaches a preset number; or when the current network is not in a smooth state, sending an early warning prompt message to a preset user terminal.
Optionally, the apparatus may further include a network monitoring module, configured to send test data to the network address of the target device at regular time according to a preset time interval; and determining the current network state according to the response condition of the target equipment to the test data.
Optionally, the network monitoring module may be further configured to send a test data packet of a specified byte to the network address of the target device at regular time through the internet packet finder according to a preset time interval; when receiving a response data packet returned by the target device according to the test data packet, judging whether the byte number of the response data packet is the same as that of the test data packet or not; and when the byte number of the response data packet is the same as that of the test data packet, determining that the current network is in a smooth state.
Optionally, the executing module 404 may be further configured to store the service request in the message queue when the polling failure number reaches a preset number.
Optionally, the execution module 404 is further configured to resend the service request stored in the message queue to the target device in response to the recovery operation for the service request.
Optionally, the interaction module 401 may be further configured to, when the current network is in a clear state, obtain an idle duration, where the idle duration represents a time length from the last time when data is sent to the target device to the current time; judging whether the idle time reaches a first time threshold value or not; and when the idle time reaches a first time threshold, sending the appointment request to a server on the target equipment.
Optionally, the determining module 402 may be further configured to determine whether the server on the target device returns the appointment data according to the appointment request within a specified time period; when the server on the target equipment returns the appointment data according to the appointment request in the appointed time period, the server on the target equipment is determined to correctly respond to the appointment request, and therefore the server on the target equipment is determined to be in the service available state.
Optionally, the executing module 404 may be further configured to close a specified service of the first terminal according to the appointment request when the polling failure times reach a preset number, where the specified service is a service corresponding to the appointment request.
For other details of the data interaction apparatus 400 provided in the embodiment of the present application, please further refer to the related description in the foregoing data interaction method, which is not repeated herein.
In addition to the above embodiments, the present application also provides a storage medium, on which a computer program is stored, and the computer program is executed by a processor to execute the foregoing data interaction method. The storage medium may include: a removable hard disk, a memory, a magnetic or optical disk, or other various media capable of storing program code.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the unit is only a logical division, and other divisions may be realized in practice.
In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
Furthermore, the functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The above embodiments are merely examples of the present application and are not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (10)

1. A data interaction method is applied to a first terminal, and the method comprises the following steps:
when the current network is in a smooth state, sending an interaction request to a server on the target equipment;
judging whether the server on the target equipment correctly responds to the interaction request;
when the server on the target equipment does not correctly respond to the interaction request, initiating a polling request to the server on the target equipment according to the interaction request;
and when the polling failure times reach preset times, storing the interactive request according to the type of the interactive request or closing the service corresponding to the interactive request.
2. The method of claim 1, further comprising:
when the polling failure times reach preset times, sending an early warning prompt message to a preset user terminal according to the type of the interaction request;
or when the current network is not in a smooth state, sending an early warning prompt message to a preset user terminal.
3. The method of claim 1, wherein prior to sending the interaction request to the server on the target device, the method further comprises:
sending test data to the network address of the target equipment at regular time according to a preset time interval;
and determining the current network state according to the response condition of the target equipment to the test data.
4. The method of claim 3, wherein the timing the sending of the test data to the network address of the target device at the preset time interval comprises:
regularly sending a test data packet with specified bytes to a network address of the target equipment through an Internet packet explorer according to a preset time interval;
the determining the current network state according to the response condition of the target device to the test data includes:
when a response data packet returned by the target equipment according to the test data packet is received, judging whether the byte number of the response data packet is the same as that of the test data packet or not;
and when the byte number of the response data packet is the same as that of the test data packet, determining that the current network is in a smooth state.
5. The method of claim 1, wherein the interactive request comprises a service request, and the storing the interactive request or closing a service corresponding to the interactive request according to the type of the interactive request when the polling failure times reach a preset number of times comprises:
and when the polling failure times reach preset times, storing the service request in a message queue.
6. The method of claim 5, further comprising:
and in response to the recovery operation of the service request, resending the service request stored in the message queue to the target device.
7. The method of claim 1, wherein the interactive request comprises an appointment request, and the sending the interactive request to a server on a target device when a current network is in a clear state comprises:
when the current network is in a smooth state, acquiring an idle time length, wherein the idle time length represents the time length from the last time when data is sent to the target equipment to the current time;
judging whether the idle time reaches a first time threshold value or not;
and when the idle time reaches a first time threshold, sending the appointment request to a server on the target equipment.
8. The method of claim 7, wherein the determining whether the server on the target device correctly responds to the interactive request comprises:
judging whether a server on the target equipment returns appointed data according to the appointed request within an appointed time period or not;
when the server on the target equipment returns the appointment data according to the appointment request in the appointed time period, the server on the target equipment is determined to correctly respond to the appointment request, and therefore the server on the target equipment is determined to be in the service available state.
9. The method according to claim 7, wherein the storing the interactive request or closing the service corresponding to the interactive request according to the type of the interactive request when the polling failure times reach a preset number of times comprises:
and when the polling failure times reach the preset times, closing the specified service of the first terminal according to the appointment request, wherein the specified service is the service corresponding to the appointment request.
10. An electronic device, characterized in that the electronic device comprises:
a memory;
a processor;
the memory stores a computer program executable by the processor, the computer program, when executed by the processor, performing the method of any of claims 1-9.
CN202010009122.2A 2020-01-03 2020-01-03 Data interaction method and electronic equipment Pending CN111176866A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010009122.2A CN111176866A (en) 2020-01-03 2020-01-03 Data interaction method and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010009122.2A CN111176866A (en) 2020-01-03 2020-01-03 Data interaction method and electronic equipment

Publications (1)

Publication Number Publication Date
CN111176866A true CN111176866A (en) 2020-05-19

Family

ID=70649206

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010009122.2A Pending CN111176866A (en) 2020-01-03 2020-01-03 Data interaction method and electronic equipment

Country Status (1)

Country Link
CN (1) CN111176866A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111914149A (en) * 2020-05-21 2020-11-10 北京大米科技有限公司 Request processing method and device, storage medium and electronic equipment
CN112104884A (en) * 2020-08-31 2020-12-18 广州华多网络科技有限公司 Message pushing method and device and electronic equipment
CN112667439A (en) * 2020-12-26 2021-04-16 北京奇艺世纪科技有限公司 Data processing method and device and electronic equipment
CN115118575A (en) * 2022-06-23 2022-09-27 奇安信科技集团股份有限公司 Monitoring method, monitoring device, electronic equipment and storage medium
WO2023273576A1 (en) * 2021-06-30 2023-01-05 北京字节跳动网络技术有限公司 Abnormal request processing method and apparatus, electronic device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105847178A (en) * 2016-03-21 2016-08-10 珠海迈科智能科技股份有限公司 Network data request method and system for application program
US20170353609A1 (en) * 2016-06-03 2017-12-07 Verizon Patent And Licensing Inc. Network switching detection for toll-free data service provision
CN109245935A (en) * 2018-09-27 2019-01-18 福建天泉教育科技有限公司 A kind of processing method and terminal of message queue exception
CN110034857A (en) * 2019-04-17 2019-07-19 广东三维家信息科技有限公司 Request the method, apparatus sent and electronic equipment
CN110391880A (en) * 2019-08-23 2019-10-29 聚好看科技股份有限公司 Access request processing method and equipment based on terminal-server framework

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105847178A (en) * 2016-03-21 2016-08-10 珠海迈科智能科技股份有限公司 Network data request method and system for application program
US20170353609A1 (en) * 2016-06-03 2017-12-07 Verizon Patent And Licensing Inc. Network switching detection for toll-free data service provision
CN109245935A (en) * 2018-09-27 2019-01-18 福建天泉教育科技有限公司 A kind of processing method and terminal of message queue exception
CN110034857A (en) * 2019-04-17 2019-07-19 广东三维家信息科技有限公司 Request the method, apparatus sent and electronic equipment
CN110391880A (en) * 2019-08-23 2019-10-29 聚好看科技股份有限公司 Access request processing method and equipment based on terminal-server framework

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
顾淑清,夏京星: "《大学计算机应用基础》", vol. 2, 北京邮电学院出版社, pages: 257 *
顾淑清: "《大学计算机应用基础(第2版)》", 31 August 2012, 北京邮电大学出版社 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111914149A (en) * 2020-05-21 2020-11-10 北京大米科技有限公司 Request processing method and device, storage medium and electronic equipment
CN112104884A (en) * 2020-08-31 2020-12-18 广州华多网络科技有限公司 Message pushing method and device and electronic equipment
CN112667439A (en) * 2020-12-26 2021-04-16 北京奇艺世纪科技有限公司 Data processing method and device and electronic equipment
WO2023273576A1 (en) * 2021-06-30 2023-01-05 北京字节跳动网络技术有限公司 Abnormal request processing method and apparatus, electronic device and storage medium
CN115118575A (en) * 2022-06-23 2022-09-27 奇安信科技集团股份有限公司 Monitoring method, monitoring device, electronic equipment and storage medium
CN115118575B (en) * 2022-06-23 2024-05-03 奇安信科技集团股份有限公司 Monitoring method, monitoring device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111176866A (en) Data interaction method and electronic equipment
WO2021008031A1 (en) Processing method for implementing monitoring intellectualization on the basis of micro-services, and electronic device
CN108400904B (en) Health examination method and device based on micro-service architecture
TW201944236A (en) Task processing method, apparatus, and system
CN106533805B (en) Micro-service request processing method, micro-service controller and micro-service architecture
US20050204214A1 (en) Distributed montoring in a telecommunications system
CN106973093A (en) A kind of service switch method and device
JP2001520777A (en) Interface for interfacing a client program to a network device in a telecommunications network
US11537336B2 (en) Resource service system, control method, and storage medium
CN111078453A (en) Method and device for automatically fusing and recovering micro-service, computer equipment and storage medium
CN109101371B (en) Disaster recovery switching method and device
WO2023083079A1 (en) System, method and apparatus for monitoring third-party system, and device and storage medium
JP2013222313A (en) Failure contact efficiency system
US10599505B1 (en) Event handling system with escalation suppression
CN103731315A (en) Server failure detecting method
WO2019049433A1 (en) Cluster system, cluster system control method, server device, control method, and non-transitory computer-readable medium having program stored therein
EP3252995B1 (en) Method for detecting network failures
CN112953769B (en) Data transmission method, device, computer system and readable storage medium
US11223578B2 (en) System and control method to direct transmission of event data to one of a plurality of reception queues
CN114666390A (en) Page monitoring method and device of application program, electronic equipment and storage medium
CN112835780A (en) Service detection method and device
CN114826886B (en) Disaster recovery method and device for application software and electronic equipment
KR100434010B1 (en) How to handle message overload in mobile communication system
CN111200573B (en) RPC request calling method and device
KR20170127876A (en) System and method for dealing with troubles through fault analysis of log

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
TA01 Transfer of patent application right

Effective date of registration: 20201225

Address after: A108, 1st floor, curling hall, winter training center, 68 Shijingshan Road, Shijingshan District, Beijing

Applicant after: Beijing second hand Artificial Intelligence Technology Co.,Ltd.

Address before: Room 9014, 9 / F, building 3, yard 30, Shixing street, Shijingshan District, Beijing

Applicant before: ADMASTER TECHNOLOGY (BEIJING) Co.,Ltd.

TA01 Transfer of patent application right