Decryption preloading method and device for encrypted data
By dynamically adjusting the preloading timing and multi-thread processing method, the encrypted objects of the database are decrypted and preloaded, which solves the problem of high cost of decrypting encrypted data in the existing technology, improves database performance, and ensures security. Automatic periodic preloading is implemented.
Patent Information
- Application Number
- CN202111600558.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-24
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2041-12-24
AI Technical Summary
When existing databases process encrypted data, the decryption operation is costly and affects system performance. Moreover, the existing preloading method mainly targets non-encrypted data and cannot be automatically and periodically performed, resulting in limited database performance.
Provides a decryption preloading method for encrypted data. By dynamically adjusting the preloading timing and using multi-thread processing, the encrypted object of the database is preloaded, the decrypted data information is obtained, and stored in the shared cache area. Specifically, during the startup and operation of the database, preloading is periodically triggered based on resource usage, determining whether the encrypted object meets the preloading conditions, and optimizing the storage of decrypted data based on the memory replacement strategy.
While ensuring database security, database performance is improved. By loading decrypted data into the shared cache in advance, disk reads during subsequent access are reduced, and the response speed and efficiency of the system are improved.
Smart Images

Figure CN114266058B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of database technology, and in particular to a decryption preloading method and device for encrypted data. Background Art
[0002] With the development of computer security, encryption is used to complete the access control function of the data in the database. Users with keys need to decrypt when accessing encrypted data. The cost of this operation is often relatively high, which greatly affects the performance of the system.
[0003] In the existing solutions, more and more data in the database is stored in a transparent encryption mode, such as tablespace transparent storage encryption and table transparent storage encryption. The pre-loading mode can be used to decrypt before use to improve system performance. However, the disadvantages of this method are: currently, the pre-loading of the database is for non-encrypted data, and there is less support for encrypted data; and pre-loading needs to be performed manually, and cannot be performed automatically and periodically.
[0004] Therefore, how to improve database performance while ensuring database security is an urgent problem that needs to be solved. Summary of the invention
[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a decryption preloading method and device for encrypted data, which solves the problem of affecting database performance while ensuring database security.
[0006] In order to achieve the above objectives, the embodiments of the present disclosure provide the following technical solutions:
[0007] In a first aspect, an embodiment of the present disclosure provides a decryption preloading method for encrypted data, which is applied to a database server, and the method includes:
[0008] Dynamically adjust the preloading timing according to the usage of database resources; the preloading timing includes: preloading during database startup and preloading during database operation;
[0009] Use multi-threaded processing to preload the encrypted objects in the database and obtain decrypted data information;
[0010] The decrypted data information is stored in a shared buffer area.
[0011] As an optional implementation of the embodiment of the present disclosure, when the preloading opportunity is preloading during the database startup process, the multi-threaded processing method is used to preload the encrypted object of the database to obtain the decrypted data information, including:
[0012] Acquire encryption object information in the database through metadata; the encryption object information includes: table space encryption information and table encryption information;
[0013] The encrypted object information is decrypted to obtain decrypted data information.
[0014] As an optional implementation of the embodiment of the present disclosure, when the preloading opportunity is preloading during the database running process, the multi-threaded processing method is used to preload the encrypted object of the database to obtain the decrypted data information, including:
[0015] Periodically obtain information about database encryption objects according to a preset time interval;
[0016] For each encrypted object, determining whether the current encrypted page has been loaded into the shared cache; each encrypted object includes at least one encrypted page;
[0017] If the current encrypted page is not loaded into the shared cache area, determine whether the preloading condition is met;
[0018] If the preloading condition is met, the encrypted object is decrypted to obtain the decrypted data information.
[0019] As an optional implementation of the embodiment of the present disclosure, the determining whether the preloading condition is met includes:
[0020] Determine whether the number of data acquisition operations on the encrypted object is greater than a preset threshold number within a first preset time; the data acquisition operations include: query, insert, update and delete;
[0021] Determine whether the usage rate of the shared cache area is less than a first preset threshold;
[0022] Determining whether the usage rate of the central processing unit is less than a second preset threshold;
[0023] It is determined whether the utilization of the disk is greater than a third preset threshold.
[0024] As an optional implementation of the embodiment of the present disclosure, before preloading the decrypted data information into the shared cache area, the method further includes:
[0025] Set the memory page replacement attribute to resident according to the memory replacement policy.
[0026] As an optional implementation of the embodiment of the present disclosure, the determining whether the current encrypted page has been loaded into the shared cache area includes:
[0027] If the current encrypted page has been loaded into the shared cache area, a preloading process is performed on the next encrypted page of the current encrypted page.
[0028] As an optional implementation of the embodiment of the present disclosure, the preloading of the encrypted object of the database by using a multi-threaded processing method includes:
[0029] The number of threads to perform decryption operations is determined based on the memory size of the encrypted object.
[0030] In a second aspect, an embodiment of the present disclosure provides a decryption preloading device for encrypted data, comprising:
[0031] An adjustment module is used to dynamically adjust the preloading timing according to the usage of database resources; the preloading timing includes: preloading during database startup and preloading during database operation;
[0032] A preloading module is used to preload the encrypted objects in the database using a multi-threaded processing method to obtain decrypted data information;
[0033] The storage module is used to store the decrypted data information in a shared cache area.
[0034] As an optional implementation of the embodiment of the present disclosure, when the preloading opportunity is preloading during the database startup process, the preloading module includes:
[0035] A first acquisition unit is used to acquire encryption object information in the database through metadata; the encryption object information includes: table space encryption information and table encryption information;
[0036] The first decryption unit is used to decrypt the encrypted object information to obtain decrypted data information.
[0037] As an optional implementation of the embodiment of the present disclosure, when the preloading opportunity is preloading during the database running process, the preloading module includes:
[0038] A second acquisition unit, used to periodically acquire information of the database encryption object according to a preset time interval;
[0039] A judging unit, used for judging, for each encrypted object, whether a current encrypted page has been loaded into the shared cache area; each encrypted object includes at least one encrypted page;
[0040] an analysis unit, for determining whether a preloading condition is satisfied if the current encrypted page is not loaded into the shared cache area;
[0041] The second decryption unit is used to decrypt the encrypted object and obtain decrypted data information if the preloading condition is met.
[0042] As an optional implementation of the embodiment of the present disclosure, the analysis unit is specifically used for:
[0043] Determine whether the number of data acquisition operations on the encrypted object is greater than a preset threshold number within a first preset time; the data acquisition operations include: query, insert, update and delete;
[0044] Determine whether the usage rate of the shared cache area is less than a first preset threshold;
[0045] Determining whether the usage rate of the central processing unit is less than a second preset threshold;
[0046] It is determined whether the utilization of the disk is greater than a third preset threshold.
[0047] As an optional implementation of the embodiment of the present disclosure, the device further includes:
[0048] A setting unit is used to set a memory page replacement attribute to be resident according to a memory replacement policy.
[0049] As an optional implementation of the embodiment of the present disclosure, the judgment unit is further configured to:
[0050] If the current encrypted page has been loaded into the shared cache area, a preloading process is performed on the next encrypted page of the current encrypted page.
[0051] As an optional implementation of the embodiment of the present disclosure, the preloading unit is specifically used for:
[0052] The number of threads to perform decryption operations is determined based on the memory size of the encrypted object.
[0053] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the decryption preloading method for encrypted data described in the first aspect or any implementation of the first aspect.
[0054] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the decryption preloading method for encrypted data described in the first aspect or any implementation of the first aspect is implemented.
[0055] The decryption preloading method for encrypted data provided by the embodiment of the present disclosure is applied to a database server. First, the preloading timing is dynamically adjusted according to the database resource usage, and then the encrypted objects of the database are preloaded using a multi-threaded processing method to obtain decrypted data information, and finally the decrypted data information is stored in a shared cache area. Since the preloading timing includes database startup process preloading and database operation process preloading, the preloading timing can be dynamically adjusted according to resource usage, and a multi-threaded processing method is used when preloading the encrypted objects of the database, and multiple encrypted objects are decrypted and preloaded at the same time, thereby improving the performance of the database. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0057] In order to more clearly illustrate the embodiments of the present invention 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0058] Figure 1 It is a flowchart of a decryption preloading method for encrypted data in one embodiment;
[0059] Figure 2 It is a flowchart of a decryption preloading method for encrypted data in another embodiment;
[0060] Figure 3 It is a flowchart of a decryption preloading method for encrypted data in another embodiment;
[0061] Figure 4 It is a schematic diagram of the structure of a decryption preloading device for encrypted data in one embodiment;
[0062] Figure 5 It is a schematic diagram of the structure of the electronic device described in the embodiment of the present disclosure. DETAILED DESCRIPTION
[0063] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0064] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0065] Relational terms such as “first” and “second” in the description and claims of the present disclosure are merely used to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0066] In the embodiments of the present disclosure, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present disclosure should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way. In addition, in the description of the embodiments of the present disclosure, unless otherwise specified, the meaning of "multiple" refers to two or more.
[0067] The overall concept of the disclosed embodiment is: while ensuring the security of the database, a decryption preloading method for encrypted objects is added to the database kernel, the loading timing is dynamically adjusted according to resource usage, two situations are supported: preloading during the database startup process and preloading during the database operation process, and it is periodically triggered during the database operation process, introducing a multi-threaded concurrent processing mechanism, and decrypting and loading multiple objects at the same time, thereby improving the performance of the database.
[0068] The present disclosure provides a decryption preloading method for encrypted data, which is applied to a database server. In this embodiment, the decryption preloading method for encrypted data includes the following steps:
[0069] S11. Dynamically adjust the preloading timing according to the usage of database resources.
[0070] The preloading opportunities include: preloading during database startup and preloading during database operation.
[0071] Specifically, preloading means loading data asynchronously before actually using it, so that when it is needed, the loaded data can be used directly. It can be understood as loading all required resources locally in advance so that resources can be directly obtained from the cache when used. Preloading uses asynchronous methods to load data, that is, using background threads to load data. The advantage of this is that it will not block the current main thread.
[0072] In addition, the determination of the preloading timing needs to ensure two points: ① The preloaded resources should not affect the user's normal operations as much as possible; ② The preloaded resources should be ensured to be available to the user as much as possible.
[0073] For example, if too many connections are established, database resources will be consumed.
[0074] S12. Preload the encrypted object of the database using a multi-threaded processing method to obtain decrypted data information.
[0075] Specifically, since the encrypted pages of different encrypted objects have different sizes and different loading times, if one thread is used to load multiple encrypted pages, some encrypted pages will take a long time to preload, while others will take a short time to preload, which can easily cause network congestion where the encrypted page data is large, thereby affecting the speed of the entire network. Therefore, using multi-threaded processing to preload encrypted objects can relieve network pressure and improve preloading performance.
[0076] For example, if the disk has 5G of encrypted data that needs to be preloaded, 5 threads can be set to decrypt the encrypted pages. The number of threads processing the decryption operation can be set according to the actual application situation and is not specifically limited here.
[0077] S13, storing the decrypted data information in a shared cache area.
[0078] Specifically, a shared cache refers to a large-capacity memory that can be accessed by different central processing units in a multi-processor computer system for inter-process communication. Features of a shared cache: A shared cache is the fastest way to share data between processes. When a process writes data to a shared memory area, all processes that share this memory area can immediately see the contents. The shared cache serves as a bridge to communicate between the various parts of the database, and all operations on data must act on the information in the buffer. Buffer management is the scheduling and management of the system buffer, including the exchange of data between the buffer and the outside world, operations on the data in it, and changes in the various attributes of the buffer.
[0079] In addition, preloading the decrypted data information into the shared cache has the following advantages: if the queried data has been read into the data cache, the data is directly obtained from the cache, avoiding reading from the physical file on the disk, thereby increasing the speed.
[0080] The decryption preloading method for encrypted data provided by the embodiment of the present disclosure is applied to a database server. First, the preloading timing is dynamically adjusted according to the database resource usage, and then the encrypted objects of the database are preloaded using a multi-threaded processing method to obtain decrypted data information, and finally the decrypted data information is stored in a shared cache area. Since the preloading timing includes database startup process preloading and database operation process preloading, the preloading timing can be dynamically adjusted according to resource usage, and a multi-threaded processing method is used when preloading the encrypted objects of the database, and multiple encrypted objects are decrypted and preloaded at the same time, thereby improving the performance of the database.
[0081] In one embodiment, Figure 1 Based on the decryption preloading method for encrypted data provided by the embodiment of the present disclosure, when the preloading opportunity is the preloading during the database startup process, refer to Figure 2 As shown, step S12 executes the following steps S1211 and S1212:
[0082] S1211. Obtain encryption object information in the database through metadata.
[0083] The encryption object information includes: tablespace encryption information and table encryption information.
[0084] Specifically, metadata refers to data that defines the data structure. Database metadata refers to data that defines the structure of various objects in the database. For example, the database name, table name, column name, user name, version name in the database, and most of the strings in the results obtained from SQL statements are metadata. The tablespace encryption information and table encryption information of the database can be obtained through metadata.
[0085] Specifically, the tablespaces and tables in the database are transparently stored and encrypted. The transparent encryption technology monitors the application's operations on files, automatically decrypts the ciphertext when opening the file, and automatically encrypts the plaintext in the memory and writes it to the storage medium when writing the file, thereby ensuring that the files on the storage medium are always in an encrypted state.
[0086] S1212. Decrypt the encrypted object information to obtain decrypted data information.
[0087] Specifically, the preloading of the encrypted object in the database is to decrypt the page corresponding to the encrypted object and load it into the shared cache area.
[0088] In one embodiment, Figure 1 Based on the decryption preloading method for encrypted data provided by the embodiment of the present disclosure, when the preloading opportunity is preloading during the database operation process, refer to Figure 3 As shown, step S12 executes the following steps S1221-S1224:
[0089] S1221. Periodically obtain information about database encryption objects according to a preset time interval.
[0090] Exemplarily, the preset time interval may be set to 4 hours or other reasonable values, which are not specifically limited here. The information of the database encryption object may be obtained by timing triggering, such as timing scanning of metadata.
[0091] S1222. For each encrypted object, determine whether the current encrypted page has been loaded into the shared cache area.
[0092] Each of the encrypted objects includes at least one encrypted page.
[0093] Specifically, the transparent storage encryption of tablespaces and tables in the database uses page storage encryption, and the unit of encryption and decryption is page. Among them, each project corresponds to a tablespace, and the database stores physical tables through tablespaces. A database example can have N tablespaces, and a tablespace can have N tables. Each tablespace consists of one or more files on the same disk, which are called data files. A data file can only belong to one tablespace.
[0094] In addition, in a relational database, a database table is a collection of two-dimensional arrays used to represent and store the relationship between data objects. It consists of vertical columns and horizontal rows.
[0095] If the current encrypted page is not loaded into the shared cache area, execute step S1223.
[0096] S1223: Determine whether the preloading condition is met.
[0097] Correspondingly, if the current encrypted page is not loaded into the shared cache area, it is determined whether the preloading condition is met.
[0098] Specifically, determining whether the currently loaded object satisfies the preloading condition is to reduce the impact of preloading on the normal operation of the application.
[0099] If the preloading condition is met, execute step S1224.
[0100] S1224. Decrypt the encrypted object to obtain decrypted data information.
[0101] Specifically, since the table space and table transparent storage encryption in the database both adopt page storage encryption, the units of encryption and decryption are pages. Therefore, the encrypted object is decrypted with the page as the object.
[0102] In one embodiment, S1223, if the current encrypted page is not loaded into the shared cache area, determining whether the preloading condition is met can be implemented in the following manner:
[0103] ① Determine whether the number of data acquisition operations on the encrypted object is greater than a preset threshold number within a first preset time; the data acquisition operations include: query, insert, update and delete;
[0104] ② Determine whether the usage rate of the shared cache area is less than a first preset threshold;
[0105] ③ Determine whether the CPU usage is less than a second preset threshold;
[0106] ④ Determine whether the disk utilization is greater than a third preset threshold.
[0107] Specifically, if the number of data acquisition operations of the encrypted object, the utilization rate of the shared cache area, the utilization rate of the central processing unit, and the utilization rate of the disk all meet preset conditions, the encrypted object is preloaded.
[0108] For example, it is determined whether the number of DML+select of the encrypted object within a period of time is greater than the specified threshold number according to the number of cores and main frequency of the central processing unit CPU. When the operating system is X86, the preset threshold number may be 300,000 times. When it is a general domestic operating system, the preset threshold number may be 30,000 times or 50,000 times. The specific value is set according to the actual situation and is not specifically limited here.
[0109] Among them, DML (Data Manipulation Language) is a programming statement used for database operations and access to objects and data in the database. It is usually a subset of database-specific programming languages. For example, in the SQL language, which is the standard in the information software industry, the three instructions INSERT, UPDATE, and DELETE are the core, representing insert (addition or creation), update (modification), and delete (destruction). In the process of system development using databases, the application program will inevitably use these instructions; and with the addition of SQL's SELECT statement, developers in Europe and the United States call these four instructions "CRUD" (a term abbreviated by the four English prefixes Create, Read, Update, and Delete); while developers in Asia who use Chinese may abbreviate them with four Chinese characters: add, check, modify, and delete.
[0110] Specifically, the basic function of a database is to manage and query data. This is followed by a large number of IO operations. In the case of massive data, more than 80% of database performance issues are related to IO. Therefore, there are generally two aspects to optimizing the I / O performance of an ORACLE database: one is to reduce processing time, and the other is to reduce waiting events.
[0111] Exemplarily, whether the number of data acquisition operations of the encrypted object is greater than 30,000 times, whether the current shared cache usage is less than 50%, whether the current CPU usage is less than 50%, and whether the current IO idle time is greater than 50%, when all the above conditions are met, the encrypted object is preloaded.
[0112] In one embodiment, before preloading the decrypted data information into the shared cache area, the method further includes: setting a memory page replacement attribute to resident according to a memory replacement policy.
[0113] Specifically, the encrypted table and tablespace are decrypted, the decrypted table and tablespace are stored in a memory buffer, and then the memory replacement attribute of the table and tablespace is set to be resident.
[0114] Among them, resident means resident in memory, and resident set is the set of pages that are resident in memory for the currently running program. If the working set reflects the properties of page access by the program during operation, which is an inherent property of the program itself, the resident set is the size of the physical page space allocated by the operating system and computer system to the application, as well as the page replacement algorithm used to decide which pages to put into memory.
[0115] In addition, the size of the resident set that the operating system can allocate when the program is running is uncertain, and the more physical pages allocated is not necessarily better. When the number of physical pages reaches a certain level, it is not meaningful to increase the size of the resident set. As long as the overall number of page faults is small and the page fault rate is low, the overall performance is high.
[0116] It can be further understood that setting the memory page replacement attribute of the decrypted data information to resident through the memory replacement strategy is to reduce the probability of the decrypted page being replaced out of the shared cache area.
[0117] In one embodiment, the determining whether the current encrypted page has been loaded into the shared cache area includes: if the current encrypted page has been loaded into the shared cache area, preloading the next encrypted page of the current encrypted page.
[0118] Specifically, for each encrypted object, it is first determined whether the current encrypted page has been loaded into the shared cache area. If the current encrypted page has been loaded into the shared cache area, the next encrypted page of the current encrypted page is preloaded.
[0119] Further, it is determined whether all pages included in the current encrypted object have been loaded into the shared cache area. If every page of the current encrypted object has been loaded into the shared cache area, the encrypted page of the next encrypted object is preloaded.
[0120] In one embodiment, the preloading of the encrypted object of the database by using a multi-threaded processing method includes: determining the number of threads for performing the decryption operation according to the memory size of the encrypted object.
[0121] For example, if the disk has 20G of encrypted data that needs to be preloaded, 10 threads can be set to decrypt the encrypted pages. The number of threads processing the decryption operation can be set according to the actual application situation and is not specifically limited here.
[0122] In order to improve the performance of preloading, a multi-threaded concurrent mechanism is introduced, and the encrypted objects in the database are preloaded using a multi-threaded processing method, processing multiple encrypted objects at the same time.
[0123] The decryption preloading method for encrypted data provided by the embodiment of the present disclosure is applied to a database server. First, the preloading timing is dynamically adjusted according to the database resource usage, and then the encrypted objects of the database are preloaded using a multi-threaded processing method to obtain decrypted data information, and finally the decrypted data information is stored in a shared cache area. Since the preloading timing includes database startup process preloading and database operation process preloading, the preloading timing can be dynamically adjusted according to resource usage, and a multi-threaded processing method is used when preloading the encrypted objects of the database, and multiple encrypted objects are decrypted and preloaded at the same time, thereby improving the performance of the database.
[0124] It should be understood that although Figure 1-3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-3 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0125] In one embodiment, Figure 4 As shown, the decryption preloading device for encrypted data includes:
[0126] The adjustment module 410 is used to dynamically adjust the preloading timing according to the usage of database resources; the preloading timing includes: preloading during database startup and preloading during database operation;
[0127] The preloading module 420 is used to preload the encrypted object of the database by using a multi-threaded processing method to obtain decrypted data information;
[0128] The storage module 430 is used to store the decrypted data information in a shared cache area.
[0129] As an optional implementation of the embodiment of the present disclosure, when the preloading opportunity is preloading during the database startup process, the preloading module 420 includes:
[0130] A first acquisition unit is used to acquire encryption object information in the database through metadata; the encryption object information includes: table space encryption information and table encryption information;
[0131] The first decryption unit is used to decrypt the encrypted object information to obtain decrypted data information.
[0132] As an optional implementation of the embodiment of the present disclosure, when the preloading opportunity is preloading during the database running process, the preloading module 420 includes:
[0133] A second acquisition unit, used to periodically acquire information of the database encryption object according to a preset time interval;
[0134] A judging unit, used for judging, for each encrypted object, whether a current encrypted page has been loaded into the shared cache area; each encrypted object includes at least one encrypted page;
[0135] an analysis unit, for determining whether a preloading condition is satisfied if the current encrypted page is not loaded into the shared cache area;
[0136] The second decryption unit is used to decrypt the encrypted object and obtain decrypted data information if the preloading condition is met.
[0137] As an optional implementation of the embodiment of the present disclosure, the analysis unit is specifically used for:
[0138] Determine whether the number of data acquisition operations on the encrypted object is greater than a preset threshold number within a first preset time; the data acquisition operations include: query, insert, update and delete;
[0139] Determine whether the usage rate of the shared cache area is less than a first preset threshold;
[0140] Determining whether the usage rate of the central processing unit is less than a second preset threshold;
[0141] It is determined whether the utilization of the disk is greater than a third preset threshold.
[0142] As an optional implementation of the embodiment of the present disclosure, the device further includes:
[0143] A setting unit is used to set a memory page replacement attribute to be resident according to a memory replacement policy.
[0144] As an optional implementation of the embodiment of the present disclosure, the judgment unit is further configured to:
[0145] If the current encrypted page has been loaded into the shared cache area, a preloading process is performed on the next encrypted page of the current encrypted page.
[0146] As an optional implementation of the embodiment of the present disclosure, the preloading unit is specifically used for:
[0147] The number of threads to perform decryption operations is determined based on the memory size of the encrypted object.
[0148] The decryption preloading device for encrypted data provided by the embodiment of the present disclosure is applied to a database server. First, the preloading timing is dynamically adjusted according to the database resource usage, and then the encrypted object of the database is preloaded using a multi-threaded processing method to obtain the decrypted data information, and finally the decrypted data information is stored in a shared cache area. Since the preloading timing includes the database startup process preloading and the database operation process preloading, the preloading timing can be dynamically adjusted according to the resource usage, and a multi-threaded processing method is used when preloading the encrypted object of the database, and multiple encrypted objects are decrypted and preloaded at the same time, thereby improving the performance of the database.
[0149] The present disclosure also provides an electronic device, Figure 5 This is a schematic diagram of the structure of an electronic device for decryption preloading of encrypted data provided by an embodiment of the present disclosure. Figure 5 As shown, the electronic device for decryption preloading of encrypted data provided in this embodiment includes: a memory 51 and a processor 52, the memory 51 is used to store computer programs; the processor 52 is used to execute the steps performed in any embodiment of the decryption preloading method for encrypted data provided in the above method embodiment when calling the computer program.
[0150] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.
[0151] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps performed by any embodiment of the decryption preloading method for encrypted data provided in the above method embodiment are implemented.
[0152] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0153] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0154] Computer readable media include permanent and non-permanent, removable and non-removable storage media. Storage media can be implemented by any method or technology to store information, and the information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0155] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0156] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. 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 disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A decryption preloading method for encrypted data, characterized in that: The method comprises: Dynamically adjust the preloading timing according to the usage of database resources; the preloading timing includes: preloading during database startup and preloading during database operation; Use multi-threaded processing to preload the encrypted objects in the database and obtain decrypted data information; Storing the decrypted data information in a shared buffer area; When the preloading opportunity is preloading during the database startup process, the multi-threaded processing method is used to preload the encrypted object of the database to obtain the decrypted data information, including: Acquire encryption object information in the database through metadata; the encryption object information includes: table space encryption information and table encryption information; Decrypting the encrypted object information to obtain decrypted data information; When the preloading opportunity is preloading during the database operation process, the multi-threaded processing method is used to preload the encrypted object of the database to obtain the decrypted data information, including: Periodically obtain information about database encryption objects according to a preset time interval; For each encrypted object, determining whether the current encrypted page has been loaded into the shared cache; each encrypted object includes at least one encrypted page; If the current encrypted page is not loaded into the shared cache area, determine whether the preloading condition is met; If the preloading condition is met, the encrypted object is decrypted to obtain the decrypted data information.
2. The method according to claim 1, characterized in that: The determining whether the preloading condition is met includes: Determine whether the number of data acquisition operations on the encrypted object is greater than a preset threshold number within a first preset time; the data acquisition operations include: query, insert, update and delete; and; Determine whether the usage rate of the shared cache area is less than a first preset threshold; and; Determining whether the usage rate of the central processing unit is less than a second preset threshold; and; It is determined whether the utilization of the disk is greater than a third preset threshold.
3. The method according to claim 1, characterized in that: Before preloading the decrypted data information into the shared cache area, the method further includes: Set the memory page replacement attribute to resident according to the memory replacement policy.
4. The method according to claim 1, characterized in that: The step of determining whether the current encrypted page has been loaded into the shared cache area includes: If the current encrypted page has been loaded into the shared cache area, a preloading process is performed on the next encrypted page of the current encrypted page.
5. The method according to claim 1, characterized in that The method of preloading the encrypted object of the database by using a multi-threaded processing method includes: The number of threads to perform decryption operations is determined based on the memory size of the encrypted object.
6. A decryption preloading device for encrypted data, characterized in that: include: An adjustment module is used to dynamically adjust the preloading timing according to the usage of database resources; The preloading opportunities include: preloading during database startup and preloading during database operation; A preloading module is used to preload the encrypted objects in the database using a multi-threaded processing method to obtain decrypted data information; A storage module, used for storing the decrypted data information in a shared cache area; When the preloading opportunity is preloading during the database startup process, the preloading module is specifically used to: Acquire encryption object information in the database through metadata; the encryption object information includes: table space encryption information and table encryption information; Decrypting the encrypted object information to obtain decrypted data information; When the preloading opportunity is preloading during the database running process, the preloading module is specifically used for: Periodically obtain information about database encryption objects according to a preset time interval; For each encrypted object, determining whether the current encrypted page has been loaded into the shared cache; each encrypted object includes at least one encrypted page; If the current encrypted page is not loaded into the shared cache area, determine whether the preloading condition is met; If the preloading condition is met, the encrypted object is decrypted to obtain the decrypted data information.
7. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the decryption preloading method for encrypted data according to any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the decryption preloading method for encrypted data as described in any one of claims 1 to 5 is implemented.
