CN113761054A - Data calling method and device, electronic equipment and storage medium - Google Patents

Data calling method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113761054A
CN113761054A CN202110090472.0A CN202110090472A CN113761054A CN 113761054 A CN113761054 A CN 113761054A CN 202110090472 A CN202110090472 A CN 202110090472A CN 113761054 A CN113761054 A CN 113761054A
Authority
CN
China
Prior art keywords
data
feedback data
target
server
acquisition request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110090472.0A
Other languages
Chinese (zh)
Inventor
张欣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun 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 Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202110090472.0A priority Critical patent/CN113761054A/en
Publication of CN113761054A publication Critical patent/CN113761054A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • 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/544Buffers; Shared memory; Pipes

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a data calling method, a data calling device, electronic equipment and a storage medium, wherein the method comprises the following steps: when detecting that a server is in an abnormal state and receiving a target data acquisition request initiated by a client, determining a target request identifier of the target data acquisition request; target feedback data corresponding to the target request identification is called from a distributed database, and the target feedback data is fed back to a client; the data stored in the distributed database is feedback data fed back when the server normally works and receives a data acquisition request. According to the technical scheme of the embodiment of the invention, when the server is abnormal and receives the data acquisition request sent by the client, the target feedback data corresponding to the data acquisition request can be determined from the database and fed back to the client.

Description

