Data query method and device, computer equipment and computer storage medium
By generating data back-to-source locks in the cache database and limiting the query threads of the business database, the problem of database breakdown is solved and the stability and response efficiency of the database are improved.
Patent Information
- Application Number
- CN202310357628.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-30
- Publication Date
- 2024-10-01
AI Technical Summary
Traditional data query methods cannot effectively avoid database breakdown problems when comprehensively utilizing relational and non-relational databases, causing the stability of relational databases to be affected.
By generating data back-to-source locks in the cache database, the target business data in the business database can only be queried by one data query thread at the same time, thereby reducing the probability of simultaneous queries by multiple data query threads and avoiding a sudden increase in resource consumption.
It effectively reduces the probability of database breakdown, improves the stability and response efficiency of the business database, and avoids excessive resource consumption.
Smart Images

Figure CN118733623A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data query method, device, computer equipment and computer storage medium. Background Art
[0002] With the continuous development and widespread application of computer technology, databases can be used to store the massive business data generated by Internet users, but the increase in data storage has brought about the problem of data processing efficiency. As far as reading data from the database is concerned, the current efficiency of reading non-relational databases (usually used as cache databases) is generally much better than the efficiency of reading relational databases (usually used as business databases), but the length of time that business data can be stored in non-relational databases is much shorter than that in relational databases. When traditional data query methods use the advantages of both databases to implement data query, they cannot avoid the problem of database breakdown of relational databases caused by a large number of data requests arriving at the relational database at the same time, which makes the stability of the relational database not guaranteed. Therefore, how to improve the stability of business databases by reducing the probability of database breakdown has become a current research hotspot. Summary of the invention
[0003] The embodiments of the present application provide a data query method, apparatus, computer equipment and computer storage medium, which can reduce the probability of occurrence of database breakdown problems, thereby improving the stability of the business database.
[0004] On the one hand, an embodiment of the present application provides a data query method, including:
[0005] In response to the data query request, calling the data query thread to query the target business data from the cache database, wherein the target business data refers to: the business data of the data object indicated by the data query request to be queried;
[0006] When the query result indicates that the target business data does not exist in the cache database, a data back-to-source lock for the target business data is generated; the data back-to-source lock is at least used to: limit the target business data in the business database to be queried by only one data query thread at the same time;
[0007] Call the data query thread to obtain the data return source lock of the target business data, and after successful acquisition, query the target business data from the business database;
[0008] Generate a data query result containing the target business data.
[0009] On the other hand, an embodiment of the present application provides a data query device, including:
[0010] A response unit, configured to call a data query thread to query target business data from a cache database in response to a data query request, wherein the target business data refers to business data of a data object indicated to be queried by the data query request;
[0011] The first generating unit is configured to generate a data source return lock for the target business data when the query result indicates that the target business data does not exist in the cache database; the data source return lock is at least used to: limit the target business data in the business database to be queried by only one data query thread at the same time;
[0012] A calling unit, configured to call the data query thread to obtain a data return source lock for the target business data, and after successful acquisition, query the target business data from a business database;
[0013] The second generating unit is used to generate a data query result including the target business data.
[0014] On the other hand, an embodiment of the present application provides a computer device, including:
[0015] A processor configured to execute one or more computer programs;
[0016] A computer storage medium storing one or more computer programs, wherein the one or more computer programs are suitable for being loaded by the processor and implementing the data query method according to the first aspect.
[0017] On the other hand, an embodiment of the present application provides a computer storage medium, wherein the computer storage medium stores one or more computer programs, and the one or more computer programs are suitable for being loaded by a processor and implementing the data query method of the first aspect.
[0018] On the other hand, an embodiment of the present application provides a program product, which includes a computer program, and the computer program is suitable for being loaded by a processor and executing the data query method of the first aspect.
[0019] In an embodiment of the present application, when the computer device fails to find the target business data in the cache database, a data return lock will be generated for the target business data, and the data return lock is used to limit the target business data in the business database to be queried by only one data query thread at the same time. Specifically, the computer device needs to query the target business data from the business database after the data query thread successfully obtains the data return lock of the target business data, so that the frequency or probability of multiple data query threads querying the target business data from the business database at the same time is reduced, or in other words, the probability of the business database responding to multiple query requests for the target business data at the same time is reduced, so as to avoid a sudden increase in the resource consumption of the business database, thereby improving the stability of the business database to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0021] Figure 1 It is a structural diagram of a data query system provided in an embodiment of the present application;
[0022] Figure 2 is a schematic flow chart of a data query method provided in an embodiment of the present application;
[0023] Figure 3 is a schematic flow chart of another data query method provided in an embodiment of the present application;
[0024] Figure 4 is a schematic flow chart of adding target business data to a cache database provided by an embodiment of the present application;
[0025] Figure 5 This is an example flow chart of extending the cache expiration time of target business data provided by an embodiment of the present application;
[0026] Figure 6a This is a schematic diagram of the principle of extending the cache expiration time of target business data provided by an embodiment of the present application;
[0027] Figure 6b This is another schematic diagram of the principle of extending the cache expiration time of target business data provided by an embodiment of the present application;
[0028] Figure 7 It is a schematic diagram of a target service data update process provided by an embodiment of the present application;
[0029] Figure 8 is a schematic flow chart of a data consistency check provided in an embodiment of the present application;
[0030] Fig. 9 is a schematic diagram of a data segment constituting target business data provided by an embodiment of the present application;
[0031] Fig.10 It is a structural schematic diagram of a data query device provided in an embodiment of the present application;
[0032] Fig.11 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0033] The embodiment of the present application conceives a data query solution for the scenario of performing data query from a database. The data query solution can be used to perform data query, and when the business data cached in the cache database becomes invalid, the probability of the business database responding to a large number of data query requests for business data at the same time can be effectively reduced, thereby reducing the probability of the business database crashing due to a sudden increase in resource consumption (it can also be said that the probability of database breakdown is reduced), thereby improving the stability of the business database.
[0034] The general principle of the data query scheme is explained below. Specifically, when responding to a data query request for target business data, the computer device can first call a data query thread to query the target business data from the cache database. If it is found during the query that the target business data does not exist in the cache database, a data back-to-source lock is generated for the target business data, so that after the data query thread successfully obtains the data back-to-source lock for the target business data, the target business data is queried from the business database, and finally a data query result containing the target business data is generated. Among them, a lock is a synchronization mechanism used by a computer device to forcibly restrict resource access when executing multiple threads, and is mainly used to ensure that mutual exclusion requirements are met in concurrent control. The data back-to-source lock in this scheme is mainly used to limit the target business data in the business database to be queried by only one data query thread at the same time. In this solution, only the data query thread that successfully obtains the data return source lock of the target business data can query the target business data from the business database. This reduces the frequency or probability of multiple data query threads querying the target business data from the business database at the same time. In other words, it reduces the probability of the business database responding to multiple query requests for the target business data at the same time, thereby improving the stability of the business database.
[0035] In one embodiment, the target business data refers to the business data that the computer device inquires as indicated by the data query request, and the business data is the data generated by the business with data query demand (such as online shopping business, information promotion business, data management business, etc.). Among them, the data query demand can be determined by the client, so that the data query request can be generated by the client based on the data query demand. After the computer device receives the data query request, the data query thread can be called to respond to the data query request. The data query thread is the smallest unit that the computer device can perform calculation scheduling when providing data query services, and optionally, the data query thread can be generated by the computer device after receiving the data query request. In this scheme, one data query thread is exemplarily used to respond to one data query request. It can be understood that when the computer device receives multiple data query requests, the response to multiple data query requests can be achieved by generating and calling multiple data query threads.
[0036] In addition, the data query thread can preferentially query the target business data from the cache database. If the target business data is not found in the cache database, a query for the target business data is initiated to the business database. In practical applications, in order to ensure the efficiency of data query, the read performance of the cache database is usually better than the read performance of the business database, while the data storage performance of the business database is usually better than the data storage performance of the cache database. Specifically, when selecting a cache database and a business database, the resources consumed by reading the target business data from the cache database (such as device resources and / or time resources, etc.) are usually less than the resources consumed by reading the target business data from the business database, and the storage persistence of the business data in the business database is higher than the storage persistence of the business data in the cache database.
[0037] In one embodiment, it is not difficult to understand based on the above description that this solution can be specifically applied to the following Figure 1 The data query system shown in FIG. Figure 1 As shown, the data query system may include one or more clients marked by 101, a cache database marked by 102, and a business database marked by 103. Among them, the client can be run in a terminal device, and the terminal device may specifically include but is not limited to: a smart phone, a tablet computer, a laptop computer, a desktop computer, a vehicle terminal, a smart TV, a game console, etc. It is worth mentioning that in addition to running the client, the terminal device can also run applications (or clients) such as image processing applications, multimedia playback applications, and navigation applications for implementing other services. The cache database and the business database can exist in the same server or in two different servers with a communication connection, and the embodiments of the present application are not limited to this.
[0038] In addition, it should be noted that the computer device executing the above scheme may include one or both of a terminal device and a server. When the computer device includes a terminal device, an application for implementing a data query service can be run in the computer device, and the application is developed using the principle of the data query solution provided by the embodiment of the present application. Of course, other various applications can also be run in the computer device, and the embodiment of the present application does not elaborate on this. When the computer device includes a server, the computer device can establish a communication connection with a client (or application) providing a data query service, so that the computer device can provide data computing services and data storage services for the data query service. Support services. In this case, the computer device may specifically include but is not limited to an independent physical server, a server cluster or distributed system composed of multiple physical servers, and one or more of cloud servers providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network, content distribution network), and cloud servers for basic cloud computing services such as big data and artificial intelligence platforms, etc., and the embodiment of the present application does not specifically limit this.
[0039] Based on the above description of the data query solution, the present application proposes a data query method. The method can still be executed by the above computer device, and the schematic flow chart of the data query method can be found in Figure 2 As shown. Figure 2 It can be seen that the data query method may include steps S201-S204:
[0040] S201. In response to a data query request, a data query thread is called to query target business data from a cache database, where the target business data refers to the business data to be queried by the data query request.
[0041] In one embodiment, the data query request may be generated by a computer device when a data query operation is detected, based on the query requirements of the query object that triggers the operation. Optionally, the data query request may also be generated by other devices that have a communication connection with the computer device. After the data query request is generated, the data query request may be sent to the computer device through the communication connection, so that the computer device can respond to the data query request. In a specific implementation, the data query request may include or carry description information of the business data, so that after receiving the data query request, the computer device can parse the data query request to obtain the description information, and then use the business data indicated by the description information as the target business data to be queried. Among them, exemplarily, the description information of the business data may include but is not limited to one or more of the following: data identification of the business data, data storage address of the business data, and data generation time of the business data.
[0042] In one embodiment, business data may be associated with a data object. A data object refers to a thing or individual that can be defined by one or more attributes in a business with data query requirements. In this case, the descriptive data of the one or more attributes may be regarded as a data fragment for constituting the business data associated with the data object. That is to say, in an embodiment of the present application, the target business data may be composed of one or more data fragments. It is not difficult to understand that the data units stored in the cache database and the business database may be data fragments. The descriptive data of an attribute may be used as a data fragment. When the data object is a commodity, the attributes may be commodity prices, commodity display images, commodity specifications, etc. The descriptive data of the attributes may correspond to specific commodity prices, images taken of the commodities, and specification information of the commodities.
[0043] In one embodiment, the data query request may be generated by the computer device after determining the data object, and the data object may be obtained by the computer device according to the query requirements, and the query requirements may be expressed by query keywords. For example, if you need to query the XX brand of goods on the e-commerce platform, the computer device can use the XX brand as the query keyword, and determine one or more goods under the XX brand from the goods included in the e-commerce platform as data objects, and then generate a data query request for the one or more goods, so that the computer device can query the product information of each of the one or more goods. At this time, the product information of the one or more goods is the target business data. Of course, in other embodiments, the data query request may also be generated before the data object is determined, and at this time, the data query request may contain or carry the query keyword.
[0044] S202: When the query result indicates that the target business data does not exist in the cache database, a data back-to-source lock for the target business data is generated; the data back-to-source lock is at least used to: limit the target business data in the business database to be queried by only one data query thread at the same time.
[0045] In one embodiment, the cache database is usually a non-relational database. The non-relational database supports the storage of massive data and high-concurrency efficient reading and writing, and also supports the sharding storage of business data, so that the non-relational database has the performance characteristics of easy expansion, large data volume, high performance and high availability. Therefore, using a non-relational database as a cache database can achieve a quick response to data query requests, thereby improving the efficiency of data query. Exemplarily, the non-relational database may include but is not limited to one or more of the following: a key-value storage database (such as a Redis database), a column storage database (such as an HBase database), a document database (such as MongoDB), and a graph database (such as neo4j). In addition, due to the actual application scenario, the time that business data can be stored in non-relational data is much shorter than that of a relational database. Therefore, in order to ensure the storage persistence of business data in the embodiment of the present application, the business database that can be used in the embodiment of the present application can be a relational database, so as to achieve long-term storage of business data.
[0046] It is worth mentioning that in actual applications, the cache database can be composed of a local cache database and a cloud Redis database. Among them, the local cache database is composed of business data stored in the local memory of the computer device. Exemplarily, the business data in the local cache database can be business data that is frequently queried, so that when the computer device responds to data query requests for such business data, it can directly query the relevant business data from the local memory without establishing a network connection with other devices, thereby improving the efficiency of data query to a certain extent, and further improving the QPS (Queries-per-second) upper limit of the computer device.
[0047] S203: Call the data query thread to obtain the data return source lock of the target business data, and after successful acquisition, query the target business data from the business database.
[0048] In one embodiment, the data return source lock can be managed by the business database. Then, when the computer device needs to call the data query thread to obtain the data return source lock of the target business data, it can generate a lock acquisition request and send the request to the business database, so that the business database can feedback the corresponding response result to the data query thread through the acquisition status of the data return source lock of the target business data. Among them, if the data return source lock of the target business data is in the acquired state, the response result can indicate that the acquisition of the data return source lock of the target business data has failed. Correspondingly, if the data return source lock of the target business data is in the unacquired state, the response result can include the data return source lock and indicate that the acquisition of the data return source lock of the target business data is successful. Optionally, after successfully acquiring the data return source lock, the computer device (or business database) can update the acquisition status of the data return source lock to "acquired state".
[0049] In one embodiment, when the data query thread fails to obtain the data return source lock, the request resend time can be determined so that when the request resend time is reached, the step of calling the data query service to obtain the data return source lock of the target business data is re-executed. Wherein, illustratively, the request resend time can be determined based on a preset interval duration. For example, when the computer device fails to call the data query thread to obtain the data return source lock at time A, the computer device can re-call the data query thread to obtain the data return source lock after the preset interval duration since time A. In addition, after the data query thread implements the query of the target business data from the business database, the computer device can release (or destroy) the data return source lock. After the data return source lock is released, the acquisition state of the data return source lock can be updated to "not acquired state" so that other threads (such as data update threads, data query threads of other data query requests, etc.) can obtain the data return source lock.
[0050] S204: Generate a data query result including target business data.
[0051] In one embodiment, after the computer device successfully queries the target business data from the business database, it can generate a data query result containing the target business data. Optionally, the data query result can also include other information, such as the query duration of the target business data, the storage address of the target business data in the business database, the updated version of the target business data, etc., which is not limited in this embodiment of the present application.
[0052] In an embodiment of the present application, when the computer device fails to find the target business data in the cache database, a data return lock will be generated for the target business data, and the data return lock is used to limit the target business data in the business database to be queried by only one data query thread at the same time. Specifically, the computer device needs to query the target business data from the business database after the data query thread successfully obtains the data return lock of the target business data, so that the frequency or probability of multiple data query threads querying the target business data from the business database at the same time is reduced, or in other words, the probability of the business database responding to multiple query requests for the target business data at the same time is reduced, so as to avoid a sudden increase in the resource consumption of the business database, thereby improving the stability of the business database to a certain extent.
[0053] Based on the above data query scheme and Figure 2 The data query method shown in the figure, the present application also proposes a data query method. The method can still be executed by the above-mentioned computer device, and the schematic flow chart of the data query method can be found in Figure 3 As shown. Figure 3 It can be seen that the data query method may include steps S301-S306:
[0054] S301 . In response to a data query request, a data query thread is called to query target business data from a cache database. The target business data refers to the business data to be queried by the data query request.
[0055] In one embodiment, the data query request may be generated by a computer device for a target business, and the target business may be any business with a data query demand. Among them, the specific query demands corresponding to different businesses may be different, so that after the computer device responds to the data query requests of different businesses, the target business data fed back is also different. It can be seen from the above step S201 that the target business data may be composed of one or more data fragments, and the data fragments are related to the attributes of the data object. Therefore, the query demand of the business can be expressed by the attributes of the data object, so that the business can be associated with the attributes of the data object. Then, that is to say, when the computer device responds to the data query requests of different businesses, it can obtain the final target business data by querying the description data of the attributes of the data object associated with the business.
[0056] S302: When the query result indicates that the target business data does not exist in the cache database, a data back-to-source lock for the target business data is generated; the data back-to-source lock is at least used to: limit the target business data in the business database to be queried by only one data query thread at the same time.
[0057] In one embodiment, the computer device may extend the cache expiration time of the target business data in the cache database when the query result indicates that the target business data exists in the cache database. The cache expiration time refers to the time when the target business data is deleted from the cache database. Optionally, when extending the cache expiration time of the target business data in the cache database, the computer device may first obtain the current cache expiration time, so as to extend the cache expiration time of the target business data by extending the current cache expiration time by a preset time. Since there is a data query request for the target business data, it means that there is a possibility that the target business data needs to be frequently queried. Therefore, in this case, actively extending the expiration time of the target business data in the cache database can enable the computer device to maintain a fast query of the target business data for a longer period of time, thereby improving the overall efficiency of the computer device when performing data queries.
[0058] In one embodiment, since business data can be related to data objects, in actual applications, the target business data can include business data of one or more data objects. At this time, the computer device can generate a data source return lock for the target business data in the following manner: the computer device performs request parsing on the data query request to obtain the object identifier of each data object, and then generates a data source return lock for the target business data according to the object identifier of each data object in the one or more data objects. Specifically, the computer device can first perform splicing processing on the object identifiers of the one or more data objects to obtain a splicing identifier, and then perform data encryption processing on the splicing identifier to use the encrypted data obtained by the data encryption processing as the data source return lock for the target business data. Optionally, the computer device can also perform data encryption processing on the object identifier of each data object to use the data encryption processing results of the above one or more object identifiers as the data source return lock for the target business data. Wherein, exemplarily, the encryption processing can be implemented using the MD5 information digest algorithm.
[0059] S303: Call the data query thread to obtain the data return source lock of the target business data, and after successful acquisition, query the target business data from the business database.
[0060] In one embodiment, since the data query request can be generated for the target business, the data query request can be used to instruct the computer device to query the business data of the data object under the target business. The target business data can be composed of one or more data fragments, so the computer device can determine the object identifier corresponding to the data object after successfully obtaining the data back-source lock, and then query the one or more data fragments stored in association with the object identifier under the target business from the business database, and finally obtain the target business data indicated by the data query request by combining the one or more data fragments. Among them, exemplarily, the computer device can query one or more data fragments stored in association with the object identifier from the business database in a pileline manner, and pileline means: splitting an operation that needs to be repeatedly executed (such as, when there are multiple data fragments, the operation of querying data fragments is a repeated operation) into multiple execution steps, each execution step is responsible for a different execution unit, so that multiple execution steps can be executed simultaneously. It is not difficult to understand that the time consumption when the computer device uses pileline to query one or more data fragments is almost the same as the time consumption when the computer device directly queries a data fragment, thereby improving the efficiency of data query.
[0061] In addition, it is worth mentioning that when the computer device queries the target business data from the cache database, it can also be obtained by obtaining one or more data fragments and combining the obtained data fragments. The specific implementation method can refer to the above-mentioned method of querying the target business data from the business database by the computer device, and the embodiment of the present application will not be repeated here.
[0062] S304: Generate a data query result including target business data.
[0063] In one embodiment, the relevant implementation method of step S304 can refer to the specific embodiment of the above-mentioned step S204, and the embodiment of the present application will not be repeated here.
[0064] S305: Cache the target business data into a cache database.
[0065] In one embodiment, after the computer device obtains the target business data from the business database through a back-source query, in order to facilitate the subsequent computer device to quickly respond to the data query request for the target business data and obtain the data query result containing the target business data, the computer device can store the queried target business data in the cache database. Exemplarily, when the target business data consists of one or more data fragments, the computer device can store the queried target business data in the cache database as follows: Figure 4 The process from step S401 to step S406 is shown to add the target business data to the cache database. Figure 4The segmented data in is the data fragment. Figure 4 It can be seen that after the computer device queries the corresponding segmented data from the business database, it can cache the segmented data in the cache database, thereby combining data based on the segmented data related to the target business data in the cache database to obtain the target business data that is finally fed back to the client. In addition, when caching the target business data in the cache database, the computer device can also set the cache expiration time of the target business data in the cache database, so that the data storage space in the cache database can be used flexibly.
[0066] S306: When it is detected that the cache extension condition for the target business data is met, extend the cache expiration time of the target business data; wherein the cache expiration time refers to the time when the target business data is deleted from the cache database.
[0067] In one embodiment, an exemplary flow chart of a computer device extending the cache expiration time of the target service data can be found in Figure 5 Specifically, if Figure 5 As shown in steps S501 to S504, the computer device may add the data identifier of the target business data to the renewal data queue (such as hashset) after detecting that the target business data is successfully cached in the cache database, so as to determine that the cache extension condition for the target business data is met when the number of data identifiers in the renewal data queue is equal to the identifier number threshold, or when the clearing time of the renewal data queue is reached. Optionally, the identifier number threshold may be the maximum number of data that can be stored in the renewal data queue (i.e., the length of the renewal data queue), or may be other integer values that are less than or equal to the length of the renewal data queue, and the embodiments of the present application are not limited to this. And illustratively, when the number of data identifiers in the renewal data queue of the computer device is equal to the identifier number threshold, triggering the extension of the cache expiration time of the target business data, its specific implementation principle can be referred to. Figure 6a shown.
[0068] In addition, the clearing time of the renewal data queue can be determined according to a preset period. For example, if the preset period is 24 hours, the computer device will clear the renewal data queue every 24 hours. Optionally, the clearing time of the renewal data queue can also be obtained by parsing a queue clearing request. The queue clearing request carries or contains a specified clearing time, and the queue clearing request can be generated or sent at any time. In addition, illustratively, when the computer device reaches the clearing time of the renewal data queue and triggers the extension of the cache expiration time of the target business data, the specific implementation principle can be found in Figure 6b shown.
[0069] In another embodiment, the computer device may also determine that the cache extension condition for the target business data is satisfied after determining that the target business data is hot query data. Among them, hot query data can be understood as frequently queried business data. Then, the computer device can obtain the number of data query requests initiated for the target business data within the target time period after detecting that the target business data is successfully cached in the cache database. If the number of requests is greater than or equal to the number threshold, it is determined that the target business data is frequently queried business data, thereby determining that the cache extension condition for the target business data is satisfied.
[0070] In another embodiment, the computer device may also update the target business data in the business database. When updating the target business data, in order to make the target business data in the data query result consistent with the target business data stored in the business database, the computer device needs to first obtain the data back-source lock of the target business data to avoid simultaneous data query and data update for the target business data, thereby ensuring the validity of the data query and the validity of the data update. For example, the update process of the target business data can be seen in Figure 7 Based on Figure 7 It can be seen from step S701 to step S704 that after the computer device updates the target business data, it can release the data return lock so that the target business data can be called by other threads, thereby executing other business processing for the target business data.
[0071] It is worth mentioning that when the target business data contains business data of multiple data objects, the data return source lock of the target business data is generated based on the object identifiers of multiple data objects, and in actual applications, the data update request can be initiated for the business data of a certain data object in the target business data. In other words, the data update request is used to instruct the computer device to update the business data of a data object. At this time, even if the data update thread needs to obtain the data return source lock of the corresponding business data before executing the data update, since in the embodiment of the present application, the data return source lock of the business data is generated based on the object identifier of the data object, the data return source lock that the computer device needs to obtain when updating the business data of the data object is different from the data return source lock of the target business data. Therefore, when the computer device updates the business data of the data object, it can be unaffected by the data query thread of the target business data. In this way, the data update thread for some business data in the target business data can be run in parallel with the data query thread for the target business data, thereby achieving the reduction of the impact of data update on the real-time performance of data query results while ensuring the efficiency of data query and data update.
[0072] In addition, when the computer device detects that the target business data in the business database has been updated, it can obtain the data identifier corresponding to the target business data, and then determine the first business data stored in association with the data identifier in the business database, and determine the second business data stored in association with the data identifier in the cache database. It can be understood that the first business data refers to the business data obtained after the target business data is updated, and the second business data refers to the target business data currently stored in the cache database. Then, if there is a difference between the first business data and the second business data, it means that the business data between the business database and the cache database are inconsistent. At this time, the second business data in the cache database can be updated to the first business data, so as to improve the data consistency between the business data existing in the cache database and the business data corresponding to it in the business database.
[0073] In actual applications, if there is a difference between the first business data and the second business data, it can be reasonably speculated that for the business data corresponding to the same data identifier in the cache database, the data synchronization thread between the business data corresponding to the business database and the business data corresponding to the same data identifier has an operational failure. Then, in order to ensure that the data identifier of the updated business data exists in the business database, and the corresponding business data in the cache database are all updated in the same way, the computer device can first determine the data sampling time period, and the business data updated during the data sampling time period will be used as the consistency business data that needs to be re-verified. In other words, the computer device can determine the data identifier of the business data updated during the data sampling time period from the business database (for the sake of convenience, the data identifier of such business data is called a reference data identifier) to further obtain the cached business data corresponding to each reference data identifier in the cache database, and then update each cached business data in the cache database to the business data corresponding to the corresponding reference data identifier in the business database.
[0074] Among them, the data sampling time period may include one or more sampling cycles. In each sampling cycle, the computer device will sample the data identifier of the updated business data to determine whether the computer device has the ability to accurately update the corresponding business data in the cache database based on whether there is a difference between the cache business data corresponding to the data identifier in the cache database and the business data corresponding to the data identifier in the business database, so that when the computer device does not have the ability to accurately update the corresponding business data in the cache database, the corresponding business implementation logic is adjusted in time to ensure that the data query service can query the latest target business data. Among them, when the computer device samples the data identifier of the updated business data, it can be sampled according to the preset sampling rules. The sampling rule can be such as sampling the data identifier of the Nth updated business data. Exemplarily, N is an integer multiple of M, and M can be any positive integer. Optionally, the sampling rule can also be such as: sampling the data identifier of each updated business data. In other application scenarios, the computer device can also set other types of sampling rules, which are not limited in the embodiments of the present application.
[0075] Based on the above description, in one implementation, the computer device may also perform the following steps: Figure 8 Steps S801 to S807 shown in the figure verify the consistency between the business data corresponding to the same data identifier in the cache database and the business data corresponding to the same data identifier in the business database. MySQL in step S801 and step S803 refers to a specific business database. Figure 8It can be seen that in the specific application of the embodiment of the present application, after detecting that the target business data in the business database is updated, the computer device can first determine whether the target business data is the business data that needs to be sampled according to the sampling rules. If it is the business data that needs to be sampled, the data identifier of the target business data, the data version number of the target business data in the business database, and the data version number of the target business data in the cache database are obtained. Among them, the data version number is used to indicate the updated version of the target business data, and different data version numbers represent different versions of the target business data. Then, when the acquired data version numbers are inconsistent, the computer device can determine that the business data corresponding to the data identifier of the target business data in the cache database is inconsistent with the business data corresponding to it in the business database. At this time, further, the computer device can adjust the sampling ratio or sampling range (such as: all the data identifiers of the business data that have changed within the data sampling time period are sampled) to flexibly verify the consistency of other business data. Exemplarily, the computer device can reduce the sampling ratio when the received data query requests are large, or expand the sampling ratio when the received data query requests are small, so as to realize that the device resources consumed in the process of data consistency verification have little impact on the data query process. In addition, if Fig. 9 As shown, when the target business data is the commodity data of the target commodity, if the target business data is updated, the computer device may update the classification label of the target commodity in the corresponding client.
[0076] exist Fig. 9 In the SKU, SPU (Standard Product Unit) is the smallest unit of product information aggregation. It is a set of reusable and easily searchable standardized information that describes the characteristics of a product. Then, SPU basic information can represent the characteristic information of the target product. SKU (Stock Keeping Unit) refers to a product. Each product has a corresponding SKU, which makes it easier for e-commerce brands to identify products. Then, SKU basic information can be understood as the specific model information of the target product. When the target business data is the product data of the target product, Fig. 9 Each information including the SKU basic information, SPU basic information and category information can be used as a data fragment constituting the target business data.
[0077] Based on the above description, it is not difficult to understand that since the target business data can be composed of one or more data fragments, and the target business data can be updated, then when the computer device updates the target business data in the business database, it can be to update one or more data fragments. At this time, the computer device can implement the update of the corresponding business data in the cache database in the following manner: when the computer device detects that the target business data in the business database is updated, it determines the updated update fragment from at least one data fragment of the target business data. Further, the computer device can obtain the fragment identifier of the update fragment, and determine the first data fragment stored in association with the fragment identifier in the business database, and determine the second data fragment stored in association with the fragment identifier in the cache database. If there is a difference between the first data fragment and the second data fragment, the second data fragment in the cache database is updated to the first data fragment, so that when the data volume of the target business data is huge, it can avoid the large amount of data updated by the computer device, thereby saving the resources of the computer device.
[0078] In an embodiment of the present application, when the computer device fails to query the target business data in the cache database, a data return source lock will be generated for the target business data, and the data return source lock is used to limit the target business data in the business database to be queried by only one data query thread at the same time. Specifically, the computer device needs to query the target business data from the business database after the data query thread successfully obtains the data return source lock of the target business data, so that the frequency or probability of multiple data query threads querying the target business data from the business database at the same time is reduced, or in other words, the probability of the business database responding to multiple query requests for the target business data at the same time is reduced, so as to avoid a sudden increase in the resource consumption of the business database, so that the stability of the business database can be improved to a certain extent. In addition, in an embodiment of the present application, the target business data can also be split into one or more data fragments for storage, so that when the computer device queries the target business data, it can query one or more data fragments in a pileline manner, thereby improving the efficiency of data query.
[0079] based on Figure 2 as well as Figure 3 In a related embodiment of the present application, a data query device is also provided. The device may be a computer program running on the above-mentioned computer device. In a specific embodiment, the data query device may be used to perform the following steps: Figure 3 as well as Figure 5 See the steps for the data query method shown in Fig.10The data query device at least includes a response unit 1001, a first generation unit 1002, a call unit 1003 and a second generation unit 1004. Wherein:
[0080] A response unit 1001 is used to call a data query thread to query target business data from a cache database in response to a data query request, wherein the target business data refers to business data of a data object to be queried by the data query request;
[0081] The first generating unit 1002 is used to generate a data back-to-source lock for the target business data when the query result indicates that the target business data does not exist in the cache database; the data back-to-source lock is at least used to: limit the target business data in the business database to be queried by only one data query thread at the same time;
[0082] The calling unit 1003 is used to call the data query thread to obtain the data return source lock of the target business data, and after the acquisition is successful, query the target business data from the business database;
[0083] The second generating unit 1004 is used to generate a data query result including the target business data.
[0084] In one implementation, the data query device may further include a cache renewal unit 1005, and the cache renewal unit 1005 is used to execute:
[0085] Cache the target business data in the cache database;
[0086] When it is detected that the cache extension condition for the target business data is met, the cache expiration time of the target business data is extended; wherein the cache expiration time refers to the time when the target business data is deleted from the cache database.
[0087] In yet another implementation, the cache renewal unit 1005 may also be configured to execute:
[0088] After detecting that the target service data is successfully cached in the cache database, adding the data identifier of the target service data to the renewal data queue;
[0089] When the number of data identifiers in the renewal data queue is equal to the identifier number threshold, or when the clearing time of the renewal data queue is reached, it is determined that the cache extension condition for the target service data is met.
[0090] In yet another implementation, the cache renewal unit 1005 may also be configured to execute:
[0091] within a target time period after detecting that the target business data is successfully cached in the cache database, obtaining the number of data query requests initiated for the target business data;
[0092] If the request quantity is greater than or equal to the request quantity threshold, it is determined that the cache extension condition for the target business data is met.
[0093] In yet another implementation, the first generating unit 1002 may also be configured to execute:
[0094] When the query result indicates that the target business data exists in the cache database, the cache expiration time of the target business data in the cache database is extended; wherein the cache expiration time refers to the time when the target business data is deleted from the cache database.
[0095] In yet another implementation, the target business data includes business data of one or more data objects, and the first generating unit 1002 may also be configured to execute:
[0096] Parsing the data query request to obtain an object identifier for each data object;
[0097] A data return-to-source lock for the target business data is generated according to the object identifier of each data object in the one or more data objects.
[0098] In yet another implementation, the first generating unit 1002 may also be configured to execute:
[0099] Performing concatenation processing on the object identifiers of the one or more data objects to obtain a concatenation identifier;
[0100] The splicing mark is encrypted, and the encrypted data obtained by the data encryption process is used as the data return source lock of the target business data.
[0101] In another embodiment, the data query request is used to indicate querying the service data of the data object under the target service; the calling unit 1003 can be used to execute:
[0102] After the acquisition is successful, determining the object identifier corresponding to the data object;
[0103] Querying the service database for one or more data segments stored in association with the object identifier under the target service;
[0104] The one or more data fragments are combined to obtain the target business data.
[0105] In yet another implementation, the data query apparatus may further include an updating unit 1006, and the updating unit 1006 may be configured to execute:
[0106] When it is detected that the target business data in the business database is updated, obtaining a data identifier corresponding to the target business data;
[0107] In the business database, determining first business data stored in association with the data identifier, and in the cache database, determining second business data stored in association with the data identifier;
[0108] If there is a difference between the first business data and the second business data, the second business data in the cache database is updated to the first business data.
[0109] In yet another implementation, the updating unit 1006 may also be configured to execute:
[0110] If there is a difference between the first service data and the second service data, determining a data sampling time period;
[0111] Determine a reference data identifier from the business database, and obtain cached business data corresponding to each reference data identifier in the cache database; wherein the reference data identifier refers to: a data identifier of business data updated within the data sampling time period;
[0112] Each cached business data in the cache database is updated to business data corresponding to the corresponding reference data identifier in the business database.
[0113] In yet another implementation, the target service data includes at least one data segment; the updating unit 1006 may also be configured to execute:
[0114] When it is detected that the target service data in the service database is updated, determining an updated update segment from at least one data segment of the target service data;
[0115] Acquire a segment identifier of the update segment, and determine a first data segment stored in association with the segment identifier in the service database, and determine a second data segment stored in association with the segment identifier in the cache database;
[0116] If there is a difference between the first data segment and the second data segment, the second data segment in the cache database is updated to the first data segment.
[0117] According to one embodiment of the present application, Figure 2 as well as Figure 3The various steps in the data query method shown can be Fig.10 The data query device shown in the figure is executed by each unit. For example, Figure 2 Step S201 in the data query device can be executed by the response unit 1001, step S202 can be executed by the first generation unit 1002, step S203 can be executed by the call unit 1003, and step S204 can be executed by the second generation unit 1004. Figure 3 Step S301 can be executed by the response unit 1001 in the data query device, step S302 can be executed by the first generation unit 1002 in the data query device, step S303 can be executed by the calling unit 1003 in the data query device, step S304 can be executed by the second generation unit 1004 in the data query device, and steps S305 to S306 can all be executed by the cache renewal unit 1005 in the data query device.
[0118] According to another embodiment of the present application, Fig.10 The various units in the data query device shown are divided based on logical functions, and the above-mentioned various units can be separately or all combined into one or several other units to constitute, or one (some) of the units can be further divided into multiple functionally smaller units to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. In other embodiments of the present application, the above-mentioned data query device may also include other units. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented with the assistance of multiple units.
[0119] According to another embodiment of the present application, the program can be executed on a general communication device such as the above-mentioned computer device, which includes a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 2 and Figure 3 A computer program (including program code) for each step of the method shown in FIG. Fig.10 The data query device shown in the figure is used to implement the data query method of the embodiment of the present application. The computer program can be recorded on a computer storage medium, for example, and loaded into the above-mentioned computer device through the computer storage medium and run therein.
[0120] In an embodiment of the present application, when the data query device fails to find the target business data in the cache database, a data return source lock will be generated for the target business data, and the data return source lock is used to limit the target business data in the business database to be queried by only one data query thread at the same time. Specifically, the data query device needs to query the target business data from the business database after the data query thread successfully obtains the data return source lock of the target business data, so that the frequency or probability of multiple data query threads querying the target business data from the business database at the same time is reduced, or in other words, the probability of the business database responding to multiple query requests for the target business data at the same time is reduced, so as to avoid a sudden increase in the resource consumption of the business database, thereby improving the stability of the business database to a certain extent.
[0121] Based on the relevant description of the above method embodiment and device embodiment, the present application embodiment also provides a computer device. Fig.11 . The computer device at least includes a processor 1101 and a computer storage medium 1102, and the processor 1101 and the computer storage medium 1102 are connected via a bus or other means. Among them, the computer storage medium 1102 mentioned above is a memory device in the computer device, which is used to store programs and data. It can be understood that the computer storage medium 1102 here can include both the built-in storage medium in the computer device and the extended storage medium supported by the computer device. The computer storage medium 1102 provides a storage space, which stores the operating system of the computer device. In addition, one or more computer programs suitable for being loaded and executed by the processor 1101 are also stored in the storage space. These computer programs can be one or more program codes. It should be noted that the computer storage medium here can be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage; optionally, it can also be at least one storage medium located away from the aforementioned processor. Processor 1101 (or CPU (Central Processing Unit)) is the computing core and control core of a computer device, which is suitable for implementing one or more computer programs, and is specifically suitable for loading and executing one or more computer programs to implement corresponding method flows or corresponding functions.
[0122] In one embodiment, the processor 1101 may load and execute one or more computer programs stored in the computer storage medium 1102 to implement the above-mentioned Figure 3 as well as Figure 2Corresponding method steps in the method embodiment shown. In a specific implementation, one or more computer programs in the computer storage medium 1102 can be loaded by the processor 1101 and execute the following steps:
[0123] In response to the data query request, calling the data query thread to query the target business data from the cache database, wherein the target business data refers to: the business data of the data object indicated by the data query request to be queried;
[0124] When the query result indicates that the target business data does not exist in the cache database, a data back-to-source lock for the target business data is generated; the data back-to-source lock is at least used to: limit the target business data in the business database to be queried by only one data query thread at the same time;
[0125] Call the data query thread to obtain the data return source lock of the target business data, and after successful acquisition, query the target business data from the business database;
[0126] Generate a data query result containing the target business data.
[0127] In one implementation, the processor 1101 may be configured to load and execute:
[0128] Cache the target business data in the cache database;
[0129] When it is detected that the cache extension condition for the target business data is met, the cache expiration time of the target business data is extended; wherein the cache expiration time refers to the time when the target business data is deleted from the cache database.
[0130] In yet another implementation, the processor 1101 may also be configured to load and execute:
[0131] After detecting that the target service data is successfully cached in the cache database, adding the data identifier of the target service data to the renewal data queue;
[0132] When the number of data identifiers in the renewal data queue is equal to the identifier number threshold, or when the clearing time of the renewal data queue is reached, it is determined that the cache extension condition for the target service data is met.
[0133] In yet another implementation, the processor 1101 may also be configured to load and execute:
[0134] within a target time period after detecting that the target business data is successfully cached in the cache database, obtaining the number of data query requests initiated for the target business data;
[0135] If the request quantity is greater than or equal to the request quantity threshold, it is determined that the cache extension condition for the target business data is met.
[0136] In yet another implementation, the first generating unit 1002 may also be configured to execute:
[0137] When the query result indicates that the target business data exists in the cache database, the cache expiration time of the target business data in the cache database is extended; wherein the cache expiration time refers to the time when the target business data is deleted from the cache database.
[0138] In yet another implementation, the target business data includes business data of one or more data objects, and the processor 1101 may also be configured to load and execute:
[0139] Parsing the data query request to obtain an object identifier for each data object;
[0140] A data return-to-source lock for the target business data is generated according to the object identifier of each data object in the one or more data objects.
[0141] In yet another implementation, the processor 1101 may also be configured to load and execute:
[0142] Performing concatenation processing on the object identifiers of the one or more data objects to obtain a concatenation identifier;
[0143] The splicing mark is encrypted, and the encrypted data obtained by the data encryption process is used as the data return source lock of the target business data.
[0144] In yet another implementation, the data query request is used to indicate querying business data of a data object under a target business; the processor 1101 may also be used to load and execute:
[0145] After the acquisition is successful, determining the object identifier corresponding to the data object;
[0146] Querying the service database for one or more data segments stored in association with the object identifier under the target service;
[0147] The one or more data fragments are combined to obtain the target business data.
[0148] In yet another implementation, the processor 1101 may also be configured to load and execute:
[0149] When it is detected that the target business data in the business database is updated, obtaining a data identifier corresponding to the target business data;
[0150] In the business database, determining first business data stored in association with the data identifier, and in the cache database, determining second business data stored in association with the data identifier;
[0151] If there is a difference between the first business data and the second business data, the second business data in the cache database is updated to the first business data.
[0152] In yet another implementation, the processor 1101 may also be configured to load and execute:
[0153] If there is a difference between the first service data and the second service data, determining a data sampling time period;
[0154] Determine a reference data identifier from the business database, and obtain cached business data corresponding to each reference data identifier in the cache database; wherein the reference data identifier refers to: a data identifier of business data updated within the data sampling time period;
[0155] Each cached business data in the cache database is updated to business data corresponding to the corresponding reference data identifier in the business database.
[0156] In yet another implementation, the target service data includes at least one data segment; the processor 1101 may also be configured to load and execute:
[0157] When it is detected that the target service data in the service database is updated, determining an updated update segment from at least one data segment of the target service data;
[0158] Acquire a segment identifier of the update segment, and determine a first data segment stored in association with the segment identifier in the service database, and determine a second data segment stored in association with the segment identifier in the cache database;
[0159] If there is a difference between the first data segment and the second data segment, the second data segment in the cache database is updated to the first data segment.
[0160] In an embodiment of the present application, when the computer device fails to find the target business data in the cache database, a data return lock will be generated for the target business data, and the data return lock is used to limit the target business data in the business database to be queried by only one data query thread at the same time. Specifically, the computer device needs to query the target business data from the business database after the data query thread successfully obtains the data return lock of the target business data, so that the frequency or probability of multiple data query threads querying the target business data from the business database at the same time is reduced, or in other words, the probability of the business database responding to multiple query requests for the target business data at the same time is reduced, so as to avoid a sudden increase in the resource consumption of the business database, thereby improving the stability of the business database to a certain extent.
[0161] The embodiment of the present application also provides a computer storage medium, in which one or more computer programs corresponding to the above-mentioned data query method are stored. When the processor loads and executes the one or more computer programs, the description of the data query method in the embodiment can be implemented, and the embodiment of the present application will not be repeated here. Correspondingly, the description of the beneficial effects of adopting the same method will not be repeated here. In addition, it is worth mentioning that the computer program can be deployed on one or more devices that can communicate with each other for execution.
[0162] In addition, it should be noted that according to one aspect of the embodiments of the present application, a program product or a computer program is also provided, the program product includes a computer program, and the computer program is stored in a computer storage medium. The processor in the computer device reads the computer program from the computer storage medium and then executes the computer program, thereby enabling the computer device to perform the above Figure 3 as well as Figure 2 In the relevant embodiments of the data query method shown, implementation methods are proposed for various optional modes of various aspects.
[0163] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment method can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer storage medium, and when the computer program is executed, it can include all the processes related to the above-mentioned data query method. Among them, the computer storage medium may include a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0164] In addition, it can be understood that what is disclosed above is only a partial embodiment of the present application, and it certainly cannot be used to limit the scope of rights of the present application. Ordinary technicians in this field can understand that the entire or partial process of implementing the above-mentioned embodiment and the equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data query method, characterized in that: include: In response to the data query request, calling the data query thread to query the target business data from the cache database, the target business data refers to: the business data queried by the data query request; When the query result indicates that the target business data does not exist in the cache database, generating a data back-to-source lock for the target business data; The data back-to-source lock is at least used to: limit the target business data in the business database to be queried by only one data query thread at the same time; Call the data query thread to obtain the data return source lock of the target business data, and after successful acquisition, query the target business data from the business database; Generate a data query result containing the target business data.
2. The method according to claim 1, characterized in that The method further comprises: Cache the target business data in the cache database; When it is detected that the cache extension condition for the target business data is met, the cache expiration time of the target business data is extended; wherein the cache expiration time refers to the time when the target business data is deleted from the cache database.
3. The method according to claim 2, characterized in that The method further comprises: After detecting that the target service data is successfully cached in the cache database, adding the data identifier of the target service data to the renewal data queue; When the number of data identifiers in the renewal data queue is equal to the identifier number threshold, or when the clearing time of the renewal data queue is reached, it is determined that the cache extension condition for the target service data is met.
4. The method according to claim 2, characterized in that: The method further comprises: within a target time period after detecting that the target business data is successfully cached in the cache database, obtaining the number of data query requests initiated for the target business data; If the request quantity is greater than or equal to the request quantity threshold, it is determined that the cache extension condition for the target business data is met.
5. The method according to claim 1, characterized in that The method further comprises: When the query result indicates that the target business data exists in the cache database, the cache expiration time of the target business data in the cache database is extended; wherein the cache expiration time refers to the time when the target business data is deleted from the cache database.
6. The method according to claim 1, characterized in that The target business data includes business data of one or more data objects; the step of generating a data return-to-source lock for the target business data includes: Parsing the data query request to obtain an object identifier for each data object; A data return-to-source lock for the target business data is generated according to the object identifier of each data object in the one or more data objects.
7. The method according to claim 6, characterized in that The step of generating a data source return lock for the target business data according to the object identifier of each data object in the one or more data objects includes: Performing concatenation processing on the object identifiers of the one or more data objects to obtain a concatenation identifier; The splicing mark is encrypted, and the encrypted data obtained by the data encryption process is used as the data return source lock of the target business data.
8. The method according to claim 1, characterized in that The data query request is used to indicate the query of the business data of the data object under the target business; after the acquisition is successful, querying the target business data from the business database includes: After the acquisition is successful, determining the object identifier corresponding to the data object; Querying the service database for one or more data segments stored in association with the object identifier under the target service; The one or more data fragments are combined to obtain the target business data.
9. The method according to claim 1, characterized in that: The method further comprises: When it is detected that the target business data in the business database is updated, obtaining a data identifier corresponding to the target business data; In the business database, determining first business data stored in association with the data identifier, and in the cache database, determining second business data stored in association with the data identifier; If there is a difference between the first business data and the second business data, the second business data in the cache database is updated to the first business data.
10. The method according to claim 9, characterized in that The method further comprises: If there is a difference between the first service data and the second service data, determining a data sampling time period; Determine a reference data identifier from the business database, and obtain cached business data corresponding to each reference data identifier in the cache database; wherein the reference data identifier refers to: a data identifier of business data updated within the data sampling time period; Each cached business data in the cache database is updated to business data corresponding to the corresponding reference data identifier in the business database.
11. The method according to claim 1, characterized in that: The target business data includes at least one data segment; the method further includes: When it is detected that the target service data in the service database is updated, determining an updated update segment from at least one data segment of the target service data; Acquire a segment identifier of the update segment, and determine a first data segment stored in association with the segment identifier in the service database, and determine a second data segment stored in association with the segment identifier in the cache database; If there is a difference between the first data segment and the second data segment, the second data segment in the cache database is updated to the first data segment.
12. A data query device, characterized in that: include: A response unit, configured to call a data query thread to query target business data from a cache database in response to a data query request, wherein the target business data refers to business data of a data object indicated to be queried by the data query request; A first generating unit, configured to generate a data back-to-source lock for the target business data when a query result indicates that the target business data does not exist in the cache database; The data back-to-source lock is at least used to: limit the target business data in the business database to be queried by only one data query thread at the same time; A calling unit, configured to call the data query thread to obtain a data return source lock for the target business data, and after successful acquisition, query the target business data from a business database; The second generating unit is used to generate a data query result including the target business data.
13. A computer device, characterized in that: include: A processor configured to execute one or more computer programs; A computer storage medium storing one or more computer programs, wherein the one or more computer programs are suitable for being loaded by the processor and implementing the data query method according to any one of claims 1 to 11.
14. A computer storage medium, characterized in that: The computer storage medium stores one or more computer programs, and the one or more computer programs are suitable for being loaded by a processor and implementing the data query method according to any one of claims 1-11.
