CN116089753A - Service data acquisition method, device, server and storage medium - Google Patents

Service data acquisition method, device, server and storage medium Download PDF

Info

Publication number
CN116089753A
CN116089753A CN202310018315.8A CN202310018315A CN116089753A CN 116089753 A CN116089753 A CN 116089753A CN 202310018315 A CN202310018315 A CN 202310018315A CN 116089753 A CN116089753 A CN 116089753A
Authority
CN
China
Prior art keywords
service data
service
server
data acquisition
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310018315.8A
Other languages
Chinese (zh)
Inventor
邓广伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet 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 Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202310018315.8A priority Critical patent/CN116089753A/en
Publication of CN116089753A publication Critical patent/CN116089753A/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/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/951Indexing; Web crawling techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines

Landscapes

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

Abstract

The disclosure relates to a service data acquisition method, a device, a server and a storage medium, and relates to the technical field of Internet. The method comprises the following steps: receiving a service data acquisition request sent by a terminal, wherein the service data acquisition request comprises a service identifier of a target service; when the target service data is stored in the local cache of the first server, a first service data acquisition response is sent to the terminal, and the first service data acquisition response comprises the target service data. According to the scheme provided by the disclosure, the service data acquisition efficiency can be improved.

Description

Service data acquisition method, device, server and storage medium
Technical Field
The disclosure relates to the technical field of internet, and in particular relates to a service data acquisition method, a device, a server and a storage medium.
Background
Currently, service data of a plurality of service servers may be stored in the same storage server. The plurality of service servers may obtain respective service data from the storage server.
However, in the above method, the storage server may receive a large amount of requests for acquiring service data at the same time, which may cause the flow of the storage server to be too concentrated in a short time, reducing the processing efficiency of the storage server, and affecting the service data acquisition efficiency.
Disclosure of Invention
The disclosure provides a service data acquisition method, a device, a server and a storage medium, which solve the technical problems that the storage server may receive a large amount of service data acquisition requests at the same time, the storage server may cause too concentrated flow in a short time, the processing efficiency of the storage server is reduced, and the service data acquisition efficiency is affected.
The technical scheme of the embodiment of the disclosure is as follows:
according to a first aspect of an embodiment of the present disclosure, a service data acquisition method is provided. The method may include: receiving a service data acquisition request sent by a terminal, wherein the service data acquisition request comprises a service identifier of a target service; when the target service data is stored in the local cache of the first server, a first service data acquisition response is sent to the terminal, and the first service data acquisition response comprises the target service data.
Optionally, the service data obtaining further includes: and when the target service data is not stored in the local cache, sending the service data acquisition request to a second server so that the second server sends the target service data to the terminal.
Optionally, the service data acquisition method further includes: sending a service data transfer request to a second server at intervals of preset time length, wherein the service data transfer request is used for requesting to acquire service data stored in the second server; receiving a service data transfer response sent by the second server, wherein the service data transfer response comprises a service identifier of each service in at least one service and service data of each service, and the query times of the service data of each service are greater than or equal to a time threshold; and storing the service identification of each service and the service data of each service in the local cache.
According to a second aspect of embodiments of the present disclosure, a service data acquisition method is provided. The method may include: receiving a service data acquisition request sent by a first server, wherein the service data acquisition request comprises a service identifier of a target service, and the first server sends the service data acquisition request to a second server under the condition that the service data of the target service is not stored in a local cache of the first server; determining target service data based on the service identification of the target service; and sending a second service data acquisition response to the terminal, wherein the second service data acquisition response comprises the target service data.
Optionally, the service data acquisition method further includes: receiving a service data transfer request sent by the first server; determining at least one service from a plurality of services stored by the second server, wherein the query times of the service data of each service in the at least one service are greater than or equal to a time threshold; and sending a service data transfer response to the first server, wherein the service data transfer response comprises the service identification of each service and the service data of each service.
Optionally, the determining at least one service from the plurality of services stored in the second server specifically includes: acquiring the query times of the service data of each service; storing a preset corresponding relation, wherein the preset corresponding relation comprises respective service identifiers of the plurality of services and respective query times of the plurality of services, and the query times corresponding to one service are the query times of service data of the service; and determining the at least one service from the plurality of services based on the preset corresponding relation.
According to a third aspect of the embodiments of the present disclosure, there is provided a service data acquisition apparatus. The apparatus may include: a receiving module and a transmitting module; the receiving module is configured to receive a service data acquisition request sent by a terminal, wherein the service data acquisition request comprises a service identifier of a target service; the sending module is configured to send a first service data acquisition response to the terminal when the target service data is stored in the local cache of the first server, wherein the first service data acquisition response comprises the target service data.
Optionally, the sending module is further configured to send the service data acquisition request to a second server when the target service data is not stored in the local cache, so that the second server sends the target service data to the terminal.
Optionally, the service data acquisition device further comprises a storage module; the sending module is further configured to send a service data transfer request to the second server at intervals of a preset duration, where the service data transfer request is used for requesting to obtain service data stored in the second server; the receiving module is further configured to receive a service data dump response sent by the second server, where the service data dump response includes a service identifier of each service in at least one service and service data of each service, and a query number of times of the service data of each service is greater than or equal to a number threshold; the storage module is configured to store the service identifier of each service and the service data of each service in the local cache.
According to a fourth aspect of the embodiments of the present disclosure, there is provided a service data acquisition apparatus. The apparatus may include: the device comprises a receiving module, a determining module and a sending module; the receiving module is configured to receive a service data acquisition request sent by a first server, where the service data acquisition request includes a service identifier of a target service, and the service data acquisition request is sent by the first server to the second server when service data of the target service is not stored in a local cache of the first server; the determining module is configured to determine target service data based on the service identifier of the target service; the sending module is configured to send a second service data acquisition response to the terminal, where the second service data acquisition response includes the target service data.
Optionally, the receiving module is further configured to receive a service data forwarding request sent by the first server; the determining module is further configured to determine at least one service from the plurality of services stored by the second server, wherein the query number of the service data of each service in the at least one service is greater than or equal to a number threshold; the sending module is further configured to send a service data dump response to the first server, where the service data dump response includes the service identifier of each service and the service data of each service.
Optionally, the service data acquisition device further comprises an acquisition module and a storage module; the acquisition module is configured to acquire the query times of the service data of each of a plurality of services; the storage module is configured to store a preset corresponding relation, wherein the preset corresponding relation comprises respective service identifiers of the plurality of services and respective query times of the plurality of services, and the query times corresponding to one service are the query times of service data of the service; the determining module is specifically configured to determine the at least one service from the plurality of services based on the preset correspondence.
According to a fifth aspect of embodiments of the present disclosure, there is provided a server, which may include: a processor and a memory configured to store processor-executable instructions; wherein the processor is configured to execute the instructions to implement any of the above-described optional service data acquisition methods of the first aspect, or to implement any of the above-described optional service data acquisition methods of the second aspect.
According to a sixth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium having instructions stored thereon, which when executed by a processor of a server, enable the server to perform any one of the above-described optional service data acquisition methods of the first aspect, or to perform any one of the above-described optional service data acquisition methods of the second aspect.
According to a seventh aspect of embodiments of the present disclosure, there is provided a computer program product comprising computer instructions which, when run on a processor of a server, cause the server to perform the method of traffic data acquisition as optional in any of the first aspects, or to perform the method of traffic data acquisition as optional in any of the second aspects.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
based on any one of the above aspects, in the present disclosure, the first server may receive a service data acquisition request sent by the terminal, where the service data acquisition request includes a service identifier of the target service, and when the local cache of the first server stores the target service data, it indicates that the first server may acquire the target service data from the local cache of the first server, without sending the service data acquisition request to the second server, where the first server may send a first service data acquisition response to the terminal, where the first service data acquisition response includes the target service data. In the embodiment of the disclosure, when the target service data is stored in the local cache of the first server, the first server can directly acquire the target service data from the local cache of the first server without sending the service data acquisition request to the second server, so that the second server can be prevented from excessively concentrating the flow in a short time, and partial requests are screened for the second server, thereby improving the service data acquisition efficiency.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure and do not constitute an undue limitation on the disclosure.
Fig. 1 shows a schematic diagram of a service data acquisition system provided by an embodiment of the present disclosure;
fig. 2 is a schematic flow chart of a service data acquisition method according to an embodiment of the disclosure;
fig. 3 is a schematic flow chart of another service data obtaining method according to an embodiment of the disclosure;
fig. 4 is a schematic flow chart of another service data obtaining method according to an embodiment of the disclosure;
fig. 5 is a schematic flow chart of another service data obtaining method according to an embodiment of the disclosure;
fig. 6 is a schematic flow chart of another service data obtaining method according to an embodiment of the disclosure;
fig. 7 is a schematic flow chart of another service data obtaining method according to an embodiment of the disclosure;
fig. 8 is a schematic flow chart of another service data obtaining method according to an embodiment of the disclosure;
Fig. 9 is a schematic structural diagram of a service data acquiring device according to an embodiment of the present disclosure;
fig. 10 is a schematic structural diagram of still another service data obtaining apparatus according to an embodiment of the present disclosure;
fig. 11 is a schematic structural diagram of still another service data obtaining apparatus according to an embodiment of the present disclosure;
fig. 12 is a schematic structural diagram of still another service data obtaining apparatus according to an embodiment of the present disclosure.
Detailed Description
In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, and/or components.
It should be noted that, the user information (including, but not limited to, user equipment information, user personal information, user behavior information, etc.) and the data (including, but not limited to, service data, etc.) related to the present disclosure are information and data authorized by the user or sufficiently authorized by each party.
In the related art, service data of a plurality of service servers may be stored in the same storage server. The plurality of service servers may obtain respective service data from the storage server. However, the storage server may receive a large amount of requests for acquiring service data at the same time, which may cause the flow of the storage server to be too concentrated in a short time, reducing the processing efficiency of the storage server, and affecting the service data acquisition efficiency.
Based on this, the embodiment of the disclosure provides a service data acquisition method, because when target service data is stored in the local cache of the first server, the first server can directly acquire the target service data from the local cache of the first server, without sending the service data acquisition request to the second server, so that the second server can be prevented from excessively concentrating the flow in a short time, and partial requests can be screened for the second server, so that the service data acquisition efficiency can be improved.
The service data acquisition method, the device, the electric server and the storage medium provided by the embodiment of the disclosure are applied to a service data acquisition scene. When the first server receives the service data acquisition request sent by the terminal, it can be determined whether the local buffer memory of the first server stores the target service data according to the method provided by the embodiment of the present disclosure, and when the local buffer memory of the first server stores the target service data, a first service data acquisition response is sent to the terminal, where the first service data acquisition response includes the target service data.
The following describes an exemplary service data acquisition method provided by the embodiment of the present disclosure with reference to the accompanying drawings:
fig. 1 is a schematic diagram of a service data acquisition system according to an embodiment of the present disclosure, as shown in fig. 1, where the service data acquisition system may include a terminal 101, a server 102, and a server 103, and the server 102 may establish a connection with the terminal 101 (and the server 103) through a wired network or a wireless network.
The terminal 101 may be a mobile phone, a tablet computer, a desktop, a laptop, a handheld computer, a notebook, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook, a cellular phone, a personal digital assistant (personal digital assistant, PDA), an augmented reality (augmented reality, AR) \virtual reality (VR) device, etc., and the specific form of the terminal 101 is not particularly limited in this disclosure. The system can perform man-machine interaction with a user through one or more modes of a keyboard, a touch pad, a touch screen, a remote controller, voice interaction or handwriting equipment and the like.
The server 102 and the server 103 may be independent physical servers, may be a server cluster or a distributed system formed by a plurality of physical servers, and may also be cloud servers providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, network acceleration services (content delivery network, CDN), basic cloud computing services such as big data and artificial intelligence platforms, and the like.
Specifically, the server 102 may receive a service data acquisition request sent by the terminal 101, when target service data is stored in a local cache of the server 102, the server 102 sends a first service data acquisition response to the terminal 101, where the first service data acquisition response includes the target service data, and when the target service data is not stored in the local cache of the server 102, the server 102 sends the service data acquisition request to the server 103, so that the server 103 sends the target service data to the terminal 101; the server 103 may receive the service data acquisition request sent by the server 102 and determine the target service data based on the service identifier of the target service, and the server 103 may also send a second service data acquisition response to the terminal 101, where the second service data acquisition response includes the target service data.
As shown in fig. 2, when the service data acquisition method is applied to the above-described server 102, the service data acquisition method may include S101-S102.
S101, a first server receives a service data acquisition request sent by a terminal.
The service data acquisition request comprises a service identifier of a target service.
It is understood that the service data acquisition request is for requesting acquisition of service data of a target service.
In the embodiment of the disclosure, the first server may be understood as a service server, and service data of the service server may be stored in other storage servers.
S102, when target service data is stored in the local cache of the first server, the first server sends a first service data acquisition response to the terminal.
Wherein the first service data acquisition response includes the target service data.
It should be understood that the target service data is service data of the target service.
It may be understood that the local cache of the first server may store service data of a plurality of services, when the first server receives a service data acquisition request sent by the terminal, it may determine whether the local cache stores the target service data based on the service identifier of the target service, and when the local cache of the first server stores the target service data, the first server sends a first service data acquisition response to the terminal.
It should be appreciated that when the target service data is stored in the local cache of the first server, it is illustrated that the first server may directly obtain the target service data from the local cache of the first server without sending the service data obtaining request to other servers (e.g., the second server).
In an implementation manner of the embodiment of the present disclosure, a first correspondence may be stored in the local cache, where the first correspondence is a correspondence between service data of each of the plurality of services and service identifiers of each of the plurality of services, and the first server may determine whether the local cache includes the target service data by determining whether the local cache includes the service identifier of the target service, and when the first server determines that the local cache includes the target service data, the first server may determine the target service data from the local cache of the first server based on the first correspondence and the service identifier of the target service.
In the embodiment of the present disclosure, the local cache of the first server may also be understood as a storage database of the first server.
Optionally, the service identifier of the target service may exist in a key form, the target service data may exist in a value form, and the local cache may store a plurality of values and a key corresponding to each value in the plurality of values.
The technical scheme provided by the embodiment at least has the following beneficial effects: as known from S101-S102, the first server may receive a service data acquisition request sent by the terminal, where the service data acquisition request includes a service identifier of the target service, and when the local cache of the first server stores the target service data, it indicates that the first server may acquire the target service data from the local cache of the first server, without sending the service data acquisition request to the second server, where the first server may send a first service data acquisition response to the terminal, where the first service data acquisition response includes the target service data. In the embodiment of the disclosure, when the target service data is stored in the local cache of the first server, the first server can directly acquire the target service data from the local cache of the first server without sending the service data acquisition request to the second server, so that the second server can be prevented from excessively concentrating the flow in a short time, and partial requests are screened for the second server, thereby improving the service data acquisition efficiency.
Referring to fig. 2, as shown in fig. 3, the service data obtaining method provided in the embodiment of the present disclosure further includes S103.
And S103, when the target service data is not stored in the local cache, sending a service data acquisition request to the second server so that the second server sends the target service data to the terminal.
It should be appreciated that when the service identification of the target service is not included in the local cache, the first server may determine that the target service data is not stored in the local cache.
It can be understood that when the target service data is not stored in the local cache, it is indicated that the first server cannot directly obtain the target service data from the local cache of the first server, and at this time, the first server may send the service data obtaining request to the second server.
It should be noted that, the second server stores all service data of the first server, and the second server may determine the target service data from the second server based on the service identifier of the target service, and then send the target service data to the terminal.
Alternatively, the second server may be a distributed cache server, such as a redis server.
The technical scheme provided by the embodiment at least has the following beneficial effects: as shown in S103, when the local cache of the first server does not store the target service data, it is indicated that the first server cannot acquire the target service data from the local cache of the first server, and at this time, the first server may send the service data acquisition request to the second server, so that the second server sends the target service data to the terminal. In the embodiment of the disclosure, when the first server cannot acquire the target service data from the local cache of the first server, the first server sends the first service data acquisition request to the second server, so that the service data acquisition request received by the second server in a short time can be reduced, the efficiency of processing the service data acquisition request by the second server is improved, and the second server stores the target service data, so that the service data acquisition effectiveness is improved.
Referring to fig. 2, as shown in fig. 4, the service data obtaining method further includes S104 to S106.
S104, the first server sends a service data transfer request to the second server at intervals of a preset time length.
The service data transfer request is used for requesting to acquire the service data stored in the second server.
Alternatively, the preset duration may be 10 seconds.
S105, the first server receives the service data transfer response sent by the second server.
The service data transfer response comprises a service identifier of each service in at least one service and service data of each service, and the query times of the service data of each service are greater than or equal to a time threshold.
It can be understood that when the number of times of querying the service data of each service is greater than or equal to the number of times threshold, it is indicated that the number of times of querying each service is greater, and the first server may obtain the service data of the service with the greater number of times of querying.
It should be understood that after the second server receives the service data forwarding request sent by the first server, the query times of the service data of each of the plurality of services stored by the second server may be obtained, and a preset correspondence between the service identifiers of each of the plurality of services and the query times corresponding to each of the plurality of services is stored, and then at least one service whose query times is greater than or equal to the time threshold is determined based on the preset correspondence.
Alternatively, the at least one service may be 100 services, and the second server may determine the first 100 services having the largest number of queries among the plurality of services as the at least one service.
Optionally, the number of times threshold may also be included in the service data forwarding request.
S106, the first server stores the service identification of each service and the service data of each service in the local cache.
In this embodiment of the present disclosure, after receiving a service data dump response sent by the second server, the first server may store a service identifier of each service in at least one service and service data of each service, and further after the first server receives a service data acquisition request sent by a terminal, may determine, based on the service identifier of a target service, the target service data from the local cache.
It may be understood that the first server may receive the service data forwarding response sent by the second server at intervals of a preset duration, and then update the service identifier of each service in the at least one service stored in the local cache and the service data of each service.
Alternatively, the preset duration may be 10 seconds.
The technical scheme provided by the embodiment at least has the following beneficial effects: as known from S104-S106, the first server may send a service data dumping request to the second server at intervals of a preset duration, where the service data dumping request is used to request to obtain service data stored in the second server, and then the first server may receive a service data dumping response sent by the second server, and store the service identifier of each service and the service data of each service in the local cache. In the embodiment of the disclosure, when the number of times of querying the service data of each service in the at least one service is greater than or equal to the number of times threshold, it is indicated that the number of times of querying each service data is greater, so that the first server stores the service data with the greater number of times of querying in the local cache, and can process more service data acquisition requests under the condition of storing less service data, so that the number of service data acquisition requests required to be processed by the second server can be reduced, and the service data acquisition efficiency is improved.
As shown in fig. 5, when the service data acquisition method is applied to the above-described server 103, the service data acquisition method may include S201 to S203.
S201, the second server receives a service data acquisition request sent by the first server.
The service data acquisition request includes a service identifier of a target service, and the first server sends the service data acquisition request to the second server when the service data of the target service is not stored in the local cache of the first server.
It is understood that the service data acquisition request is used to request the second server to send the target service data to the terminal.
In connection with the above description of the embodiments, it should be understood that the second server stores all service data of the first server, and when the local cache of the first server does not store the target service data, it indicates that the first server cannot acquire the target service data from the local cache of the first server, where the first server sends the service data acquisition request to the second server, so far, the second server may receive the service data acquisition request sent by the first server.
S202, the second server determines target service data based on the service identification of the target service.
It may be appreciated that, since the service identifier of the target service is included in the service data acquisition request, the second server may determine the target service data based on the service identifier of the target service.
In an implementation manner of the embodiment of the present disclosure, the second server may store a second correspondence, where the second correspondence is a correspondence between service data of a plurality of services stored by the second server and service identifiers corresponding to each service data in the plurality of service data, and the second server may determine the target service data based on the second correspondence and the service identifier of the target service.
S203, the second server sends a second service data acquisition response to the terminal.
Wherein the second service data acquisition response includes the target service data.
Optionally, the second server may further send a third service data acquisition response to the first server, where the third service data acquisition response is used to notify the second server that the target service data has been sent to the terminal.
The technical scheme provided by the embodiment at least has the following beneficial effects: as known from S201 to S203, the second server may receive a service data acquisition request sent by the first server, where the service data acquisition request is sent by the first server to the second server in a case where the service data of the target service is not stored in the local cache of the first server, which indicates that the first server cannot acquire the target service data from the local cache, and then the second server may determine the target service data based on the service identifier of the target service, and send a second service data acquisition response to the terminal. In the embodiment of the disclosure, the service data acquisition request is sent to the second server when the first server cannot acquire the target service data from the local cache, so that the number of service data acquisition requests to be processed by the second server can be reduced, the service data acquisition efficiency is improved, and the second server can determine the target service data based on the service identifier of the target service, so that the service data acquisition effectiveness can be improved.
Referring to fig. 5, as shown in fig. 6, the service data obtaining method further includes S204 to S205.
S204, the second server receives the service data transfer request sent by the first server.
It should be appreciated that the service data relocation request is for requesting to acquire service data stored in the second server.
It can be appreciated that the second server may receive, at intervals, a service data forwarding request sent by the first server from a preset market.
S205, the second server determines at least one service from a plurality of services stored by the second server.
Wherein the number of queries for the service data for each of the at least one service is greater than or equal to a number threshold.
It should be noted that, when the first server receives a service data acquisition request sent by the terminal, where the service data acquisition request is a service data for requesting to acquire a target service, the second server may determine that the number of times of querying the service data of the target service is 1.
It can be understood that the number of times of querying the service data of one service is the sum of the number of times of querying the service data in the target duration, and when the number of times of querying the service data of one service is greater than or equal to the number threshold, the number of times of querying the service data of the one service is illustrated to be more.
In the embodiment of the disclosure, the second server may store service data of a plurality of services and a query number of times of service data of each service in the plurality of services, and then determine service data of which the query number of times is greater than or equal to a number threshold, and determine the service data of which the query number of times is greater than or equal to the number threshold as the at least one service data.
In an optional implementation manner, the second server may determine, as the at least one service, a service corresponding to M service data with the largest number of queries, where M is a positive integer greater than or equal to 1.
Alternatively, the target time period may be 1 second, and the target time period may also be the preset time period.
Alternatively, the number of times threshold may be 2000 times, and M may be 100.
Optionally, the number of times threshold or M may be included in the service data forwarding request, and the second server may determine, based on the service data forwarding request, that service data with a query number of times greater than or equal to the number of times threshold is determined to be at least one service data, or that a service corresponding to M service data with a maximum query number of times is determined to be the at least one service.
S206, the second server sends a service data transfer response to the first server.
The service data transfer response includes the service identifier of each service and the service data of each service.
In combination with the description of the foregoing embodiment, after determining the service data of each service, the second server may determine the service identifier of each service based on the second correspondence, and then send the service data dump response to the first server.
The technical scheme provided by the embodiment at least has the following beneficial effects: as known from S204-S206, the second server may receive the service data dumping request sent by the first server, and then determine at least one service from the plurality of services stored by the second server, where the number of queries for the service data of each service in the at least one service is greater than or equal to the number threshold, and the second server sends a service data dumping response to the first server, where the service data dumping response includes the service identifier of each service and the service data of each service. In the embodiment of the disclosure, since the number of times of querying the service data of each service in the at least one service is greater than or equal to the threshold value, which indicates that the second server receives more service data acquisition requests corresponding to the service data of each service, the second server sends the service data of the at least one service to the first server, so that the number of service data acquisition requests received by the second server can be reduced, and further the processing efficiency of the second server is improved.
Referring to fig. 6, as shown in fig. 7, the second server determines at least one service from a plurality of services stored in the second server, and may specifically include S2051-S2053.
S2051, the second server obtains the query times of the service data of each of the plurality of services.
In combination with the above description of the embodiment, when the first server receives a service data acquisition request sent by the terminal, where the service data acquisition request is used to request to acquire service data of a target service, the number of times of querying the service data of the target service is 1, it should be understood that the second server may acquire the number of times of querying the service data of the target service in the service data acquisition request received by the first server in the target duration.
In an implementation manner of the embodiment of the present disclosure, the number of the first servers may be plural, and the second server may obtain the number of times of querying service data of the target service in the target duration of each of the plurality of first servers, and then determine the sum of the number of times of querying service data of the target service in the target duration.
Optionally, the second server may send the query times of the service data of the target service in the plurality of first servers through kafka, and then aggregate the query times of the service data of the target service at the consumer end of kafka to obtain the sum of the query times of the service data of the target service.
It should be noted that, the second server may acquire the number of queries of the service data of each of the plurality of services in combination with the method described in the foregoing embodiment.
S2052, the second server stores a preset corresponding relation.
The preset corresponding relation comprises respective service identifiers of the plurality of services and respective query times of the plurality of services, and the query times corresponding to one service are the query times of the service data of the service.
It can be understood that, because the service identifier of the service is included in the service data acquisition request sent by the terminal, the number of times of querying the service data of each of the plurality of services may also be understood as the number of times of querying the service identifier of each of the plurality of services, and after the second server obtains the number of times of querying the service data of each of the plurality of services, a preset correspondence between the service identifier of each of the plurality of services and the number of times of querying the service data of each of the plurality of services may be determined, and then the preset correspondence may be stored.
In an optional implementation manner, the second server may further sort the number of queries of the service data of each of the plurality of services from large to small, and then store the preset correspondence based on the sorting. For example, the second server may store the preset correspondence in a zset data structure.
S2053, the second server determines at least one service from the plurality of services based on the preset corresponding relation.
It may be appreciated that the second server may determine, based on a preset correspondence, a service identifier of at least one service for which the number of queries is greater than or equal to the number threshold, and then determine the at least one service based on the service identifier of the at least one service and the second correspondence.
The technical scheme provided by the embodiment at least has the following beneficial effects: as known from S2051-S2053, the second server may obtain the number of queries of the service data of each of the plurality of services, then store the service identifier of each of the plurality of services and a preset correspondence between the number of queries corresponding to each of the plurality of services, and determine the at least one service based on the preset correspondence. In the embodiment of the disclosure, since the preset correspondence is a correspondence between the service identifiers of the multiple services and the query times corresponding to the multiple services, the second server may accurately determine at least one service with the query times greater than or equal to the time threshold based on the preset correspondence, and further send service data of the at least one service to the first server, so as to improve the validity of determining the at least one service and improve the acquisition efficiency of the service data.
As shown in fig. 8, when the service data acquisition method is based on the interaction of the server 102 and the server 103, the service data acquisition method may include S301 to S305.
S301, a first server receives a service data acquisition request sent by a terminal.
The service data acquisition request comprises a service identifier of a target service.
S302, when the target service data is not stored in the local cache of the first server, a service data acquisition request is sent to the second server, so that the second server sends the target service data to the terminal.
S303, the second server receives the service data acquisition request sent by the first server.
The service data acquisition request includes a service identifier of a target service, and the first server sends the service data acquisition request to the second server when the service data of the target service is not stored in the local cache of the first server.
S304, the second server determines the target service data based on the service identification of the target service.
S305, the second server sends a second service data acquisition response to the terminal.
Wherein the second service data acquisition response includes the target service data.
The technical scheme provided by the embodiment at least has the following beneficial effects: as known from S301 to S305, the first server may receive a service data acquisition request sent by the terminal, when target service data is not stored in the local cache of the first server, the first server may send the service data acquisition request to the second server, and after receiving the service data acquisition request, the second server may determine target service data based on the service identifier of the target service, and then send a service data acquisition response to the terminal. In the embodiment of the disclosure, the first server sends the service data acquisition request to the first server under the condition that the local cache does not store the target service data, so that partial requests are screened for the second server, the situation that the second server has too concentrated flow in a short time can be avoided, and the service data acquisition efficiency can be improved.
It will be appreciated that, in actual implementation, the server according to the embodiments of the present disclosure may include one or more hardware structures and/or software modules for implementing the corresponding service data acquisition method, where the executing hardware structures and/or software modules may form a server. Those of skill in the art will readily appreciate that the algorithm steps of the examples described in connection with the embodiments disclosed herein may be implemented as hardware or a combination of hardware and computer software. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
Based on such understanding, the embodiment of the present disclosure further correspondingly provides a service data acquisition device, and fig. 9 shows a schematic structural diagram of the service data acquisition device provided by the embodiment of the present disclosure. As shown in fig. 9, the service data acquisition device 20 may include: a receiving module 201 and a transmitting module 202.
The receiving module 201 is configured to receive a service data acquisition request sent by a terminal, where the service data acquisition request includes a service identifier of a target service.
And the sending module 202 is configured to send a first service data acquisition response to the terminal when the target service data is stored in the local cache of the first server, where the first service data acquisition response includes the target service data.
Optionally, the sending module 202 is further configured to send the service data acquisition request to the second server when the target service data is not stored in the local cache, so that the second server sends the target service data to the terminal.
Optionally, the service data acquisition device 20 further includes a storage module 203.
The sending module 202 is further configured to send a service data dumping request to the second server at intervals of a preset duration, where the service data dumping request is used to request to obtain service data stored in the second server.
The receiving module 201 is further configured to receive a service data dump response sent by the second server, where the service data dump response includes a service identifier of each service in at least one service and service data of each service, and a number of queries of the service data of each service is greater than or equal to a number threshold.
The storage module 203 is configured to store the service identifier of each service and the service data of each service in the local cache.
As described above, the embodiments of the present disclosure may divide functional modules of a service data acquisition device according to the above-described method examples. The integrated modules may be implemented in hardware or in software functional modules. In addition, it should be further noted that the division of the modules in the embodiments of the present disclosure is merely a logic function division, and other division manners may be implemented in practice. For example, each functional module may be divided corresponding to each function, or two or more functions may be integrated in one processing module.
The specific manner in which each module performs the operation and the beneficial effects of the service data acquiring device in the foregoing embodiment are described in detail in the foregoing method embodiment, and are not described herein again.
Fig. 10 is a schematic structural diagram of another service data acquisition device provided in the present disclosure. As shown in fig. 10, the service data acquisition device 30 may include at least one processor 301 and a memory 303 for storing processor-executable instructions. Wherein the processor 301 is configured to execute instructions in the memory 303 to implement the service data acquisition method in the above-described embodiment.
In addition, the traffic data acquisition device 30 may also include a communication bus 302 and at least one communication interface 304.
The processor 301 may be a processor (central processing units, CPU), microprocessor unit, ASIC, or one or more integrated circuits for controlling the execution of the programs of the present disclosure.
Communication bus 302 may include a path to transfer information between the above components.
Communication interface 304, using any transceiver-like device for communicating with other devices or communication networks, such as ethernet, radio access network (radio access network, RAN), wireless local area network (wireless local area networks, WLAN), etc.
The memory 303 may be, but is not limited to, a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (random access memory, RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (electrically erasable programmable read-only memory, EEPROM), a compact disc read-only memory (compact disc read-only memory) or other optical disc storage, a compact disc storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory may be stand alone and be connected to the processing unit by a bus. The memory may also be integrated with the processing unit.
The memory 303 is used for storing instructions for executing the disclosed aspects, and is controlled by the processor 301 for execution. The processor 301 is configured to execute instructions stored in the memory 303 to perform the functions of the methods of the present disclosure.
In a particular implementation, as one embodiment, processor 301 may include one or more CPUs, such as CPU0 and CPU1 of FIG. 10.
In a specific implementation, as an embodiment, the service data obtaining device 30 may include a plurality of processors, for example, the processor 301 and the processor 307 in fig. 10. Each of these processors may be a single-core (single-CPU) processor or may be a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (e.g., computer program instructions).
In a specific implementation, as an embodiment, the service data obtaining apparatus 30 may further include an output device 305 and an input device 306. The output device 305 communicates with the processor 301 and may display information in a variety of ways. For example, the output device 305 may be a liquid crystal display (liquid crystal display, LCD), a light emitting diode (light emitting diode, LED) display device, a Cathode Ray Tube (CRT) display device, or a projector (projector), or the like. The input device 306 communicates with the processor 301 and may accept user input in a variety of ways. For example, the input device 306 may be a mouse, keyboard, touch screen device, or sensing device, among others.
Fig. 11 is a diagram illustrating another exemplary structure of service data acquisition provided in the present disclosure. As shown in fig. 11, the service data acquisition 40 may include a receiving module 401, a determining module 402, and a transmitting module 403.
A receiving module 401 configured to receive a service data acquisition request sent by a first server, where the service data acquisition request 5 includes a service identifier of a target service, and the service data acquisition request is not in a local cache of the first server
In the case of storing service data of a target service, the first server transmits to the second server.
A determining module 402 is configured to determine target service data based on the service identification of the target service.
The sending module 403 is configured to send a second service data acquisition response to the terminal, where the second service data acquisition response includes the target service data.
0, optionally, the receiving module 401 is further configured to receive a service data forwarding request sent by the first server.
The determining module 402 is further configured to determine at least one service from the plurality of services stored by the second server, wherein the number of queries for the service data of each service in the at least one service is greater than or equal to a number threshold.
The sending module 403 is further configured to send a service data dump response to the first server, where the service data dump response includes the service identifier of each service and the service data of each service.
5 optionally, the service data acquisition device 40 further includes an acquisition module 404 and a storage module 405.
An obtaining module 404, configured to obtain the number of queries of the service data of each of the plurality of services.
The storage module 405 is configured to store a preset correspondence, where the preset correspondence includes service identifiers of the multiple services and query times corresponding to the multiple services, where the query times corresponding to one service is a query time of service data of the service.
The 0 determining module 402 is specifically configured to determine the at least one service from the plurality of services based on the preset correspondence.
Fig. 12 is a schematic structural diagram of another service data acquisition device provided in the present disclosure. As shown in fig. 12, the service data acquisition device 50 may include at least one processor 501 and a memory 503 for storing processor-executable instructions.
Wherein the processor 501 is configured to execute instructions in the memory 503 to implement the service data acquisition 5 method in the above embodiment.
In addition, the traffic data acquisition device 50 may also include a communication bus 502 and at least one communication interface 504.
The processor 501 may be a processor (central processing units, CPU), micro-processing unit, ASIC, or one or more integrated circuits for controlling the execution of the programs of the present disclosure.
Communication bus 502 may include a path to transfer information between the aforementioned components.
0 communication interface 504, using any transceiver-like means for communicating with other devices or communication networks, such as ethernet, radio access network (radio access network, RAN), wireless local area network (wireless local area networks, WLAN), etc.
The memory 503 may be, but is not limited to, a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (random access memory, RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (electrically erasable programmable read-only memory, EEPROM), a compact disc (compact disc read-only memory) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory may be stand alone and be connected to the processing unit by a bus. The memory may also be integrated with the processing unit.
Wherein the memory 503 is used to store instructions for performing the disclosed aspects and is controlled for execution by the processor 501. The processor 501 is configured to execute instructions stored in the memory 503 to implement the functions in the methods of the present disclosure.
In a particular implementation, as one embodiment, processor 501 may include one or more CPUs, such as CPU0 and CPU1 in FIG. 12.
In a specific implementation, as an embodiment, the service data obtaining device 50 may include a plurality of processors, such as the processor 501 and the processor 507 in fig. 12. Each of these processors may be a single-core (single-CPU) processor or may be a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (e.g., computer program instructions).
In a specific implementation, as an embodiment, the service data obtaining apparatus 50 may further include an output device 505 and an input device 506. The output device 505 communicates with the processor 501 and may display information in a variety of ways. For example, the output device 505 may be a liquid crystal display (liquid crystal display, LCD), a light emitting diode (light emitting diode, LED) display device, a Cathode Ray Tube (CRT) display device, or a projector (projector), or the like. The input device 506 communicates with the processor 501 and may accept user input in a variety of ways. For example, the input device 506 may be a mouse, a keyboard, a touch screen device, a sensing device, or the like.
Those skilled in the art will appreciate that the structures shown in fig. 10 and 12 do not constitute limitations on the service data acquisition device 30 and the service data acquisition device 50, and may include more or fewer components than shown, or may combine certain components, or may employ a different arrangement of components.
In addition, the present disclosure also provides a computer-readable storage medium including instructions that, when executed by a processor of a server, cause the server to perform the service data acquisition method provided in the above embodiments.
In addition, the present disclosure also provides a computer program product comprising instructions that, when executed by a processor of a server, cause the server to perform the service data acquisition method as provided by the above embodiments.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any adaptations, uses, or adaptations of the disclosure following the general principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (10)

1. The service data acquisition method is applied to a first server and is characterized by comprising the following steps:
receiving a service data acquisition request sent by a terminal, wherein the service data acquisition request comprises a service identifier of a target service;
and when the target service data is stored in the local cache of the first server, sending a first service data acquisition response to the terminal, wherein the first service data acquisition response comprises the target service data.
2. The service data acquisition method according to claim 1, characterized in that the method further comprises:
and when the target service data is not stored in the local cache, sending the service data acquisition request to a second server, so that the second server sends the target service data to the terminal.
3. The service data acquisition method according to claim 1 or 2, characterized in that the method further comprises:
sending a service data transfer request to a second server at intervals of preset time length, wherein the service data transfer request is used for requesting to acquire service data stored in the second server;
receiving a service data transfer response sent by the second server, wherein the service data transfer response comprises a service identifier of each service in at least one service and service data of each service, and the query times of the service data of each service are greater than or equal to a time threshold;
And storing the service identification of each service and the service data of each service in the local cache.
4. The service data acquisition method is applied to a second server and is characterized by comprising the following steps:
receiving a service data acquisition request sent by a first server, wherein the service data acquisition request comprises a service identifier of a target service, and the first server sends the service data acquisition request to the second server when the service data of the target service is not stored in a local cache of the first server;
determining target service data based on the service identification of the target service;
and sending a second service data acquisition response to the terminal, wherein the second service data acquisition response comprises the target service data.
5. The traffic data acquisition method according to claim 4, further comprising:
receiving a service data transfer request sent by the first server;
determining at least one service from a plurality of services stored by the second server, wherein the query times of service data of each service in the at least one service are greater than or equal to a time threshold;
And sending a service data transfer response to the first server, wherein the service data transfer response comprises the service identification of each service and the service data of each service.
6. The service data acquisition method according to claim 5, wherein the determining at least one service from the plurality of services stored in the second server includes:
acquiring the query times of the service data of each service;
storing a preset corresponding relation, wherein the preset corresponding relation comprises respective service identifiers of the plurality of services and respective query times of the plurality of 5 services, and the query times corresponding to one service are the query times of service data of the service;
and determining the at least one service from the plurality of services based on the preset corresponding relation.
7. A data acquisition device, comprising: a receiving module and a transmitting module;
the receiving module is configured to receive a service data acquisition request sent by a terminal, wherein the service data acquisition request 0 comprises a service identifier of a target service;
the sending module is configured to send a first service data acquisition response to the terminal when the target service data is stored in the local cache of the first server, wherein the first service data acquisition response comprises the target service data.
8. A data acquisition device, comprising: the device comprises a receiving module, a determining module and a sending module; the receiving module is configured to receive a service data acquisition request sent by a first server, where the service data acquisition request includes a service identifier of a target service, and the first server sends the service data acquisition request to the second server when the service data of the target service is not stored in a local cache of the first server;
the determining module is configured to determine target service data based on the service identifier of the target service;
the sending module is configured to send a second service data acquisition response to the terminal, and the second service data acquisition 0 response includes the target service data.
9. A server, the server comprising:
a processor;
a memory configured to store the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the traffic 5 data acquisition method of any one of claims 1-3 or to implement the traffic data acquisition method of any one of claims 4-6.
10. A computer readable storage medium having instructions stored thereon, which when executed by a processor of a server, enable the server to perform the service data acquisition method according to any one of claims 1-3 or the service data acquisition method according to any one of claims 4-6.
CN202310018315.8A 2023-01-06 2023-01-06 Service data acquisition method, device, server and storage medium Pending CN116089753A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310018315.8A CN116089753A (en) 2023-01-06 2023-01-06 Service data acquisition method, device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310018315.8A CN116089753A (en) 2023-01-06 2023-01-06 Service data acquisition method, device, server and storage medium

Publications (1)

Publication Number Publication Date
CN116089753A true CN116089753A (en) 2023-05-09

Family

ID=86213370

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310018315.8A Pending CN116089753A (en) 2023-01-06 2023-01-06 Service data acquisition method, device, server and storage medium

Country Status (1)

Country Link
CN (1) CN116089753A (en)

Similar Documents

Publication Publication Date Title
CN111786895A (en) Method and apparatus for dynamic global current limiting
CN111797091A (en) Method and device for querying data in database, electronic equipment and storage medium
CN113259479B (en) Data processing method and equipment
CN114155026A (en) Resource allocation method, device, server and storage medium
CN107277188B (en) Method, client, server and service system for determining IP address attribution information
CN112130936B (en) Data calling method, device, equipment and storage medium based on polling
CN113282589A (en) Data acquisition method and device
CN110928594A (en) Service development method and platform
CN113377817A (en) Data processing method, system, device and storage medium
CN107045452B (en) Virtual machine scheduling method and device
CN110019372B (en) Data monitoring method, device, server and storage medium
CN116089753A (en) Service data acquisition method, device, server and storage medium
CN115599571A (en) Data processing method and device, electronic equipment and storage medium
CN105162837A (en) Method and system for improving I/O throughput rate in massive data storage environment
CN110750602A (en) Method and device for determining site to which order address belongs
CN116861397A (en) Request processing method, device, electronic equipment and computer readable medium
CN113094131A (en) Prompt resource display method, device, terminal, server and storage medium
CN115391042B (en) Resource allocation method and device, electronic equipment and storage medium
CN114124757A (en) Parameter adjusting method, device, related equipment and storage medium
CN113285833B (en) Method and device for acquiring information
US20230049322A1 (en) Information processing method, device, system, and computer-readable storage medium
CN115174665A (en) Login state determination method, device, equipment and storage medium
CN115052168B (en) Label acquisition method, device, server and storage medium
CN115730224A (en) Service processing method, device, equipment and storage medium
CN112015745B (en) Data management method and device

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