Data calling method and device, electronic equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a data calling method and device, electronic equipment and a storage medium.
Background
HTML5 introduced Application caching (Application Cache) technology, the introduction of which indicates that web applications can Cache, but only part of static resources such as picture resources can be stored into a configuration file, i.e. into a Cache manifest file.
When the present invention is implemented based on the above-described embodiments, the inventors have found that the following problems occur:
because most of the Cache of the Application Cache is static resources, when a certain page needs to be loaded, corresponding data cannot be obtained from the cached data, and most of the cached data is stored in a server memory. When the server is abnormal and a request initiated by the client is received, the problem that corresponding data cannot be fed back exists.
Disclosure of Invention
The invention provides a data calling method, a data calling device, electronic equipment and a storage medium, which can be used for calling feedback data corresponding to a data acquisition request from a database when a server is abnormal, so that the technical effect of user experience is improved.
In a first aspect, an embodiment of the present invention provides a data retrieving method, where the method includes:
when detecting that a server is in an abnormal state and receiving a target data acquisition request initiated by a client, determining a target request identifier of the target data acquisition request;
target feedback data corresponding to the target request identification is called from a distributed database, and the target feedback data is fed back to a client;
the data stored in the distributed database is feedback data fed back when the server normally works and receives a data acquisition request.
In a second aspect, an embodiment of the present invention further provides a data caching method, where the method includes:
receiving target feedback data fed back by a server; the target feedback data corresponds to a data acquisition request initiated by a client;
and feeding back the target feedback data to the client, and storing the target feedback data in a distributed database, so as to retrieve feedback data matched with the data acquisition request from the distributed database when the server is detected to be abnormal and the data acquisition request initiated by the client is received.
In a third aspect, an embodiment of the present invention further provides a data retrieving apparatus, where the apparatus includes:
the target request identification determining module is used for determining a target request identification of a target data acquisition request when the server is detected to be in an abnormal state and the target data acquisition request initiated by a client is received;
the data feedback module is used for calling target feedback data corresponding to the target request identification from a distributed database and feeding the target feedback data back to the client;
and the distributed database stores feedback data which are fed back by the server and correspond to the data acquisition requests.
In a fourth aspect, an embodiment of the present invention further provides a data retrieving apparatus, where the apparatus includes:
the data receiving module is used for receiving target feedback data fed back by the server; the target feedback data corresponds to a data acquisition request initiated by a client;
and the data storage module is used for feeding the target feedback data back to the client and storing the target feedback data into the distributed database so as to call the feedback data matched with the data acquisition request from the distributed database when the server is detected to be abnormal and the data acquisition request initiated by the client is received.
In a fifth aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the data caching method and/or the data retrieval method according to any one of the embodiments of the present invention.
In a sixth aspect, the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform the data caching method and/or the data retrieval method according to any one of the embodiments of the present invention.
According to the technical scheme of the embodiment of the invention, when the server normally works and receives the data corresponding to the data acquisition request sent by the client, the data can be stored in the database, so that when the server abnormally receives the data acquisition request, the target feedback data matched with the data acquisition request can be called from the database, and the target feedback data is sent to the client.
Drawings
In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, a brief description is given below of the drawings used in describing the embodiments. It should be clear that the described figures are only views of some of the embodiments of the invention to be described, not all, and that for a person skilled in the art, other figures can be derived from these figures without inventive effort.
Fig. 1 is a schematic flow chart illustrating a data retrieving method according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of server anomaly detection according to an embodiment of the present invention;
fig. 3 is a schematic flow chart illustrating a data caching method according to a second embodiment of the present invention;
fig. 4 is a schematic diagram of a data caching method according to a second embodiment of the present invention;
fig. 5 is a schematic diagram of a data caching/retrieving method according to a third embodiment of the present invention;
fig. 6 is a schematic structural diagram of a data retrieving device according to a fourth embodiment of the present invention;
fig. 7 is a schematic structural diagram of a data caching apparatus according to a fifth embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device according to a sixth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a schematic flow chart of a data retrieving method according to an embodiment of the present invention, which is applicable to a situation that feedback data corresponding to a data obtaining request can be obtained from a database when a server is abnormal and receives the data obtaining request sent by a client.
Before the technical solution of the present embodiment is introduced, an application scenario may be exemplarily described. An intermediate agent layer service worker exists between the Web front end and the server. The service worker is used for receiving a data acquisition request sent by the client and sending the data acquisition request to the server. Correspondingly, when the server feeds back the feedback data corresponding to the data acquisition request, the service worker can receive the feedback data and send the feedback data to the client. The embodiment may be based on a service worker to perform the following method.
As shown in fig. 1, the method of this embodiment includes:
s110, when the server is detected to be in an abnormal state and a target data acquisition request initiated by the client is received, determining a target request identifier of the target data acquisition request.
The server abnormal state may be a state in which the server is down or the server does not work. The user can display any one control on the interface at the client, and when the triggered control needs to feed back corresponding data, the request generated by the triggered control can be used as a target data acquisition request. Each target data acquisition request may include a corresponding target request identifier, and when a data acquisition request is received, a request identifier in the data acquisition request may be extracted, which is used as a target request identifier.
Specifically, when it is detected that the server is in an abnormal state and receives a target data acquisition request sent by the client, a target request identifier in the target data acquisition request may be determined.
In this embodiment, the detecting that the server is in the abnormal state includes: sending heartbeat packets to a server at regular time; and if the response data corresponding to the heartbeat packet is not received within the preset time length, determining that the server is in an abnormal state.
The service worker can send the heartbeat packet to the server at regular time. The timing may be periodic, and optionally, as a period every ten seconds, a heartbeat packet may be sent to the server every ten seconds. Feedback data corresponding to the heartbeat packet is taken as response data. The preset time length can be five seconds, ten seconds, twenty seconds and the like, and the user can set the preset time length according to actual requirements.
Specifically, the service worker may send a heartbeat packet to the server every ten seconds, and when response data corresponding to the heartbeat packet is not received within twenty seconds, it is determined that the server is in an abnormal state.
S120, target feedback data corresponding to the target request identification is called from a distributed database, and the target feedback data is fed back to the client.
And when the server works normally, the data stored in the distributed database receives feedback data corresponding to the data acquisition request. That is, when the client initiates a data acquisition request, the data stored in the distributed database may be the data corresponding to the data acquisition request fed back by the server, which is fed back to the client and stored in the distributed database.
Specifically, since the server is in an abnormal state, when receiving a data acquisition request sent by the client, the server cannot process the data acquisition request, and at this time, it may be determined whether the distributed database includes target feedback data corresponding to the target request identifier according to the target request identifier of the data acquisition request, and send the target feedback data to the client.
According to the technical scheme of the embodiment of the invention, when the server normally works and receives the data corresponding to the data acquisition request sent by the client, the data can be stored in the database, so that when the server abnormally receives the data acquisition request, the target feedback data matched with the data acquisition request can be called from the database, and the target feedback data is sent to the client.
On the basis of the technical scheme, the method further comprises the following steps: monitoring the current state of the server based on a timing task, and if the current state is recovered to a normal state from the abnormal state, sending a data acquisition request to the server when receiving the data acquisition request so as to enable the server to feed back target feedback data corresponding to the data acquisition request.
It should be noted that, when it is detected that the server is in the abnormal state, the heartbeat packet may be continuously sent to determine whether the server is recovered from the abnormal state to the normal state.
The timing task may be a task set when the server is in an abnormal state. Heartbeat packets may be sent to the server based on the timing task. The time in the timed task may be set to send a heartbeat packet to the server every sixty seconds. The current state may be that the server is in an abnormal state or is restored to a normal state. The current state may be determined according to whether the server feeds back response data corresponding to the heartbeat packet.
Specifically, the heartbeat detection service may be continued, and optionally, the interface detection service timing task is triggered, and the server is detected every 60S to determine whether the server recovers to a normal server in the current time interval. If the normal service is not recovered, the method provided in this embodiment may still be used to determine the feedback data corresponding to the data acquisition request.
As an optional embodiment of the foregoing embodiment, the heartbeat detection service is built through a service worker, and mainly aims to detect whether a request interface normally works and provide a trusted request scheme, where a specific flow may be as follows: referring to fig. 2, if the front end initiates a request service, the heartbeat detection service is automatically started to detect a service cluster currently providing the service. And determining that the server is in an abnormal working state based on the heartbeat detection service, and then transferring to the bottom-of-pocket service, namely determining feedback data corresponding to the data acquisition request from the distributed database. Meanwhile, the heartbeat detection service can be continued, the interface detection service timing task is triggered, the server is detected once every 60 seconds to determine whether the server recovers the normal service at the current time interval, and if not, the corresponding feedback data is continuously acquired from the distributed database.
Example two
Fig. 3 is a schematic flow chart of a data caching method according to a second embodiment of the present invention, where this embodiment is applicable to storing feedback data corresponding to a data acquisition request, which is fed back by a server, in a distributed database, so that when an abnormality of the server is detected, corresponding target feedback data can be acquired from the distributed database.
Before the technical solution of the present embodiment is introduced, an application scenario may be exemplarily described. An intermediate agent layer service worker exists between the Web front end and the server. The service worker is used for receiving a data acquisition request sent by the client and sending the data acquisition request to the server. Correspondingly, when the server feeds back the feedback data corresponding to the data acquisition request, the service worker can receive the feedback data and send the feedback data to the client. The embodiment may be a method executed based on a service worker, for example, when a server normally works, data fed back by the server may be stored in a distributed database, so that when it is detected that the server is in an abnormal state and a data acquisition request is received, feedback data corresponding to the data acquisition request is retrieved from the distributed database.
As shown in fig. 3, the method of this embodiment includes:
and S310, receiving target feedback data fed back by the server.
It should be noted that the present embodiment is mainly applicable to a state where the server is in normal operation.
After the service worker receives the data acquisition request and sends the data acquisition request to the server, the server can determine feedback data corresponding to the data acquisition request and feed the feedback data back to the service worker. The target feedback data is data matched with the data acquisition request and fed back by the server.
Specifically, when the server feeds back the feedback data corresponding to the data acquisition request, the service worker may receive the feedback data, and use the feedback data as the target feedback data.
And S320, feeding back the target feedback data to the client, and storing the target feedback data in the distributed database, so that when the server is detected to be abnormal and a data acquisition request initiated by the client is received, the feedback data matched with the data acquisition request is called from the distributed database.
It should be noted that, after receiving the target feedback data, the service worker may feed the target data back to the client, so that the client reconstructs a page or a picture and the like according to the received feedback data. Meanwhile, the service worker can also store target feedback data into the distributed database, so that when the server is detected to be abnormal and a data acquisition request initiated by the client is received, feedback data matched with the request can be acquired from the distributed database.
Specifically, when receiving target feedback data matched with the data acquisition request fed back by the server, the service worker may feed back the target feedback data to the client and store the target feedback data in the distributed database.
According to the technical scheme of the embodiment of the invention, when the target feedback data fed back by the server is received, the target feedback data can be fed back to the client, and the target feedback data is stored in the distributed database, so that when the server is detected to be abnormal and the data fed back by the client is received, the corresponding target feedback data can be called from the distributed database and fed back, the problem that in the prior art, when the server is abnormal, the corresponding data cannot be obtained, and therefore, a page cannot be reconstructed is solved, the feedback data corresponding to the data acquisition request can still be received when the server is abnormal, and the technical effect of user experience is improved.
On the basis of the above technical solution, storing the target feedback data in the distributed database may be: and based on a preset monitoring plug-in, when the difference between the target feedback data and the historical target feedback data is determined, storing the target feedback data into the distributed database.
The monitoring plug-in can be a reduce plug-in the web application, the reduce plug-in is relatively quick to manage the data state, and the data can be monitored through the reduce midleware in the off-line data generation. The target feedback data may be feedback data corresponding to the data acquisition request of this time. And taking the data fed back by the server before the current time and stored in the database as historical feedback data.
In this embodiment, the historical target feedback data may be data that is matched with the current data acquisition request fed back by the server before the current time and is stored in the distributed database.
Specifically, based on a preset monitoring plug-in, whether a difference exists between target feedback data and historical target feedback data or not can be determined, if yes, the target feedback data can be updated into the distributed database according to the timestamp of the feedback data, and the historical target feedback data can be deleted from the distributed database, so that the problem of resource redundancy in the distributed database is solved.
In this embodiment, the target feedback data is stored in the distributed database, and the following may also be: and when the distributed database is determined to contain the feedback data to be updated matched with the data acquisition request based on a preset monitoring plug-in, processing the feedback data to be updated and the target feedback data based on a preset data processing strategy, and determining the feedback data stored in the distributed database.
The target feedback data corresponding to the target data identifier of the data acquisition request may be used as the feedback data to be updated. Through the reduce plug-in, a data synchronization manager can be generated, and the data synchronization manager can register data changes and then manage the data. A policy for managing data may be used as a data processing policy.
Specifically, when the service worker receives feedback data matched with the data acquisition request fed back by the server, the feedback data to be updated matched with the data acquisition request can be determined through a data processing strategy set in a data synchronization manager in the reduce plugin, and the feedback data to be updated and the target feedback data are processed according to the feedback data to be updated and the target feedback data, so that the feedback data stored in the distributed database are determined.
In this embodiment, the processing the feedback data to be updated and the target feedback data based on a preset management policy to determine the feedback data stored in the distributed database includes: when detecting that the data volume corresponding to the feedback data to be updated is larger than the data volume corresponding to the target feedback data, taking the feedback data to be updated as the feedback data stored in the distributed database; or determining the timestamps corresponding to the feedback data to be updated and the target feedback data, and taking the data corresponding to the timestamp closest to the current moment as the feedback data stored in the distributed database.
The feedback data to be updated and the target feedback data are data fed back based on the same data acquisition request identifier. The data amount may be the size of the memory occupied by the feedback data to be updated and the target feedback data. Generally, for the same data acquisition request identification, the larger the data amount, the more complete the data content. The feedback data with a large data volume may be used as the target feedback data, that is, the data processing policy may be to update data according to the data volume. The timestamp may be a timestamp corresponding to the data acquisition request identifier, and target feedback data fed back by the data acquisition request closest to the current time may be used as feedback data stored in the distributed database according to the timestamp.
Specifically, the feedback data amount to be updated corresponding to the same data acquisition request identifier and the data amount of the target feedback data may be respectively determined, the data synchronization manager may determine the feedback data according to the data amount, and may use the feedback data corresponding to the maximum data amount as the feedback data stored in the distributed database. Of course, the timestamps of the feedback data to be updated and the target feedback data corresponding to the same data acquisition request identifier may also be used, and the feedback data corresponding to the timestamp closest to the current time may be stored in the distributed database.
Based on the manner, when the feedback data is stored in the distributed database, the feedback data can be refined, so that the problem that the data stored in the distributed database has redundancy is solved.
In this embodiment, storing the target feedback data in the distributed database includes: and performing data serialization on the target feedback data and storing the target feedback data in the distributed database.
Specifically, the data may be serialized into the distributed database, and when the next time the page is entered, the data may be restored into the store from the distributed database preferentially. And when the change of the data of the store is monitored, automatically acquiring a data updating view. The advantages of this approach are: only the middleware of the data interface channel needing caching, namely the plugin of the reduce, needs to be configured, and the technical effect of simply, automatically and conveniently generating the offline data is achieved.
As an alternative to the above embodiment, referring to fig. 4, the step of storing the feedback data in the distributed database may be: when the service worker receives the target feedback data corresponding to the data acquisition request fed back by the server, the target feedback data can be fed back to the client. Meanwhile, target feedback data can be intercepted through midleware in a reduce plug-in unit arranged in the service worker, changes are registered based on a data synchronization manager generated by the reduce middleware, and data diff processing is carried out to determine whether the target feedback data can be stored in a distributed database. If the feedback data can be stored in the distributed database, the feedback data can be serialized, that is, state data serialization, and the serialized data is stored in the distributed database.
EXAMPLE III
As an alternative embodiment of the foregoing embodiment, fig. 5 is a schematic flow chart of data retrieval and/or caching according to a third embodiment of the present invention.
And S510, the front end initiates a data acquisition request.
The front end can be understood as a web front end, and can also be understood as a certain created page. The user can trigger any one control on the page, and the data acquisition request generated based on the triggered control can be used as the data acquisition request initiated by the front end.
S520, judging whether the server is abnormal or not, if so, executing S530; if not, go to S540.
Specifically, it is determined whether the server is in an abnormal state based on the heartbeat detection service, optionally, a heartbeat packet is sent to the server every ten seconds, and when response data corresponding to the heartbeat packet is received, it is determined that the server is in a normal state, otherwise, it is determined that the server is in an abnormal state.
And S530, retrieving the data matched with the data acquisition request from the database.
At this time, a distributed database may be provided, optionally, the IndexDB bottom-of-pocket service provides front-end request data, and reads refined offline data in the IndexDB bottom-of-pocket service in a similar way for each data acquisition request.
It should be noted that the data acquisition request may be stored in a queue of the timing task, so that when it is detected that the server is normal, the server may feed back target feedback data corresponding to the request acquisition data according to the data acquisition request stored in the queue.
And S540, receiving target feedback data corresponding to the data acquisition request fed back by the server, and storing the target feedback data into a distributed database.
Specifically, the service worker may receive target feedback data corresponding to the data acquisition request, which is fed back by the server. If the reduced middleware in the service worker monitors that the distributed database does not contain the target feedback data, the target feedback data can be finely processed and written into the distributed database, and corresponding feedback data are provided for the next time when the request is abnormal. If the reduce middleware monitors that the distributed database comprises the target feedback data, a data synchronization manager can be generated through the reduce middleware to register the change, and then diff (data processing) management is performed. Optionally, comparing whether target feedback data fed back by the current data acquisition request is consistent with data returned by the previous request, if so, updating is not needed; if the two data types are inconsistent, the feedback data meeting the requirement, such as the data amount fed back according to the same data acquisition request or the timestamp of the feedback data of the same data acquisition request, needs to be cached according to the update logic set by diff management.
According to the technical scheme of the embodiment of the invention, the response bottom-in-pocket service can be provided when the server is down or the response market is long, so that the coupling degree of the front end and the back end is reduced, and further, only an updating process is set in the bottom-in-pocket service, the problem that the web application cannot work if the environment or no environment is provided is solved, and the technical effect of user experience is improved.
EXAMPLE six
Fig. 6 is a schematic structural diagram of a data caching apparatus according to a sixth embodiment of the present invention, where the apparatus may be implemented based on a service worker (an intermediate layer between a front-end application and a server). The data caching device comprises: a target request identification determination module 610 and a data feedback module 620.
The target request identifier determining module 610 is configured to determine a target request identifier of a target data obtaining request when detecting that a server is in an abnormal state and receiving the target data obtaining request initiated by a client; a data feedback module 620, configured to retrieve target feedback data corresponding to the target request identifier from a distributed database, and feed back the target feedback data to a client; and the distributed database stores feedback data which are fed back by the server and correspond to the data acquisition requests.
On the basis of the foregoing technical solutions, the target request identifier determining module is further configured to:
sending heartbeat packets to a server at regular time; and if the response data corresponding to the heartbeat packet is not received within the preset time length, determining that the server is in an abnormal state.
On the basis of the above technical solutions, the apparatus further includes: a monitoring module to: monitoring the current state of the server based on a timing task, and if the current state is recovered to a normal state from the abnormal state, sending a data acquisition request to the server when receiving the data acquisition request so as to enable the server to feed back target feedback data corresponding to the data acquisition request.
According to the technical scheme of the embodiment of the invention, when the server normally works and receives the data corresponding to the data acquisition request sent by the client, the data can be stored in the database, so that when the server abnormally receives the data acquisition request, the target feedback data matched with the data acquisition request can be called from the database, and the target feedback data is sent to the client.
The data calling device provided by the embodiment of the invention can execute the data calling method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
It should be noted that, the units and modules included in the apparatus are merely divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the embodiment of the invention.
EXAMPLE seven
Fig. 7 is a schematic structural diagram of a data caching apparatus according to a fifth embodiment of the present invention, where the apparatus includes: a data receiving module 710 and a data storing module 720.
The data receiving module 710 is configured to receive target feedback data fed back by the server; the target feedback data corresponds to a data acquisition request initiated by a client; and the data storage module 720 is configured to feed back the target feedback data to the client, and store the target feedback data in the distributed database, so that when the server is detected to be abnormal and a data acquisition request initiated by the client is received, feedback data matched with the data acquisition request is called from the distributed database.
On the basis of the above technical solutions, the apparatus further includes: the data storage module is further configured to: and based on a preset monitoring plug-in, when the difference between the target feedback data and the historical target feedback data is determined, storing the target feedback data into the distributed database.
On the basis of the above technical solutions, the apparatus further includes: the data storage module is further configured to: and when the distributed database is determined to contain the feedback data to be updated matched with the data acquisition request based on a preset monitoring plug-in, processing the feedback data to be updated and the target feedback data based on a preset data processing strategy, and determining the feedback data stored in the distributed database.
On the basis of the above technical solutions, the apparatus further includes: the data storage module is further configured to: when detecting that the data volume corresponding to the feedback data to be updated is larger than the data volume corresponding to the target feedback data, taking the feedback data to be updated as the feedback data stored in the distributed database; or determining the timestamps corresponding to the feedback data to be updated and the target feedback data, and taking the data corresponding to the timestamp closest to the current moment as the feedback data stored in the distributed database.
On the basis of the above technical solutions, the apparatus further includes: the data storage module is further configured to: and performing data serialization on the target feedback data and storing the target feedback data in the distributed database.
According to the technical scheme of the embodiment of the invention, when the target feedback data fed back by the server is received, the target feedback data can be fed back to the client, and the target feedback data is stored in the distributed database, so that when the server is detected to be abnormal and the data fed back by the client is received, the corresponding target feedback data can be called from the distributed database and fed back, the problem that in the prior art, when the server is abnormal, the corresponding data cannot be obtained, and therefore, a page cannot be reconstructed is solved, the feedback data corresponding to the data acquisition request can still be received when the server is abnormal, and the technical effect of user experience is improved.
The data caching device provided by the embodiment of the invention can execute the data caching method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
It should be noted that, the units and modules included in the apparatus are merely divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the embodiment of the invention.
EXAMPLE six
Fig. 8 is a schematic structural diagram of an electronic device according to a sixth embodiment of the present invention. FIG. 8 illustrates a block diagram of an exemplary device 80 suitable for use in implementing embodiments of the present invention. The device 80 shown in fig. 8 is only an example and should not bring any limitation to the function and scope of use of the embodiments of the present invention.
As shown in FIG. 8, device 80 is embodied in a general purpose computing device. The components of the device 80 may include, but are not limited to: one or more processors or processing units 801, a system memory 802, and a bus 803 that couples various system components including the system memory 802 and the processing unit 801.
Bus 803 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Device 80 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by device 80 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 802 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)804 and/or cache memory 805. The device 80 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 806 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 8, and commonly referred to as a "hard drive"). Although not shown in FIG. 8, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 803 by one or more data media interfaces. Memory 802 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 808 having a set (at least one) of program modules 807 may be stored, for instance, in memory 802, such program modules 807 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may include an implementation of a network environment. Program modules 807 generally perform the functions and/or methodologies of embodiments of the present invention as described herein.
Device 80 may also communicate with one or more external devices 809 (e.g., keyboard, pointing device, display 810, etc.), with one or more devices that enable a user to interact with device 80, and/or with any devices (e.g., network card, modem, etc.) that enable device 80 to communicate with one or more other computing devices. Such communication may occur via an input/output (I/O) interface 811. Also, the device 80 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet) via the network adapter 812. As shown, the network adapter 812 communicates with the other modules of the device 80 via the bus 803. It should be appreciated that although not shown in FIG. 8, other hardware and/or software modules may be used in conjunction with device 80, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 801 executes various functional applications and data processing, for example, implementing a data retrieving method and/or a data caching method provided by an embodiment of the present invention, by running a program stored in the system memory 802.
EXAMPLE five
The fifth embodiment of the present invention further provides a storage medium containing computer-executable instructions, which are used for executing the data retrieval method and/or the data caching method when executed by a computer processor.
The data calling method comprises the following steps:
when detecting that a server is in an abnormal state and receiving a target data acquisition request initiated by a client, determining a target request identifier of the target data acquisition request;
target feedback data corresponding to the target request identification is called from a distributed database, and the target feedback data is fed back to a client;
the data stored in the distributed database is feedback data fed back when the server normally works and receives a data acquisition request. Or the like, or, alternatively,
the data caching method comprises the following steps:
receiving target feedback data fed back by a server; the target feedback data corresponds to a data acquisition request initiated by a client;
and feeding back the target feedback data to the client, and storing the target feedback data in a distributed database, so as to retrieve feedback data matched with the data acquisition request from the distributed database when the server is detected to be abnormal and the data acquisition request initiated by the client is received.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for embodiments of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (12)

