Data processing method and device, equipment and storage medium
By intercepting the read request of the business process and obtaining file blocks from other instance caches, the problem of long loading time of dictionary files in the cloud native microservice architecture is solved, improving the efficiency of version upgrades and reducing costs.
Patent Information
- Application Number
- CN202410832329.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-10-01
AI Technical Summary
In the cloud-native microservice architecture, when upgrading program versions, loading large dictionary files consumes a lot of time, resulting in low efficiency. Existing solutions such as data seeding services and cloud disk technology have problems with high access costs or large bandwidth consumption.
Intercept the read request of the dictionary file by the business process, obtain the file blocks from the cache of other instances, and return them to the target process to avoid loading directly from the disk and improve the file loading speed.
It improves file reading efficiency, reduces disk load, reduces version upgrade time, and avoids high bandwidth costs.
Smart Images

Figure CN118733540A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to technical fields such as cloud computing, data processing, and information flow communication. Background Art
[0002] Efficiency is a prominent feature of the cloud-native microservice architecture, and version upgrade is an important part of the cloud-native microservice architecture. When upgrading the program version, you need to update the business program version on the machine and then restart the process. If the process restart speed is very slow, it will affect the efficiency of the version upgrade. For services with large dictionaries, the dictionary files are stored on the machine's disk. When the program is restarted, several gigabytes (GB) or even tens of GB of dictionary files need to be loaded from the disk, while the disk throughput is generally only tens of megabytes (MB), resulting in a lot of time consumption. Summary of the invention
[0003] The present disclosure provides a data processing method, apparatus, device and storage medium.
[0004] According to a first aspect of the present disclosure, there is provided a data processing method, comprising:
[0005] In response to detecting a read operation initiated by the business process of the first instance, intercepting the read operation, where the read operation is used to instruct to read a target file of the first instance;
[0006] At least M file blocks of the target file are obtained from the cache of the second instance, where the target file includes N file blocks, where N is an integer not less than 2, and the M file blocks are any M file blocks among the N file blocks, where M≤N;
[0007] Return M file blocks from the second instance to the target process of the first instance.
[0008] According to a second aspect of the present disclosure, there is provided a data processing device, comprising:
[0009] An interception module, configured to intercept a read operation initiated by a business process of the first instance in response to detecting the read operation, wherein the read operation is used to indicate reading a target file of the first instance;
[0010] A first acquisition module is used to acquire M file blocks of a target file from at least the cache of the second instance, where the target file includes N file blocks, N is an integer not less than 2, and the M file blocks are any M file blocks among the N file blocks, M≤N;
[0011] The return module is used to return M file blocks from the second instance to the target process of the first instance.
[0012] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0013] at least one processor;
[0014] a memory communicatively coupled to the at least one processor;
[0015] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any embodiment of the present disclosure.
[0016] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to implement the method according to any embodiment of the present disclosure when executed by a computer.
[0017] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program stored on a storage medium, and when the computer program is executed by a processor, the method according to any embodiment of the present disclosure is implemented.
[0018] According to the solution disclosed in the present invention, the efficiency of file reading can be improved, thereby helping to improve the efficiency of version upgrading.
[0019] The above summary is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features of the present application will be readily apparent by reference to the accompanying drawings and the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments disclosed in the present application and should not be regarded as limiting the scope of the present application.
[0021] Figure 1 is a flowchart of a data processing method according to an embodiment of the present disclosure;
[0022] Figure 2 is a comparative schematic diagram of direct reading of a business process and indirect reading of a business process according to an embodiment of the present disclosure;
[0023] Figure 3 is a comparative schematic diagram of changes in the files pointed to by soft links according to an embodiment of the present disclosure;
[0024] Figure 4 is a schematic diagram of calculating a global checksum according to an embodiment of the present disclosure;
[0025] Figure 5 is a schematic diagram of determining the location of a file block according to an embodiment of the present disclosure;
[0026] Figure 6 is a structural schematic diagram of a data processing device according to an embodiment of the present disclosure;
[0027] Figure 7 is a scenario schematic diagram of a data processing method according to an embodiment of the present disclosure;
[0028] Figure 8 It is a schematic diagram of the structure of an electronic device used to implement the data processing method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0029] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0030] The terms "first", "second", and "third", etc. in the specification embodiments and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, including a series of steps or units. The method, system, product, or device is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0031] In the related art, the following solutions are usually used to solve the problem of consuming a lot of time when upgrading the program version:
[0032] Option 1:
[0033] Step 1: Modify the dictionary to provide seeding services. For each dictionary, in addition to producing the dictionary file itself, it also produces the dictionary file's meta information.
[0034] Step 2: At the service (Paas) level, modify the configuration of each dictionary, change the original need to download the dictionary file to download the dictionary file meta, and save the meta file in the new specified directory;
[0035] Step 3: Modify the business restart command and the reload command of each dictionary. Taking the restart command as an example, some preparation work needs to be done first, and then the business process is started to intercept the business process's request to read the dictionary. After intercepting the request, the agent service in other instances will be requested. Here, meta refers to a very small text file that contains the dictionary file address. Seeding Service refers to the behavior of users (called "seeds" or "seeders") in file sharing networks to provide complete file resources for other users to download.
[0036] Option 2:
[0037] Using cloud disk technology, after the instance is connected to the cloud disk, the original operation of reading the dictionary file becomes reading data from the network, thus avoiding the limitation of network bandwidth.
[0038] The above solution has the following problems:
[0039] For Solution 1, a lot of transformation is required when the business side accesses Solution 1, including data seeding service and PaaS service. For services containing a large number of dictionaries, the access cost is very high.
[0040] For Solution 2: Using cloud disks will consume a lot of bandwidth costs, and cloud disk service providers will limit bandwidth usage, or you must pay higher fees to use faster acceleration services. This means that you need to pay more fees to achieve the same acceleration effect.
[0041] In order to at least partially solve one or more of the above problems and other potential problems, the present disclosure proposes a data processing method, which intercepts the read request initiated by the business process to the dictionary file and forwards the read request to the target process (also called a special process, denoted as dict-agent). After receiving the read request, the dict-agent obtains data from the dict-agent in other instances and then returns it to the business process, which helps to read the dictionary file efficiently, improve the loading speed of the dictionary file, and thus improve the efficiency of version upgrade.
[0042] An embodiment of the present disclosure provides a data processing method. Figure 1: is a flow chart of a data processing method according to an embodiment of the present disclosure, and the data processing method can be applied to a data processing device. The data processing device is located in an electronic device. The electronic device includes but is not limited to a fixed device and / or a mobile device. For example, a fixed device includes but is not limited to a server, and the server can be a cloud server or an ordinary server. For example, a mobile device includes but is not limited to a mobile phone, a tablet computer, a laptop computer, a wearable device, etc. In some possible implementations, the data processing method can also be implemented by a processor calling a computer-readable instruction stored in a memory. Figure 1 As shown, the data processing method includes:
[0043] S101: In response to detecting a read operation initiated by a business process of a first instance, intercepting the read operation, where the read operation is used to instruct to read a target file of the first instance;
[0044] S102: obtaining at least M file blocks of a target file from the cache of the second instance, where the target file includes N file blocks, where N is an integer not less than 2, and the M file blocks are any M file blocks among the N file blocks, where M≤N;
[0045] S103: Return M file blocks from the second instance to the target process of the first instance.
[0046] In some embodiments, multiple instances can be deployed on a machine. An instance can be understood as a deployment package, and the instance contains multiple processes and dictionary files required by the processes. The first instance is any instance deployed on a machine. Each instance has its own business process, special process and dictionary file. Specifically, the business process is the process of the main application or service running in the instance. The business process is used to process business logic, interact with external systems, and complete tasks requested by users; the business process is the core of the instance, and the business process determines the main functions and behaviors of the instance. Special processes assist the operation of business processes. Special processes may perform specific tasks such as logging, monitoring, performance measurement or data backup; special processes can provide additional functions or enhance the performance and stability of business processes. Dictionary files usually contain a set of vocabulary, terminology or data definitions to support the operation of business processes; dictionary files may contain translations, metadata, classifications or other business-related data; dictionary files are crucial to ensuring the correctness and consistency of business processes because dictionary files provide necessary information and references.
[0047] Here, in the case where multiple instances share the same machine, it is very important to ensure that each instance has its own business processes, specialized processes, and dictionary files. This helps avoid conflicts and interference between different instances and ensures that each instance can run independently and correctly.
[0048] In some implementations, the read operation is used to indicate reading a target file of the first instance. The interception of the read operation may include: intercepting the read operation through a target process (dict-agent) of the first instance. Here, the target process is a dedicated process of the first instance.
[0049] In some embodiments, the target file refers to the dictionary file of the first instance. The dictionary file is a special file format, which is mainly used to store vocabulary and related explanations, definitions or translations. "Dic file" is a common dictionary file format, which consists of a number of word units, each of which contains a word and explanation information. Here, the dictionary file includes multiple file blocks.
[0050] In some embodiments, the file block refers to a data file required by a business process that is divided into smaller, independent, and manageable data units. This segmentation method is often used to improve data processing efficiency and realize parallel reading or distributed storage. File blocks divide a large dictionary file into multiple smaller data fragments of equal or unequal lengths. Each file block contains a portion of the contents of the dictionary file and is independent and can be processed or transmitted separately.
[0051] The characteristics of this file block are:
[0052] 1. Independence: Each file block is independent and can be read, written, transmitted or stored separately.
[0053] 2. Manageability: By dividing large files into multiple small file blocks, management and maintenance can be more convenient, improving data processing efficiency.
[0054] 3. Parallel processing: Multiple file blocks can be read and processed by different processes or systems at the same time, thus achieving parallel computing and data processing.
[0055] 4. Distributed storage: In a distributed system, file blocks can be stored in different nodes, thereby improving data reliability and scalability.
[0056] In some embodiments, the second instance is another instance deployed on the same machine as the first instance. Exemplarily, the first instance and the second instance are deployed on the same machine. There are three instances on a machine (computer A), and each of the three instances has a corresponding dictionary file, for example, dictionary file-1 corresponding to instance-a, dictionary file-2 corresponding to instance-b, and dictionary file-3 corresponding to instance-c. The dictionary file of each instance can be part of the installation package of the corresponding instance, and the dictionary file can be dynamically updated.
[0057] In some embodiments, the system may set up a file monitoring module, which is responsible for monitoring the read operations of all business processes. When a read request is detected, the module intercepts the request and obtains the identification information of the target file (such as the file name, path, etc.). After intercepting the read operation, the system does not directly read the target file from the disk of the first instance, but attempts to obtain the file blocks of the target file from the cache of the second instance. Here, it is assumed that the second instance is an entity with cache capability that communicates with the first instance. The system first determines the number of file blocks N contained in the target file (which can be obtained through file metadata or file system information). Then, the system selects M file blocks from N file blocks for reading according to a certain strategy (such as random selection, selection based on access frequency, etc.). Here, M is an integer less than or equal to N, indicating the number of file blocks read from the cache. In order to achieve this step, the system needs to maintain a communication channel with the second instance in order to send a read request and receive the returned file blocks. At the same time, the system also needs a cache management module to manage the file blocks received from the second instance and ensure their consistency with the original target file. After successfully acquiring M file blocks from the cache of the second instance, the system returns these file blocks to the target process of the first instance. These file blocks can be part of the data directly used to satisfy the read request. The system needs to perform necessary processing (such as decryption, decompression, format conversion, etc.) on the received file blocks to ensure that they can be correctly identified and used by the target process of the first instance. Then, the system returns these processed file blocks to the target process through an API or other means.
[0058] In some implementations, since the system can flexibly select the number of file blocks to be read from the cache (i.e., the value of M), it can be dynamically adjusted according to actual needs. For example, when the read request is small or the cache resources are limited, the value of M can be reduced to save cache resources; when the read request is large or the cache resources are sufficient, the value of M can be increased to improve the reading efficiency.
[0059] In some implementations, the target process is a dedicated process.
[0060] Figure 2 A comparison diagram of direct reading by a business process and indirect reading by a business process is shown. Figure 2 As shown, the prior art uses the business process to directly read the dictionary file on the disk. However, this solution uses the business process to indirectly read the dictionary file on the disk. Specifically, when the business process initiates a read operation on the dictionary file, the read operation is intercepted and the read request is forwarded to the dict-agent. After receiving the request, the dict-agent obtains the data from the dict-agent in other instances in the computer room, and then returns it to the business process.
[0061] The technical solution of the disclosed embodiment intercepts the read operation in response to detecting a read operation initiated by the business process of the first instance, the read operation is used to indicate reading the target file of the first instance; at least M file blocks of the target file are obtained from the cache of the second instance; and the M file blocks from the second instance are returned to the target process of the first instance. In this way, the read request of the business process can be satisfied without directly accessing the disk, thereby improving the efficiency of file reading. At the same time, since the cache capacity of the second instance is utilized, the load pressure of the disk can be reduced, the dictionary file loading speed can be increased, and the efficiency of version upgrade can be improved.
[0062] In the embodiment of the present disclosure, the data processing method may also include: when M is less than N, obtaining NM file blocks from the cache of the first instance, and returning NM file blocks to the target process, wherein the NM file blocks are file blocks other than the M file blocks of the N file blocks.
[0063] In some embodiments, if machine B is deployed with a first instance and a second instance, the target files of the first instance and the second instance are stored on their respective disks, and the target file of the first instance is a file containing 10 file blocks (N=10) (denoted as blocks 1 to 10); then the business process of the first instance initiates a read operation, requesting to read the target file; intercepting the read operation; obtaining file blocks from the cache of the second instance: blocks 3, 5, 7, and 9 of the target file are stored in the disk of the second instance (a total of 4 file blocks, i.e., M=4); obtaining four file blocks from the cache of the second instance; returning four file blocks (blocks 3, 5, 7, and 9) to the target process of the first instance, obtaining six file blocks from the cache of the first instance, and returning six file blocks (blocks 1, 2, 4, 6, 8, and 10) to the target process of the first instance.
[0064] The technical solution of the disclosed embodiment can efficiently meet the demand for reading the target file by acquiring NM file blocks from the cache of the first instance, thereby improving the efficiency and flexibility of data processing.
[0065] In the embodiment of the present disclosure, the data processing method may further include: determining at least one second instance from other instances located in the same device as the first instance.
[0066] In some implementations, determining at least one second instance from other instances located on the same first device as the first instance includes: determining all instances in the other instances located on the same first device as the first instance as second instances.
[0067] In some embodiments, determining at least one second instance from other instances located on the same first device as the first instance includes: randomly selecting several instances from other instances located on the same first device as the first instance as the second instances.
[0068] In some embodiments, if machine B is deployed with a first instance and a second instance, the target files of the first instance and the second instance are stored on their respective disks, and the target file of the first instance is a file containing 10 file blocks (N=10) (recorded as blocks 1 to 10); then the business process of the first instance initiates a read operation to request to read the target file; intercept the read operation; determine at least one second instance from other instances located on the same device as the first instance; obtain file blocks from the cache of the second instance: the second instance disk stores blocks 3, 5, 7, and 9 of the target file (a total of 4 file blocks, i.e., M=4); obtain four file blocks from the cache of the second instance; return four file blocks (blocks 3, 5, 7, and 9) to the target process of the first instance. It should be noted that the second instance and the first instance are located on the same machine, and the disk in the second instance stores file blocks of the target file.
[0069] The technical solution of the embodiment of the present disclosure determines at least one second instance from other instances located in the same device as the first instance. In this way, when data is transmitted within the same device, the internal bandwidth of the device can be fully utilized, avoiding bandwidth bottlenecks that may be encountered when crossing devices or networks, and ensuring that large amounts of data can be transmitted quickly and efficiently when needed.
[0070] In the embodiment of the present disclosure, the data processing method may further include: when the target file exists on an instance located on a different device from the first instance, determining at least one instance where the target file exists as a second instance.
[0071] In some implementations, if machine-1 is deployed with instance-a and instance-c, and the target file does not exist in instance-c; machine-2 is deployed with instance-d and instance-b, then instance-a of machine-1 initiates a read operation to read a target file named report.docx; the read operation is intercepted; other instances deployed on machine-1 except instance-a are traversed, and the target file is not found; the search range is expanded, other nearby machines are traversed, and the target file report.docx is found in instance-b deployed on machine-2; the file block is obtained from the disk of instance-b; and the file block is returned to the target process of instance-a.
[0072] The technical solution of the embodiment of the present disclosure is that when the target file exists on an instance located on a different device from the first instance, at least one instance where the target file exists is determined as the second instance. In this way, when the target file is stored on multiple devices in a dispersed manner, the system load can be balanced by obtaining file blocks from instances on non-local devices, which can help prevent overload of a single device or network link and improve the performance of the overall system.
[0073] In the disclosed embodiment, the data processing method may further include: determining a file block identifier allocated to the second instance according to the number of file blocks included in the target file, so that the second instance reads the corresponding file block based on the file block identifier.
[0074] In some embodiments, a file block identifier refers to a mark or information used to uniquely identify a file block in a file system. The file block identifier enables the system to accurately locate a specific file block, whether for reading, writing, or other operations. The target file is usually divided into multiple file blocks and stored on multiple nodes. These file blocks are uniquely identified and managed on the disk by the file block identifier. The location, status, and other related information of the file block are tracked and managed based on the file block identifier to ensure data consistency and reliability.
[0075] The technical solution of the embodiment of the present disclosure determines the file block identifier assigned to the second instance according to the number of file blocks included in the target file, so that the second instance reads the corresponding file block based on the file block identifier. In this way, the specific location where the target file is stored can be directly located through the file block identifier, avoiding unnecessary searching and traversing on multiple instances or nodes, thereby significantly improving the efficiency of file access.
[0076] In the disclosed embodiment, the data processing method may further include: before the first instance or the second instance reads the corresponding file block, if it is detected that the file path pointed to by the soft link of the target file has changed, the file content of the target file is read from the local disk, and the latest version of the global file identifier of the soft link is generated based on the file content; the identifier of the soft link of the target file is changed to the latest version of the global file identifier.
[0077] Before the first instance or the second instance reads the corresponding file block, if it is detected that the file path pointed to by the soft link of the target file has changed, the following steps can be performed:
[0078] 1. dict-agent detects that the business process wants to read a file (soft link);
[0079] 2. If the file path pointed to by the soft link has changed, it means that the file version has been upgraded;
[0080] 3. If the file version is upgraded, the file content is read from the local disk and returned; at the same time, when reading the file content, the checksum of each file block is recorded;
[0081] 4. After the file is read, concatenate the checksums of all file blocks, calculate another checksum for these checksums, and finally get the global file identifier: soft link name + checksum of the corresponding version.
[0082] Figure 3 A comparison diagram of soft link pointing to files is shown, Figure 3 As shown, the file path pointed to by the soft link of business instance 1 has changed, so the file content is read from the local disk and returned; at the same time, when reading the file content, the checksum of each file block is recorded. Since the latest version of the file of business instance 1 has been downloaded, the file path pointed to by the soft link has changed from the global file identifier 1 of the previous version (denoted as dict-a.v1) to the global file identifier 2 of the latest version (denoted as dict-a.v2). The file path pointed to by the soft link of business instance 2 has not changed. Since the latest version of the file of business instance 2 has not been downloaded, the file path pointed to by the soft link still points to the global file identifier 1 of the previous version (denoted as dict-a.v1).
[0083] The technical solution of the embodiment of the present disclosure is that before the first instance or the second instance reads the corresponding file block, if it is detected that the file path pointed to by the soft link of the target file has changed, the file content of the target file is read from the local disk, and the latest version of the global file identifier of the soft link is generated based on the file content; the identifier of the soft link of the target file is changed to the latest version of the global file identifier. In this way, by reading the file content and generating a new global file identifier, it can be ensured that the soft link still points to the correct file content, thereby maintaining data consistency.
[0084] In an embodiment of the present disclosure, the latest version of the global file identifier of the soft link is generated based on the file content, including: dividing the file content into multiple file blocks; calculating a checksum for each file block, the checksum is used to verify the integrity of the file block; splicing the checksums of all file blocks into a text according to a preset order; determining a global checksum based on the spliced text, the global checksum is used to uniquely identify the entire file; and generating the latest version of the global file identifier based on the global checksum.
[0085] In some implementations, if you want to share files between different instances, you must ensure that the file contents are the same. However, because the version of the dictionary file is constantly updated, you must find a way to ensure the uniformity of the file identifier. Specifically, suppose there is a dictionary file (named dict-a), and the dictionary file points to the V1 version of the file (named dict-a V1), generating a global file identifier may include the following steps:
[0086] 1. dict-a V1 is divided into multiple file blocks;
[0087] 2. Calculate a checksum for each file block; here, the checksum is used to verify the integrity of the file block;
[0088] 3. Concatenate the checksums of all file blocks into a text in a preset order;
[0089] 4. Determine the global checksum based on the concatenated text, assuming it is equal to "abcde"; here, the global checksum is used to uniquely identify the entire file;
[0090] 5. Generate a global file identifier: "dict-a.abcde".
[0091] The checksum algorithm mentioned above can use the checksum of Message-Digest Algorithm 5 (Message-Digest Algorithm 5checksum, md5sum) and the like, and the type of the checksum algorithm is not specifically limited and can be flexibly configured according to actual needs.
[0092] Figure 4 A schematic diagram of the calculation of the global checksum is shown, such as Figure 4 As shown, the file content is divided into multiple file blocks (denoted as file block 1 to file block n); a checksum is calculated for each file block (denoted as checksum 1 to checksum n); the checksums of all file blocks are spliced into a text (checksum 0-checksum 1-checksum 2-…-checksum n) in a preset order; and a global checksum (denoted as checksum x) is determined based on the spliced text.
[0093] The technical solution of the disclosed embodiment divides the file content into multiple file blocks; calculates a checksum for each file block; splices the checksums of all file blocks into a text in a preset order; determines the global checksum based on the spliced text; and generates the latest version of the global file identifier based on the global checksum. In this way, by calculating a separate checksum for each file block and verifying it after data transmission or storage, it can be ensured that each file block has not been tampered with or damaged during the transmission or storage process, greatly improving the integrity of the data.
[0094] In the disclosed embodiment, the data processing method may further include: configuring a target process for each instance, the target process being used to read corresponding file blocks from the disk of each instance to the memory of each instance, and communicating with target processes of other instances.
[0095] Here, the target process is responsible for file reading, caching, and communication with other instances.
[0096] In some implementations, when the dict-agent finds that a business process wants to read a certain data block, it will request data from the dict-agent in other instances through the network; configure a target process for each instance, the target process is used to read the corresponding file block from the disk of each instance to the memory of each instance, and communicate with the target process of other instances. Specifically, the machines can be grouped according to the network communication cost between the machines. Generally speaking, the communication cost of instances in one computer room is very low, only a few milliseconds, so the instances in the same computer room can be put together as one group. After determining which machines are in a group, the consistent hashing algorithm can be used on the file block to determine which instance the file block should belong to.
[0097] Figure 5 A schematic diagram of determining the location of a file block is shown, such as Figure 5 As shown, the file blocks are divided (denoted as 0 to m); a consistent hashing algorithm is used to determine that file blocks 0 and file blocks m belong to instance 1, file block "..." belongs to instance 2, and file blocks 1 and file blocks 2 belong to instance n.
[0098] The technical solution of the embodiment of the present disclosure configures a dedicated process for each instance, and the dedicated process is used to read the corresponding file blocks from the disk of each instance to the memory of each instance, and communicate with the dedicated processes of other instances. In this way, by configuring a dedicated process for each instance, parallel processing can be achieved, thereby improving the throughput and response speed of the overall system. Each process can read the file blocks independently without waiting for other processes to complete the operation. By loading the file blocks into the memory, the number of times the file is read from the disk is reduced, thereby improving the reading efficiency. Since the dedicated process is responsible for the reading and cache management of the file, the access to the disk can be centrally controlled, reducing the load pressure on the disk. Through the communication mechanism between dedicated processes, the system can be easily expanded to support more instances and files. Through the cache management strategy, it can be ensured that some file blocks can be reasonably removed when the memory space is insufficient, thereby avoiding system crashes or performance degradation.
[0099] It should be understood that Figures 2 to 5 The schematic diagram shown is only exemplary and not restrictive, and it is scalable, and those skilled in the art can Figures 2 to 5 Various obvious changes and / or substitutions can be made to the examples, and the resulting technical solutions still fall within the scope of the disclosure of the embodiments of the present disclosure.
[0100] The present disclosure provides a data processing device, such as Figure 6As shown, the data processing device may include: an interception module 601, which is used to intercept the read operation in response to detecting a read operation initiated by the business process of the first instance, and the read operation is used to indicate reading the target file of the first instance; a first acquisition module 602, which is used to obtain M file blocks of the target file from at least the cache of the second instance, the target file includes N file blocks, N is an integer not less than 2, and the M file blocks are any M file blocks among the N file blocks, M≤N; a return module 603, which is used to return the M file blocks from the second instance to the target process of the first instance.
[0101] In some embodiments, the data processing device may further include: a second acquisition module ( Figure 6 ), for, when M is less than N, obtaining NM file blocks from the cache of the first instance, and returning NM file blocks to the target process, wherein the NM file blocks are files other than the M file blocks of the N file blocks.
[0102] In some embodiments, the data processing device may further include: a first determining module ( Figure 6 ), for determining at least one second instance from other instances located on the same device as the first instance.
[0103] In some embodiments, the data processing device may further include: a second determining module ( Figure 6 ), which is used to determine at least one instance where the target file exists as a second instance when the target file exists on an instance located on a different device from the first instance.
[0104] In some embodiments, the data processing device may further include: a third determination module ( Figure 6 ), for determining the file block identifier allocated to the second instance according to the number of file blocks included in the target file, so that the second instance reads the corresponding file block based on the file block identifier.
[0105] In some embodiments, the data processing device may further include: a reading module ( Figure 6 ), which is used to read the file content of the target file from the local disk and generate the latest version of the global file identifier of the soft link based on the file content before the first instance or the second instance reads the corresponding file block, if it is detected that the file path pointed to by the soft link of the target file has changed; the change module ( Figure 6 (not shown in the figure), which is used to change the identifier of the soft link of the target file to the latest version of the global file identifier.
[0106] In some embodiments, the reading module ( Figure 6), including: a division submodule, used to divide the file content into multiple file blocks; a calculation submodule, used to calculate a checksum for each file block, and the checksum is used to verify the integrity of the file block; a splicing submodule, used to splice the checksums of all file blocks into a text in a preset order; a determination submodule, used to determine a global checksum based on the spliced text, and the global checksum is used to uniquely identify the entire file; a generation submodule, used to generate the latest version of the global file identifier based on the global checksum.
[0107] In some embodiments, the data processing device may further include: a configuration module ( Figure 6 ), which is used to configure a target process for each instance. The target process is used to read the corresponding file blocks from the disk of each instance to the memory of each instance and communicate with the target processes of other instances.
[0108] Those skilled in the art should understand that the functions of each processing module in the data processing device of the embodiment of the present disclosure can be understood with reference to the relevant description of the aforementioned data processing method, and each processing module in the data processing device of the embodiment of the present disclosure can be realized by a generation circuit that realizes the function of the embodiment of the present disclosure, and can also be realized by running software that executes the function of the embodiment of the present disclosure on an electronic device.
[0109] The data processing device of the embodiment of the present disclosure can improve the efficiency of file reading, thereby helping to improve the efficiency of version upgrading.
[0110] The present disclosure provides a schematic diagram of a data processing scenario, such as Figure 7 shown.
[0111] As mentioned above, the data processing method provided by the embodiment of the present disclosure is applied to electronic devices. Electronic devices are intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices.
[0112] Specifically, the electronic device can perform the following operations:
[0113] In response to detecting a read operation initiated by the business process of the first instance, intercepting the read operation, where the read operation is used to instruct to read a target file of the first instance;
[0114] At least M file blocks of the target file are obtained from the cache of the second instance, where the target file includes N file blocks, where N is an integer not less than 2, and the M file blocks are any M file blocks among the N file blocks, where M≤N;
[0115] Return M file blocks from the second instance to the target process of the first instance.
[0116] It should be understood that Figure 7 The scene diagram shown is only illustrative and not restrictive. Those skilled in the art can Figure 7 Various obvious changes and / or substitutions can be made to the examples, and the resulting technical solutions still fall within the scope of the disclosure of the embodiments of the present disclosure.
[0117] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0118] It should be noted that the acquisition, storage and application of user personal information involved in the technical solution of the present disclosure are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0119] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0120] like Figure 8 As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0121] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0122] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit CPU, a graphics processing unit (Graphics Processing Unit, GPU), various dedicated artificial intelligence (Artificial Intelligence, AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (Digital Signal Processor, DSP), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as data processing methods. For example, in some embodiments, the data processing method may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the data processing method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to execute the data processing method in any other appropriate manner (eg, by means of firmware).
[0123] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a dedicated or general-purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0124] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0125] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories, read-only memories, erasable programmable read-only memories (EPROM), flash memories, optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0126] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a cathode ray tube (CRT) or a liquid crystal display (LCD) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0127] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: Local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
[0128] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on the respective computers and having a client and server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0129] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0130] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A data processing method, include: In response to detecting a read operation initiated by a business process of the first instance, intercepting the read operation, wherein the read operation is used to instruct to read a target file of the first instance; At least M file blocks of the target file are obtained from the cache of the second instance, where the target file includes N file blocks, where N is an integer not less than 2, and the M file blocks are any M file blocks among the N file blocks, where M≤N; Return the M file blocks from the second instance to the target process of the first instance.
2. The method according to claim 1, further comprising: include: When M is less than N, NM file blocks are obtained from the cache of the first instance, and the NM file blocks are returned to the target process, wherein the NM file blocks are file blocks other than the M file blocks of the N file blocks.
3. The method according to claim 1 or 2, further comprising: include: At least one second instance is determined from other instances located on the same device as the first instance.
4. The method according to claim 1 or 2, further comprising: include: In a case where the target file exists on an instance located on a different device from the first instance, at least one instance where the target file exists is determined as the second instance.
5. The method according to claim 1 or 2, further comprising: include: According to the number of file blocks included in the target file, a file block identifier allocated to the second instance is determined, so that the second instance reads the corresponding file block based on the file block identifier.
6. The method according to claim 1 or 2, further comprising: include: Before the first instance or the second instance reads the corresponding file block, if it is detected that the file path pointed to by the soft link of the target file has changed, the file content of the target file is read from the local disk, and the latest version of the global file identifier of the soft link is generated based on the file content; The identifier of the soft link of the target file is changed to the global file identifier of the latest version.
7. The method according to claim 6, in, The generating the latest version of the global file identifier of the soft link based on the file content includes: Dividing the file content into a plurality of file blocks; Calculate a checksum for each file block, wherein the checksum is used to verify the integrity of the file block; Concatenate the checksums of all file blocks into a text in a preset order; Determine a global checksum based on the concatenated text, where the global checksum is used to uniquely identify the entire file; The latest version of the global file identifier is generated based on the global checksum.
8. The method according to claim 1, further comprising: include: A target process is configured for each instance, and the target process is used to read corresponding file blocks from the disk of each instance to the memory of each instance, and communicate with the target processes of other instances.
9. A data processing device, include: an interception module, configured to intercept, in response to detecting a read operation initiated by a business process of the first instance, the read operation being used to instruct reading of a target file of the first instance; A first acquisition module is used to acquire M file blocks of the target file from at least the cache of the second instance, where the target file includes N file blocks, where N is an integer not less than 2, and the M file blocks are any M file blocks among the N file blocks, where M≤N; A return module is used to return the M file blocks from the second instance to the target process of the first instance.
10. The device according to claim 9, further comprising: include: The second acquisition module is used to acquire NM file blocks from the cache of the first instance when M is less than N, and return the NM file blocks to the target process, wherein the NM file blocks are file blocks other than the M file blocks of the N file blocks.
11. The device according to claim 9 or 10, further comprising: include: The first determining module is used to determine at least one second instance from other instances located in the same device as the first instance.
12. The device according to claim 9 or 10, further comprising: include: A second determining module is configured to determine at least one instance where the target file exists as the second instance if the target file exists on an instance located on a different device from the first instance.
13. The device according to claim 9 or 10, further comprising: include: The third determination module is used to determine the file block identifier allocated to the second instance according to the number of file blocks included in the target file, so that the second instance reads the corresponding file block based on the file block identifier.
14. The device according to claim 9 or 10, further comprising: include: A reading module, configured to read the file content of the target file from a local disk and generate a global file identifier of the latest version of the soft link based on the file content if it is detected that the file path pointed to by the soft link of the target file has changed before the first instance or the second instance reads the corresponding file block respectively; The changing module is used to change the identifier of the soft link of the target file to the global file identifier of the latest version.
15. The device according to claim 14, in, The reading module comprises: A division submodule, used for dividing the file content into a plurality of file blocks; A calculation submodule, used to calculate a checksum for each file block, wherein the checksum is used to verify the integrity of the file block; The splicing submodule is used to splice the checksums of all file blocks into a text in a preset order; A determination submodule is used to determine a global checksum based on the concatenated text, wherein the global checksum is used to uniquely identify the entire file; A generation submodule is used to generate the latest version of the global file identifier based on the global checksum.
16. The device according to claim 9, further comprising: include: The configuration module is used to configure a target process for each instance, wherein the target process is used to read corresponding file blocks from the disk of each instance to the memory of each instance and communicate with the target processes of other instances.
17. An electronic device, include: at least one processor; as well as a memory communicatively connected to at least one processor; wherein, The memory stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 8.
18. A non-transitory computer-readable storage medium storing computer instructions, in, The computer instructions are for causing a computer to execute a method according to any one of claims 1-8.
19. A computer program product comprising a computer program stored on a storage medium, the computer program implementing the method according to any one of claims 1 to 8 when executed by a processor.
Citation Information
Patent Citations
Version management method, system and device for chip verification, equipment and medium
CN117873556A
Leveraging coalesced memory
US20120137062A1
