Data processing method and device applied to high-concurrency scene and electronic equipment
By prioritizing the use of local cache and in-memory databases to process configuration data, and using the access sequence of master-slave databases to process business data, the problem of database pressure in high concurrency scenarios is solved, and system performance and response speed are improved.
Patent Information
- Application Number
- CN202411722781.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-02-21
AI Technical Summary
In high concurrency scenarios, relational databases bear too much pressure, resulting in slow transactions and delayed responses, and the database pressure needs to be reduced to improve system performance.
Through a data processing method, when responding to a data acquisition request, configuration data is preferred from the local cache and in-memory database, and if it does not exist, it is read from the relational database; for business data, access to the master-slave database is adopted In order, read from the in-memory database first, if it does not exist, read from the from database, and finally read from the main database.
It reduces the reading pressure of the database, improves transaction response speed, and enhances the system's service capabilities in high concurrency scenarios.
Smart Images

Figure CN119493833A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, device and electronic device for use in high-concurrency scenarios. Background Art
[0002] When information systems are processing transactions, data reading operations are involved. If each data reading and writing operation is an operation on a relational database, the database will face increasing pressure as the transaction volume increases. When transaction peaks occur, the relational database will become the bottleneck of the information system, which may lead to problems such as slow transactions and response timeouts.
[0003] Taking the banking system as an example, third-party payment institutions connect to the banking system through a transfer agency, and the connected banking system is usually called a quick payment system (hereinafter referred to as the quick system). Due to the connection with the third-party payment institution, the quick system requires 7*24 continuous service, and the transaction volume is extremely large. When encountering special moments such as shopping festivals, the transaction volume peaks, which is usually accompanied by slow transactions and response delays. Therefore, the quick system needs to improve performance to cope with this high-concurrency scenario. Through full-link analysis, the main pressure of the quick system appears in the database, which reaches the limit of the database in high-concurrency scenarios. Therefore, it is necessary to reduce the database pressure and improve the system performance so that the system can run smoothly in high-concurrency scenarios. How to reduce database pressure has become the main problem that current information systems need to solve. Summary of the invention
[0004] In order to solve the above problems, this application provides the following technical solutions:
[0005] A data processing method applied to a high-concurrency scenario, comprising:
[0006] In response to receiving the data acquisition request, parsing the data acquisition request to obtain a parsing result;
[0007] If the parsing result indicates that configuration data is to be acquired, target configuration data corresponding to the data acquisition request is acquired based on a first data acquisition mode, wherein the first data acquisition mode indicates that configuration data is acquired in an access order of a local cache, a memory database, and a relational database, and the local cache, the memory database, and the relational database are all used to store configuration data;
[0008] If the analysis result represents the acquisition of business class data, the target business class data corresponding to the data acquisition request is acquired based on a second data acquisition mode, wherein the second data acquisition mode represents the acquisition of business class data in an access order of a slave database and a master database, and the slave database is used to synchronize the data in the master database.
[0009] Optionally, acquiring target configuration data corresponding to the data acquisition request based on the first data acquisition mode includes:
[0010] Reading data corresponding to the data acquisition request in a local cache, and if the data corresponding to the data acquisition request does not exist in the local cache, reading data corresponding to the data acquisition request in the memory database;
[0011] If the data corresponding to the data acquisition request does not exist in the memory database, reading the data corresponding to the data acquisition request in the relational database to obtain target configuration data;
[0012] The target configuration class data is synchronized to the in-memory database, and the target configuration class data is updated to the local cache.
[0013] Optionally, reading data corresponding to the data acquisition request in the local cache includes:
[0014] Determine the validity period of cached data in the local cache;
[0015] If the data in the local cache exceeds the cache data validity period, data corresponding to the data acquisition request is read from the memory database.
[0016] Optionally, it also includes:
[0017] Based on a preset data synchronization cycle, the configuration data stored in the relational database is synchronized to the in-memory database.
[0018] Optionally, the method further comprises:
[0019] When business data is written, the business data is written to the main database, and the key value corresponding to the written business data is written to the memory database, wherein the key value written to the memory database is configured with an expiration time;
[0020] Synchronize the data in the master database to the slave database;
[0021] The expiration time corresponding to the key value in the memory library is longer than the data synchronization delay between the master database and the slave database.
[0022] Optionally, acquiring target business data corresponding to the data acquisition request based on the second data acquisition mode includes:
[0023] In response to the data acquisition request, acquiring a key value of the business class data corresponding to the data acquisition request from the memory database;
[0024] If the key value is not included in the memory database, obtaining target business class data corresponding to the data acquisition request from the slave database;
[0025] If the in-memory database includes the key value, target business class data corresponding to the data acquisition request is acquired from the main database.
[0026] A data processing device applied to high-concurrency scenarios, comprising:
[0027] A parsing unit, configured to parse the data acquisition request in response to receiving the data acquisition request to obtain a parsing result;
[0028] A first acquisition unit is configured to acquire target configuration data corresponding to the data acquisition request based on a first data acquisition mode if the parsing result represents acquisition of configuration data, wherein the first data acquisition mode represents acquisition of configuration data in an access order of a local cache, a memory database, and a relational database, and the local cache, the memory database, and the relational database are all used to store configuration data;
[0029] A second acquisition unit is used to acquire target business class data corresponding to the data acquisition request based on a second data acquisition mode if the analysis result represents the acquisition of business class data, wherein the second data acquisition mode represents the acquisition of business class data in an access order of a slave database and a master database, and the slave database is used to synchronize the data in the master database.
[0030] Optionally, the first acquiring unit includes:
[0031] A first acquisition subunit is configured to read data corresponding to the data acquisition request in a local cache, and if the data corresponding to the data acquisition request does not exist in the local cache, read the data corresponding to the data acquisition request in the memory database;
[0032] A second acquisition subunit is configured to read the data corresponding to the data acquisition request from the relational database to obtain target configuration class data if the data corresponding to the data acquisition request does not exist in the memory database;
[0033] The first synchronization subunit is used to synchronize the target configuration class data to the memory database, and update the target configuration class data to the local cache.
[0034] Optionally, the device further comprises:
[0035] A first writing subunit is used to write the business class data into the main database when the business class data is written, and write the key value corresponding to the written business class data into the memory database, wherein the key value written into the memory database is configured with an expiration time;
[0036] A second synchronization subunit, used to synchronize the data in the master database to the slave database;
[0037] The expiration time corresponding to the key value in the memory library is longer than the data synchronization delay between the master database and the slave database.
[0038] An electronic device, comprising:
[0039] Memory, used to store programs;
[0040] A processor is used to execute the program, wherein the program is specifically used to implement the data processing method applied to high concurrency scenarios as described in any one of the above.
[0041] Compared with the prior art, the present application provides a data processing method, device and electronic device for high-concurrency scenarios. In response to receiving a data acquisition request, if configuration data is acquired, the target configuration data corresponding to the data acquisition request is acquired based on a first data acquisition mode, wherein the first data acquisition mode represents the acquisition of configuration data in the order of accessing the local cache, the memory database and the relational database. If business data is acquired, the target business data corresponding to the data acquisition request is acquired based on a second data acquisition mode, wherein the second data acquisition mode represents the acquisition of business data in the order of accessing the slave database and the master database. For the application of configuration data through local cache and memory database, and for the reading of business data through master-slave database, the reading pressure of the database is reduced, the transaction response speed is improved, and the system service capability in high-concurrency scenarios is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0043] Figure 1 A flowchart of a data processing method applied to a high-concurrency scenario provided in an embodiment of the present application;
[0044] Figure 2 A schematic diagram of a configuration data reading process provided in an embodiment of the present application;
[0045] Figure 3 A schematic diagram of a process of writing business data provided in an embodiment of the present application;
[0046] Figure 4 A schematic diagram of a process for reading business data provided in an embodiment of the present application;
[0047] Figure 5 A schematic diagram of the structure of a data processing device applied to a high-concurrency scenario provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0049] The terms "first" and "second" in this application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may include steps or units that are not listed.
[0050] In order to facilitate the description of the data processing method applied to high-concurrency scenarios in the embodiments of the present application, the relevant terms in the present application are now explained.
[0051] In-memory database: Compared with traditional databases that store data on disk for management, in-memory databases store data in memory and operate directly. They have higher performance and are often used as cache to improve system response speed. Common in-memory databases include Redis and others.
[0052] Relational database: refers to a database that uses a relational model to organize data. Typical relational databases include Oracle, Mysql, SQL Server, etc. The advantage is that the structure of the two-dimensional table is easy to understand, easy to use, and easy to maintain. The relational database can be easily operated using common SQL statements. The ACID property of the database greatly reduces the probability of data redundancy and data inconsistency. Relational database is an indispensable key basic software for information systems. In this article, it is referred to as database.
[0053] Master-slave deployment: refers to a deployment method of relational databases, which is an important means to improve database availability and data consistency. For high-concurrency scenarios, there is usually one master and multiple slaves. This article simplifies it to one master and two slaves. The master database is referred to as the master database, and the slave database is referred to as the slave database.
[0054] See also Figure 1 , is a flow chart of a data processing method applied to a high-concurrency scenario provided in an embodiment of the present application, the method may include the following steps:
[0055] S101. In response to receiving a data acquisition request, the data acquisition request is parsed to obtain a parsing result.
[0056] Among them, the data acquisition request can be a request to read data issued by the client. By parsing the data acquisition request and obtaining the parsing result, the data type of the request can be determined. Specific data types may include configuration data and business data, wherein configuration data refers to data with low timeliness requirements. In the corresponding business scenarios, configuration data includes business configuration and technical configuration, such as configuration parameters for processing threads, configuration parameters for business data, etc. For example, business configurations include merchant information, limit information, etc.; technical configurations include the switch of a certain function, the time for batch start and stop, etc. Business data refers to data types with large amounts of data, high timeliness requirements, and strict consistency of data in high concurrency and large transaction volume scenarios.
[0057] S102: If the analysis result indicates that configuration data is to be acquired, target configuration data corresponding to the data acquisition request is acquired based on a first data acquisition mode.
[0058] The first data acquisition mode represents the acquisition of configuration data in the order of accessing the local cache, the memory database and the relational database, and the local cache, the memory database and the relational database are all used to store configuration data. Specifically, when reading configuration data, the local cache is accessed first, then the memory database is read, and then the relational database (referred to as the database for the convenience of description in the embodiment of the present application) is read. Specifically, the acquisition of the target configuration data corresponding to the data acquisition request based on the first data acquisition mode includes: reading the data corresponding to the data acquisition request in the local cache, if the data corresponding to the data acquisition request does not exist in the local cache, reading the data corresponding to the data acquisition request in the memory database; if the data corresponding to the data acquisition request does not exist in the memory database, reading the data corresponding to the data acquisition request in the relational database to obtain the target configuration data; synchronizing the target configuration data to the memory database, and updating the target configuration data to the local cache.
[0059] Configuration data is not frequently changed, so a slight delay in the effectiveness of the change is acceptable. In this application, data is cached locally, in-memory databases, and relational databases. When the application accesses configuration data, it first accesses the local cache. If the local cache does not exist, it accesses the in-memory database and relational database. In practice, for configuration data, the local cache is accessed in most cases. Since the data is cached in the local memory of the machine where the application is located, the efficiency is the highest.
[0060] S103: If the analysis result indicates obtaining business data, obtain target business data corresponding to the data acquisition request based on the second data acquisition mode.
[0061] The second data acquisition mode represents acquiring business data in the order of accessing the slave database and the master database, and the slave database is used to synchronize the data in the master database.
[0062] In high concurrency and high transaction volume scenarios, business data not only has a large amount of data and high timeliness requirements, but also requires strict consistency of data (no dirty reads), otherwise it may bring business risks. The amount of business data is large, and it cannot be placed in the memory database all the time, because it will cause a waste of resources if it is placed in the memory database. Moreover, since there can be no dirty reads during business processing, it is also a difficult problem to ensure the consistency of the database and the memory database data. Therefore, the business data still needs to be based on the data stored in the database, so as to ensure that the data is strictly consistent and avoid business risks. In the embodiment of the present application, the master-slave database mode is adopted for reading business data. In the process of data synchronization between the master and slave databases, the relevant data in the memory database can be accessed to ensure the accuracy of data reading. Specifically, based on the master-slave synchronization capability of the database, a memory database layer is added to record the data keys that need to access the main library. When writing data, the database is written first, and then the key corresponding to this data is written to the memory database, and the expiration time of the data key in the memory database is set at the same time. In response to the data acquisition request, a key value of the business class data corresponding to the data acquisition request is acquired from the memory database; if the memory database does not include the key value, the target business class data corresponding to the data acquisition request is acquired from the slave database; if the memory database includes the key value, the target business class data corresponding to the data acquisition request is acquired from the master database.
[0063] The present application provides a data processing method for high-concurrency scenarios. In response to receiving a data acquisition request, if configuration data is acquired, the target configuration data corresponding to the data acquisition request is acquired based on a first data acquisition mode, wherein the first data acquisition mode represents the acquisition of configuration data in the order of accessing the local cache, the memory database, and the relational database. If business data is acquired, the target business data corresponding to the data acquisition request is acquired based on a second data acquisition mode, wherein the second data acquisition mode represents the acquisition of business data in the order of accessing the slave database and the master database. For the application of configuration data through local cache and memory database, and for the reading of business data through master-slave database, the reading pressure of the database is reduced, the transaction response speed is improved, and the system service capability in high-concurrency scenarios is improved.
[0064] The data processing method in the embodiment of the present application is described below in conjunction with a specific application scenario. When writing configuration data, first write it to the relational database (referred to as the database), and then write it to the memory database. For example: a new piece of data is added to the database, corresponding to three columns of the relational database: ParamID, ParamValue, Descp, where ParamID is the primary key. As shown in Table 1 below:
[0065] Table 1
[0066]
[0067] After adding the above data to the relational database, write this configuration data to the memory database. The memory database exists in the form of key / Value. Then this database corresponds to the memory database such as Redis, and selects Hash structure storage. The Key is "TansactionSwith", and the Value is Hash[ParamValue="1", Descp="Transaction switch, 1 is on, 0 is off"].
[0068] When reading configuration data, first read from the local cache. If the local cache does not have it, read from the memory database. If the memory database cannot be retrieved, read from the database. After the database data is read, synchronize the data to the memory database and update the data to the local cache. Furthermore, the validity period of the locally cached data can be set to ensure the accuracy of data acquisition. Among them, reading the data corresponding to the data acquisition request in the local cache includes: determining the validity period of the cached data of the local cache; if the data in the local cache exceeds the validity period of the cached data, reading the data corresponding to the data acquisition request in the memory database.
[0069] Set the validity period of the cached data in the local cache. The validity period of the cache can be set according to the business characteristics. The shorter the time is set, the more frequently the in-memory database is accessed; the longer the time is set, the longer the time it takes for the configuration data to take effect after the change, because the in-memory database is accessed only when the local cached data is invalid. See Figure 2 , is a flow chart of reading configuration data provided by an embodiment of the present application. Figure 2 As shown, a business request is received. If the business request is to read configuration data, the data is first read from the local cache. If the data is read, the data is returned. If the data cannot be read, the data is read from the memory database. If the data can be read, the data is refreshed to the local cache, the local cache validity period is set, and the data is returned. If the data is not read from the memory database, the data is read from the database. If the data is not read, it returns "not found". If the data is read, the data is synchronized to the memory database, and the data is refreshed to the local cache. The local cache validity period is set, and the read data is returned.
[0070] In an embodiment of the present application, for configuration data, it also includes synchronizing the configuration data stored in the relational database to the memory database based on a preset data synchronization cycle. Among them, the data synchronization processing of the preset data synchronization cycle can be performed by setting a scheduled task, that is, the configuration data in the database is regularly synchronized to the memory database to ensure the consistency of the database and the memory database data. The time of the scheduled task can be set according to the characteristics of the business. For example, from a business perspective, it is acceptable that the modified data will take effect after 2 hours, so the scheduled task can be set to execute every 2 hours. For example, according to the characteristics of the payment business and the actual business needs, the scheduled task is executed every 24 hours. In this way, the data in the memory database can be synchronized with the data in the relational database, so that accurate data can be read.
[0071] It should be noted that configuration data is accessed multiple times in a transaction. For systems with high timeliness requirements, as the number of accesses to the memory database and the database increases, the time consumed is accumulated, resulting in a higher average transaction time. Accessing the local cache is the most efficient. Data that is frequently accessed and not frequently modified is classified as configuration data, and the data is read through the above multi-level cache solution, which can effectively reduce the number of database accesses, reduce database pressure, and improve transaction response speed.
[0072] In order to maintain both read and write efficiency and ensure data consistency. In the embodiment of the present application, based on the master-slave synchronization capability of the database, a memory database layer is added to record the data key values that need to access the main library. Correspondingly, the method includes: when business class data is written, the business class data is written to the main database, and the key value corresponding to the written business class data is written to the memory database, wherein the key value written to the memory database is configured with an expiration time; the data in the main database is synchronized to the slave database; wherein the expiration time corresponding to the key value in the memory library is longer than the data synchronization delay between the main database and the slave database.
[0073] When writing data, write to the database first, then write the key value (referred to as key) corresponding to this data to the memory database, and set the expiration time of the data key in the memory database at the same time. The format written to the memory database can be combined with the data prefix (such as CSD), database name (such as DbName), table name (such as TableName), and table primary key (such as PK): CSD_DbName_TableName_PK. The expiration time needs to be slightly longer than the database master-slave synchronization delay. This delay is an empirical time. Generally, databases deployed in the same city can achieve synchronization in seconds. Figure 3 shown.
[0074] When reading business type data, first read the key representing the data from the memory database. If the key is not obtained, read it from the slave database of the database. If the key is obtained, read it from the master database. In other words, after the master-slave synchronization delay, the data is based on the data stored in the slave database. During the master-slave synchronization delay, the data is based on the data stored in the master database. Since the key written to the memory database (representing this business data) has an expiration time set, this data will be automatically deleted after the synchronization delay. See Figure 4 When reading business data, concatenate the key of the business data. If the key exists in the memory database, access the slave database and read the data. If the key does not exist, access the master database and read the data.
[0075] In summary, in order to ensure the consistency of business data, all business data is read based on the data stored in the database. At the same time, in order to reduce the pressure on the master database caused by too many read operations, we implement read-write separation based on the master-slave synchronization of the database. When accessing data within the synchronization delay, the master database is accessed, and when accessing data exceeding the synchronization delay, the slave database is accessed. This greatly reduces the read pressure on the master database and improves data reading efficiency. At the same time, as the read demand increases, the slave database can also be horizontally expanded to further improve data reading capabilities.
[0076] When the data processing method provided in the embodiment of the present application is applied to the quick payment system, the data to be accessed is first divided into two categories: configuration data and business data, and optimization measures are taken for these two types of data to improve data access efficiency. Configuration data is not frequently changed, and it is acceptable to delay the change slightly. This patent caches data to local, memory database, and database. When the application accesses configuration data, it gives priority to accessing the local cache. If the local cache does not exist, it accesses the memory database and database. In practice, for configuration data, the local cache is accessed in most cases. Since the data is cached in the local memory of the machine where the application is located, the efficiency is the highest. In addition, in the embodiment of the present application, a timed task is also used to regularly refresh the configuration data from the database to the memory database to ensure the consistency of the data over a period of time. This solution not only improves the data access efficiency, but also makes a compromise on data consistency, which is suitable for access to configuration data. Business data has strict requirements on data consistency, and data inconsistency may lead to business risks. The access to business data in this application is still based on the data in the database. Based on the master-slave deployment and read-write separation of the database, a new memory database layer is added to record which data accesses the master database and which data accesses the slave database. The keys representing the business data are cached in the memory database and an expiration time is set (greater than or equal to the master-slave synchronization delay time). When the business data key has not expired in the memory database, the master database is accessed, and after it expires, the slave database is accessed. In fact, most business data accesses will access the slave database, and only a small amount of data within the master-slave synchronization delay time will access the master database. This reduces the read pressure on the master database, improves the overall system performance, and enables the system to run smoothly during business peaks.
[0077] In the embodiment of the present application, a data processing device for high concurrency scenarios is also provided. Figure 5 , the device comprises:
[0078] The parsing unit 501 is used for parsing the data acquisition request in response to receiving the data acquisition request to obtain a parsing result;
[0079] A first acquisition unit 502 is configured to acquire target configuration data corresponding to the data acquisition request based on a first data acquisition mode if the parsing result represents acquisition of configuration data, wherein the first data acquisition mode represents acquisition of configuration data in an access order of a local cache, a memory database, and a relational database, and the local cache, the memory database, and the relational database are all used to store configuration data;
[0080] The second acquisition unit 503 is used to acquire target business class data corresponding to the data acquisition request based on a second data acquisition mode if the analysis result represents the acquisition of business class data, wherein the second data acquisition mode represents the acquisition of business class data in an access order of a slave database and a master database, and the slave database is used to synchronize the data in the master database.
[0081] Optionally, the first acquiring unit includes:
[0082] A first acquisition subunit is configured to read data corresponding to the data acquisition request in a local cache, and if the data corresponding to the data acquisition request does not exist in the local cache, read the data corresponding to the data acquisition request in the memory database;
[0083] A second acquisition subunit is configured to read the data corresponding to the data acquisition request from the relational database to obtain target configuration class data if the data corresponding to the data acquisition request does not exist in the memory database;
[0084] The first synchronization subunit is used to synchronize the target configuration class data to the memory database, and update the target configuration class data to the local cache.
[0085] Optionally, the device further comprises:
[0086] A first writing subunit is used to write the business class data into the main database when the business class data is written, and write the key value corresponding to the written business class data into the memory database, wherein the key value written into the memory database is configured with an expiration time;
[0087] A second synchronization subunit, used to synchronize the data in the master database to the slave database;
[0088] The expiration time corresponding to the key value in the memory library is longer than the data synchronization delay between the master database and the slave database.
[0089] Optionally, the first acquisition subunit is configured to:
[0090] Determine the validity period of cached data in the local cache;
[0091] If the data in the local cache exceeds the cache data validity period, data corresponding to the data acquisition request is read from the memory database.
[0092] Optionally, it also includes:
[0093] The periodic synchronization unit is used to synchronize the configuration data stored in the relational database to the memory database based on a preset data synchronization period.
[0094] Optionally, the second acquiring unit is configured to:
[0095] In response to the data acquisition request, acquiring a key value of the business class data corresponding to the data acquisition request from the memory database;
[0096] If the key value is not included in the memory database, obtaining target business class data corresponding to the data acquisition request from the slave database;
[0097] If the in-memory database includes the key value, target business class data corresponding to the data acquisition request is acquired from the main database.
[0098] Based on the foregoing embodiment, the embodiment of the present application further provides an electronic device, including:
[0099] Memory, used to store programs;
[0100] A processor is used to execute the program, wherein the program is specifically used to implement the data processing method applied to high concurrency scenarios as described in any one of the above.
[0101] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0102] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0103] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data processing method applied to high-concurrency scenarios, characterized in that: include: In response to receiving the data acquisition request, parsing the data acquisition request to obtain a parsing result; If the parsing result indicates that configuration data is to be acquired, target configuration data corresponding to the data acquisition request is acquired based on a first data acquisition mode, wherein the first data acquisition mode indicates that configuration data is acquired in an access order of a local cache, a memory database, and a relational database, and the local cache, the memory database, and the relational database are all used to store configuration data; If the analysis result represents the acquisition of business class data, the target business class data corresponding to the data acquisition request is acquired based on a second data acquisition mode, wherein the second data acquisition mode represents the acquisition of business class data in an access order of a slave database and a master database, and the slave database is used to synchronize the data in the master database.
2. The method according to claim 1, characterized in that The acquiring target configuration data corresponding to the data acquisition request based on the first data acquisition mode includes: Reading data corresponding to the data acquisition request in a local cache, and if the data corresponding to the data acquisition request does not exist in the local cache, reading data corresponding to the data acquisition request in the memory database; If the data corresponding to the data acquisition request does not exist in the memory database, reading the data corresponding to the data acquisition request in the relational database to obtain target configuration data; The target configuration class data is synchronized to the in-memory database, and the target configuration class data is updated to the local cache.
3. The method according to claim 2, characterized in that The reading of data corresponding to the data acquisition request in the local cache includes: Determine the validity period of cached data in the local cache; If the data in the local cache exceeds the cache data validity period, data corresponding to the data acquisition request is read from the memory database.
4. The method according to claim 1, characterized in that: Also includes: Based on a preset data synchronization cycle, the configuration data stored in the relational database is synchronized to the in-memory database.
5. The method according to claim 1, characterized in that The method further comprises: When business data is written, the business data is written to the main database, and the key value corresponding to the written business data is written to the memory database, wherein the key value written to the memory database is configured with an expiration time; Synchronize the data in the master database to the slave database; The expiration time corresponding to the key value in the memory library is longer than the data synchronization delay between the master database and the slave database.
6. The method according to claim 5, characterized in that The acquiring target business data corresponding to the data acquisition request based on the second data acquisition mode includes: In response to the data acquisition request, acquiring a key value of the business class data corresponding to the data acquisition request from the memory database; If the key value is not included in the memory database, obtaining target business class data corresponding to the data acquisition request from the slave database; If the in-memory database includes the key value, target business class data corresponding to the data acquisition request is acquired from the main database.
7. A data processing device applied to high-concurrency scenarios, characterized in that: include: A parsing unit, configured to parse the data acquisition request in response to receiving the data acquisition request to obtain a parsing result; A first acquisition unit is configured to acquire target configuration data corresponding to the data acquisition request based on a first data acquisition mode if the parsing result represents acquisition of configuration data, wherein the first data acquisition mode represents acquisition of configuration data in an access order of a local cache, a memory database, and a relational database, and the local cache, the memory database, and the relational database are all used to store configuration data; A second acquisition unit is used to acquire target business class data corresponding to the data acquisition request based on a second data acquisition mode if the analysis result represents the acquisition of business class data, wherein the second data acquisition mode represents the acquisition of business class data in an access order of a slave database and a master database, and the slave database is used to synchronize the data in the master database.
8. The device according to claim 7, characterized in that The first acquiring unit includes: A first acquisition subunit is configured to read data corresponding to the data acquisition request in a local cache, and if the data corresponding to the data acquisition request does not exist in the local cache, read the data corresponding to the data acquisition request in the memory database; A second acquisition subunit is configured to read the data corresponding to the data acquisition request from the relational database to obtain target configuration class data if the data corresponding to the data acquisition request does not exist in the memory database; The first synchronization subunit is used to synchronize the target configuration class data to the memory database, and update the target configuration class data to the local cache.
9. The device according to claim 7, characterized in that The device also includes: A first writing subunit is used to write the business class data into the main database when the business class data is written, and write the key value corresponding to the written business class data into the memory database, wherein the key value written into the memory database is configured with an expiration time; A second synchronization subunit, used to synchronize the data in the master database to the slave database; The expiration time corresponding to the key value in the memory library is longer than the data synchronization delay between the master database and the slave database.
10. An electronic device, characterized in that: include: Memory, used to store programs; A processor is used to execute the program, wherein the program is specifically used to implement the data processing method applied to high concurrency scenarios as described in any one of claims 1 to 6.
Citation Information
Cited By
A storage-computing integrated data scheduling system and method for high concurrency scenarios
CN120743844B