1. A method for retrieving data, comprising:
when detecting that a server is in an abnormal state and receiving a target data acquisition request initiated by a client, determining a target request identifier of the target data acquisition request;
target feedback data corresponding to the target request identification is called from a distributed database, and the target feedback data is fed back to a client;
the data stored in the distributed database is feedback data fed back when the server normally works and receives a data acquisition request.
2. The method of claim 1, wherein the detecting that the server is in an abnormal state comprises:
sending heartbeat packets to a server at regular time;
and if the response data corresponding to the heartbeat packet is not received within the preset time length, determining that the server is in an abnormal state.
3. The method of claim 2, further comprising:
monitoring the current state of the server based on a timing task, and if the current state is recovered to a normal state from the abnormal state, sending a data acquisition request to the server when receiving the data acquisition request so as to enable the server to feed back target feedback data corresponding to the data acquisition request.
4. A method for caching data, comprising:
receiving target feedback data fed back by a server; the target feedback data corresponds to a data acquisition request initiated by a client;
and feeding back the target feedback data to the client, and storing the target feedback data in a distributed database, so as to retrieve feedback data matched with the data acquisition request from the distributed database when the server is detected to be abnormal and the data acquisition request initiated by the client is received.
5. The method of claim 4, wherein storing the target feedback data in the distributed database comprises:
and based on a preset monitoring plug-in, when the difference between the target feedback data and the historical target feedback data is determined, storing the target feedback data into the distributed database.
6. The method of claim 4, wherein storing the target feedback data in the distributed database comprises:
and when the distributed database is determined to contain the feedback data to be updated matched with the data acquisition request based on a preset monitoring plug-in, processing the feedback data to be updated and the target feedback data based on a preset data processing strategy, and determining the feedback data stored in the distributed database.
7. The method according to claim 6, wherein the processing the feedback data to be updated and the target feedback data based on a preset management policy to determine the feedback data stored in the distributed database comprises:
when detecting that the data volume corresponding to the feedback data to be updated is larger than the data volume corresponding to the target feedback data, taking the feedback data to be updated as the feedback data stored in the distributed database; or determining the timestamps corresponding to the feedback data to be updated and the target feedback data, and taking the data corresponding to the timestamp closest to the current moment as the feedback data stored in the distributed database.
8. The method of claim 4 or 5, wherein storing the target feedback data in the distributed database comprises:
and performing data serialization on the target feedback data and storing the target feedback data in the distributed database.
9. A data retrieval device, comprising:
the target request identification determining module is used for determining a target request identification of a target data acquisition request when the server is detected to be in an abnormal state and the target data acquisition request initiated by a client is received;
the data feedback module is used for calling target feedback data corresponding to the target request identification from a distributed database and feeding the target feedback data back to the client;
and the distributed database stores feedback data which are fed back by the server and correspond to the data acquisition requests.
10. A data caching apparatus, comprising:
the data receiving module is used for receiving target feedback data fed back by the server; the target feedback data corresponds to a data acquisition request initiated by a client;
and the data storage module is used for feeding the target feedback data back to the client and storing the target feedback data into a distributed database so as to call the feedback data matched with the data acquisition request from the distributed database when the server is detected to be abnormal and the data acquisition request initiated by the client is received.
11. An electronic device, characterized in that the electronic device comprises:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the data retrieval method of any one of claims 1-3 or the data caching method of any one of claims 4-7.
12. A storage medium containing computer-executable instructions for performing the data retrieval method of any one of claims 1-3 or the data caching method of any one of claims 4-7 when executed by a computer processor.
CN202110090472.0A 2021-01-22 2021-01-22 Data calling method and device, electronic equipment and storage medium Pending CN113761054A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110090472.0A CN113761054A (en) 2021-01-22 2021-01-22 Data calling method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110090472.0A CN113761054A (en) 2021-01-22 2021-01-22 Data calling method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113761054A true CN113761054A (en) 2021-12-07

Family

ID=78786457

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110090472.0A Pending CN113761054A (en) 2021-01-22 2021-01-22 Data calling method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113761054A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117171419A (en) * 2023-10-31 2023-12-05 腾讯科技(深圳)有限公司 Content processing method, device, electronic apparatus, storage medium, and program product

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117171419A (en) * 2023-10-31 2023-12-05 腾讯科技(深圳)有限公司 Content processing method, device, electronic apparatus, storage medium, and program product
CN117171419B (en) * 2023-10-31 2024-04-30 腾讯科技(深圳)有限公司 Content processing method, device, electronic apparatus, storage medium, and program product

Similar Documents

Publication Publication Date Title
US9015315B2 (en) Identification and monitoring of distributed business transactions
US20150067146A1 (en) Custom correlation of a distributed business transaction
CN112506915B (en) Application data management system, processing method and device and server
US20160323160A1 (en) Detection of node.js memory leaks
CN111259022B (en) Information synchronization method, synchronization system, computer equipment and medium
CN110837423A (en) Method and device for automatically acquiring data of guided transport vehicle
US20200057714A1 (en) Testing data changes in production systems
CN113900834A (en) Data processing method, device, equipment and storage medium based on Internet of things technology
US20170147483A1 (en) Tracking asynchronous entry points for an application
CN112612546A (en) Page loading method and device, electronic equipment and storage medium
CN113238815B (en) Interface access control method, device, equipment and storage medium
US9563485B2 (en) Business transaction context for call graph
CN110881224B (en) Network long connection method, device, equipment and storage medium
CN113761054A (en) Data calling method and device, electronic equipment and storage medium
CN114153703A (en) Micro-service exception positioning method and device, electronic equipment and program product
CN113220342A (en) Centralized configuration method and device, electronic equipment and storage medium
US8677323B2 (en) Recording medium storing monitoring program, monitoring method, and monitoring system
CN113760842A (en) Data processing method and device, electronic equipment and storage medium
CN114584618A (en) Information interaction method, device, equipment, storage medium and system
CN116700779A (en) Code dynamic adjustment method, device, equipment, medium and program product
CN111581059A (en) Spark application monitoring method, system, equipment and storage medium
CN112818204B (en) Service processing method, device, equipment and storage medium
CN114510398A (en) Anomaly monitoring method, apparatus, device, system and medium
CN114490265A (en) Data acquisition method, device, equipment and storage medium
US20140040195A1 (en) Offline Web Application System

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