CN113485639B - IO speed optimization method, system, terminal and storage medium for distributed storage - Google Patents
IO speed optimization method, system, terminal and storage medium for distributed storage Download PDFInfo
- Publication number
- CN113485639B CN113485639B CN202110677274.4A CN202110677274A CN113485639B CN 113485639 B CN113485639 B CN 113485639B CN 202110677274 A CN202110677274 A CN 202110677274A CN 113485639 B CN113485639 B CN 113485639B
- Authority
- CN
- China
- Prior art keywords
- data
- target
- distributed lock
- client
- file layout
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 43
- 238000003860 storage Methods 0.000 title claims abstract description 43
- 238000005457 optimization Methods 0.000 title claims abstract description 20
- 230000007423 decrease Effects 0.000 claims description 4
- 238000004590 computer program Methods 0.000 claims description 3
- 230000003993 interaction Effects 0.000 abstract description 8
- 230000007246 mechanism Effects 0.000 description 6
- 238000004891 communication Methods 0.000 description 5
- 238000012217 deletion Methods 0.000 description 5
- 230000037430 deletion Effects 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 2
- 238000004140 cleaning Methods 0.000 description 2
- 230000003247 decreasing effect Effects 0.000 description 2
- 238000011156 evaluation Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000006467 substitution reaction Methods 0.000 description 2
- 230000006399 behavior Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000008034 disappearance Effects 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 238000005192 partition Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/061—Improving I/O performance
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/172—Caching, prefetching or hoarding of files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/18—File system types
- G06F16/182—Distributed file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0608—Saving storage space on storage systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0638—Organizing or formatting or addressing of data
- G06F3/0643—Management of files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0655—Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
- G06F3/0656—Data buffering arrangements
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/067—Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5022—Mechanisms to release resources
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/52—Program synchronisation; Mutual exclusion, e.g. by means of semaphores
- G06F9/524—Deadlock detection or avoidance
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Human Computer Interaction (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides an IO speed optimization method, system, terminal and storage medium for distributed storage, comprising the following steps: caching distributed lock data of a plurality of catalogues and bottom file layout data for a client operation request in advance; binding a client to which the distributed lock data client operation request belongs; recording the number of times of the cached distributed lock data and the underlying file layout data which are referenced by the client operation request, and determining the caching time of the distributed lock data and the underlying file layout data according to the number of times of the reference; and acquiring a target directory of a target file requested by the client operation, calling distributed lock data and bottom file layout data of the target directory from the cached data, and executing target file locking and IO operation on the target file. According to the method and the device, data are not required to be acquired from the distributed storage metadata system, the interaction times with the metadata system are reduced, and IO operation efficiency is improved.
Description
Technical Field
The invention relates to the technical field of distributed storage, in particular to an IO speed optimization method, system, terminal and storage medium for distributed storage.
Background
A distributed file system (Distributed File System, DFS) means that the physical storage resources managed by the file system are not necessarily directly connected to a local node, but are connected to the node (which can be simply understood as a computer) through a computer network; or a complete hierarchical file system formed by combining a plurality of different logical disk partitions or labels. The DFS provides a logical tree file system structure for resources distributed at any position on the network, thereby facilitating user access to shared files distributed on the network. The role of the individual DFS shared folders is to be relative to access points through other shared folders on the network.
In the current distributed file system, when operations such as file creation and deletion are performed under the same directory, each operation needs to lock and unlock the parent directory in turn, and for the creation and deletion operations, the bottom layer file layout data (dir_layout) of the directory needs to be obtained again. These operations are mostly repeated for the same directory, and because the locking and unlocking of the distributed lock all require the interaction of the metadata system (mds) of the distributed file system and the client, this greatly reduces the operation efficiency of the system IO.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides an IO speed optimization method, system, terminal and storage medium for distributed storage, so as to solve the technical problems.
In a first aspect, the present invention provides a method for optimizing IO speed in distributed storage, including:
caching distributed lock data of a plurality of catalogues and bottom file layout data for a client operation request in advance;
binding a client to which the distributed lock data client operation request belongs;
recording the number of times of the cached distributed lock data and the underlying file layout data which are referenced by the client operation request, and determining the caching time of the distributed lock data and the underlying file layout data according to the number of times of the reference;
and acquiring a target directory of a target file requested by the client operation, calling distributed lock data and bottom file layout data of the target directory from the cached data, and executing target file locking and IO operation on the target file.
Further, caching distributed lock data and underlying file layout data of a plurality of directories for a client operation request in advance includes:
and creating a lock cache member for the client operation request, and distributing lock data and underlying file layout data of the file directory related to the client operation request.
Further, binding the client to which the distributed lock data client operation request belongs, including:
binding a client to which a distributed lock data client operation request belongs by setting a client operation request authority, and clearing invalid bound distributed lock data after all client operation requests of the client are released according to a binding relation.
Further, recording the number of times of the cached distributed lock data and the underlying file layout data being referenced by the client operation request, and determining the caching time of the distributed lock data and the underlying file layout data according to the number of times of the reference, including:
setting a rule that the reference times decrease along with unreferenced time;
calculating a cache coefficient according to the reference times, unreferenced time and the rule of the cached distributed lock data and the underlying file layout data;
and if the cache coefficient is 0, clearing corresponding cache data.
Further, obtaining a target directory of a target file requested by a client operation, calling distributed lock data and bottom file layout data of the target directory from cached data, and executing target file locking and IO operation on the target file, including:
acquiring a target file of a client operation request of the current IO operation and a target directory to which the target file belongs;
searching target distributed lock data and target underlying file layout data of a target directory from the cached data;
and performing locking and unlocking operation on the target directory according to the target distributed lock data, and executing the current IO operation by using the target underlying file layout data.
In a second aspect, the present invention provides an IO speed optimization system for distributed storage, including:
the data caching unit is used for caching distributed lock data of a plurality of catalogues and bottom file layout data for a client operation request in advance;
the data binding unit is used for binding the client to which the operation request of the distributed lock data client belongs;
the cache management unit is used for recording the times of the cached distributed lock data and the underlying file layout data which are referenced by the client operation request, and determining the cache time of the distributed lock data and the underlying file layout data according to the referenced times;
the operation execution unit is used for acquiring the target directory of the target file requested by the client operation, calling the distributed lock data and the bottom file layout data of the target directory from the cached data, and executing the locking of the target file and the IO operation on the target file.
Further, the cache management unit includes:
the rule setting module is used for setting rules of decreasing reference times along with unreferenced time;
the coefficient calculation module is used for calculating a cache coefficient according to the reference times, unreferenced time and the rule of the cached distributed lock data and the underlying file layout data;
and the cache clearing module is used for clearing corresponding cache data if the cache coefficient is 0.
Further, the operation execution unit includes:
the target acquisition module is used for acquiring a target file of the current IO operation requested by the client operation and a target directory to which the target file belongs;
the data searching module is used for searching target distributed lock data and target bottom file layout data of the target directory from the cached data;
and the operation execution module is used for carrying out locking and unlocking operation on the target directory according to the target distributed lock data and executing the current IO operation by utilizing the target bottom file layout data.
In a third aspect, a terminal is provided, including:
a processor, a memory, wherein,
the memory is used for storing a computer program,
the processor is configured to call and run the computer program from the memory, so that the terminal performs the method of the terminal as described above.
In a fourth aspect, there is provided a computer storage medium having instructions stored therein which, when run on a computer, cause the computer to perform the method of the above aspects.
The invention has the advantages that,
according to the IO speed optimization method for distributed storage, the distributed lock data and the underlying file layout data of a plurality of catalogues are cached in advance for the client operation request, so that the client operation request only needs to acquire target distributed lock data and underlying file layout data from a cache every time IO operation is executed, the metadata system of the distributed storage is not required to acquire data, the interaction times with the metadata system are reduced, IO operation efficiency is improved, and meanwhile, the cache data is managed by binding the client to which the cache data client operation request belongs and counting the reference times of the cache data, so that useless data is prevented from occupying cache resources.
According to the IO speed optimization system for distributed storage, the data caching unit is used for caching the distributed lock data and the underlying file layout data of a plurality of catalogues in advance for the client operation request, so that the operation execution unit only needs to acquire target distributed lock data and underlying file layout data from the cache when the client operation request executes IO operation every time, the data do not need to be acquired from a metadata system for distributed storage, the interaction times with the metadata system are reduced, the IO operation efficiency is improved, meanwhile, the client to which the cache data client operation request belongs is bound by the data binding unit, and the cache management unit is used for carrying out reference times statistics on cache data to realize the management of the cache data, and the cache resource occupation caused by useless data is avoided.
According to the terminal and the IO speed optimization method for executing distributed storage, the distributed lock data and the underlying file layout data of a plurality of catalogues are cached in advance for the client operation request, so that the client operation request only needs to acquire the target distributed lock data and the underlying file layout data from the cache when executing IO operation every time, the data do not need to be acquired from a metadata system of the distributed storage, the interaction times with the metadata system are reduced, IO operation efficiency is improved, and meanwhile, the cache data is managed by binding the client to which the cache data client operation request belongs and counting the reference times of the cache data, so that useless data are prevented from occupying cache resources.
The storage medium can store the program capable of executing the IO speed optimization method of distributed storage, and the distributed lock data and the bottom file layout data of a plurality of catalogues are cached in advance for the client operation request, so that the client operation request only needs to acquire target distributed lock data and bottom file layout data from the cache when IO operation is executed each time, the metadata system of the distributed storage is not required to acquire data, the interaction times with the metadata system are reduced, the IO operation efficiency is improved, and meanwhile, the cache data is managed by binding the client to which the cache data client operation request belongs and counting the reference times of the cache data, so that useless data is prevented from occupying cache resources.
In addition, the invention has reliable design principle, simple structure and very wide application prospect.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the description of the embodiments or the prior art will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a schematic flow chart of a method of one embodiment of the invention.
FIG. 2 is a schematic flow chart of a method of acquiring distributed lock data according to one embodiment of the invention.
FIG. 3 is a schematic flow chart diagram of a method of acquiring underlying file layout data in accordance with one embodiment of the invention.
Fig. 4 is a schematic block diagram of a system of one embodiment of the present invention.
Fig. 5 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
Detailed Description
In order to make the technical solution of the present invention better understood by those skilled in the art, the technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
The following explains key terms appearing in the present invention.
MDS.metadata Server, short for metadata service in distributed File System.
Osd.object Storage Device, responsible for returning the progress of specific data in response to a client request. A distributed storage cluster typically has a large number of OSDs.
A distributed lock. Is a self-driven lock, a coordinator that ensures consistent behavior and data consistency among multiple nodes.
Mdr. The client sends an operation request to the MDS.
dir_layout. A data structure of an underlying file layout, such as a distribution of files under a directory in an underlying data pool, is provided.
And (4) the operation authority data obtained from the MDS by one client.
mdr_locks. Distributed lock data needed by the IO operation in mdr.
The distributed lock available to the IO at this time in the mdr_lock_cache.
FIG. 1 is a schematic flow chart of a method of one embodiment of the invention. The execution body of fig. 1 may be a distributed-storage IO speed optimization system.
As shown in fig. 1, the method includes:
step 110, caching distributed lock data of a plurality of catalogs and bottom file layout data for a client operation request in advance;
step 120, binding the client to which the distributed lock data client operation request belongs;
step 130, recording the number of times of the cached distributed lock data and the underlying file layout data which are referenced by the client operation request, and determining the caching time of the distributed lock data and the underlying file layout data according to the number of times of the reference;
step 140, obtaining the target directory of the target file requested by the client operation, calling the distributed lock data and the bottom file layout data of the target directory from the cached data, and executing the target file locking and IO operation on the target file.
In order to facilitate understanding of the present invention, the principle of the IO speed optimization method for distributed storage according to the present invention is used to further describe the IO speed optimization method for distributed storage according to the present invention in combination with the process of optimizing the IO speed for distributed storage in the embodiment.
Specifically, the IO speed optimization method for distributed storage includes:
s1, caching distributed lock data of a plurality of catalogs and underlying file layout data for a client operation request in advance.
A lock cache member mdr_lock_cache is created in the MDS for each client operation request mdr, which is used to store the relevant distributed read-write locks of the parent directories of each level required by the directory operated by the current client operation request mdr and the underlying file layout data dir_layout.
The dir_layout data of the underlying file is generally unchanged for a directory, and the acquisition process needs to perform distributed locking operation on each level of parent directory until the available dir_layout data is acquired, so that when the distributed locking data of a directory and the underlying file layout data are acquired, the distributed locking data need to be acquired first, then the directory is locked, and after the locking, the underlying file layout data need to be acquired.
S2, binding the client to which the operation request of the distributed lock data client belongs.
Binding a client to which a distributed lock data client operation request belongs by setting a client operation request authority, and clearing invalid bound distributed lock data after all client operation requests of the client are released according to a binding relation.
Specifically, the mdr_lock_cache of the lock cache member is bound in association with the cap right acquired by the client in the current MDS, unless all mdr associated with the mdr_lock_cache is released and the cap right acquired by the current client in the MDS is invalidated, the distributed lock cache data is invalidated. The invalidated distributed lock data is purged from the lock cache member mdr_lock_cache.
S3, recording the times of the cached distributed lock data and the underlying file layout data which are referenced by the client operation request, and determining the caching time of the distributed lock data and the underlying file layout data according to the referenced times.
Relationship of underlying file layout data dir_layout to distributed lock cache. The underlying file layout data needs to be saved in the MDS cache for a relatively long time, and cannot disappear along with the disappearance of the client operation request mdr, otherwise, the system still needs to frequently acquire the underlying file layout data, so that the underlying file layout data is saved in the lock cache member mdr_lock_cache corresponding to the mdr. Therefore, the lock cache mechanism can optimize the acquisition efficiency of the underlying file layout data dir_layout, which is convenient for the storage and use of the underlying file layout data dir_layout, but in general, the two mechanisms of the method for improving the file IO efficiency are different, the distributed lock cache data is the optimization of the MDS distributed lock mechanism, and the cache optimization of the underlying file layout data dir_layout is the optimization of a specific operation step of the system IO, and the two mechanisms are related but not indispensable to each other.
In order to make invalid cache data in the lock cache member mdr_lock_cache not occupy cache resources, a cache cleaning mechanism is set, including:
a rule is set that the number of references decreases with the unreferenced time, which is the time counted from the last referenced. The present embodiment sets the decrementing coefficient to k.
And calculating a cache coefficient G according to the reference times C, the unreferenced time T and the rule of the cached distributed lock data and the underlying file layout data, wherein G=C-kT and k is a positive number.
If the cache data is not referenced for a long time until the cache coefficient G is reduced to 0, the corresponding cache data is cleared.
By setting a cache cleaning mechanism, the unusual data is cleaned in time, and the invalid data is prevented from occupying cache resources.
S4, acquiring a target directory of a target file requested by the client operation, calling distributed lock data and bottom file layout data of the target directory from the cached data, and executing target file locking and IO operation on the target file.
The method specifically comprises the following steps:
(1) And acquiring the target file of the current IO operation requested by the client operation and a target directory to which the target file belongs.
(2) And searching target distributed lock data and target underlying file layout data of the target directory from the cached data.
(3) And performing locking and unlocking operation on the target directory according to the target distributed lock data, and executing the current IO operation by using the target underlying file layout data.
The specific method for performing the locking and unlocking operation on the target directory is shown in fig. 2, and includes:
1) When a certain MDS receives the creation or deletion operation of a file under a certain directory sent by a client, if the current file is the first file for executing the creation or deletion operation under the certain directory under the MDS, step 2) is entered, otherwise step 5) is entered.
2) If the current operation is file creation and there is distributed lock cache data for the current client and the directory in the current system, step 3) is entered, otherwise, if the current operation is deletion or although it is creation, there is no distributed lock cache data for the current client and the directory in the current system, step 4) is entered.
3) And 5) acquiring the mdr_lock_cache distributed lock cache data of the directory under the MDS according to the cap of the current client, assigning the data to the mdr corresponding to the IO operation, increasing the lock cache reference count of the directory, and entering step 5.
4) And collecting the distributed lock data of each upper-level directory required by the file when various operation authorities are acquired, and storing the distributed lock data mdr_locks required by the current IO operation of mdr.
5) According to corresponding distributed lock data (mdr_locks and mdr_lock_cache) in the mdr corresponding to the IO operation, lock evaluation is sequentially carried out, if the currently evaluated lock already has distributed lock cache data, lock evaluation, lock interaction and corresponding locking and unlocking operations of the lock are directly skipped, and otherwise, the operations are carried out to obtain various distributed lock data required by the IO.
6) If the current IO enters the step 4), the read-write distributed lock of the upper-level catalogue needed by the current IO operation lock is moved into the mdr_lock_cache from the mdr_locks, the mdr_lock_cache is associated with the cap authority of the current client, and the lock cache reference count is increased.
7) After the file IO operation is completed, the application count of the distributed lock cache mdr_lock_cache in the mdr is reduced, and when the count is reduced to 0, the distributed lock cache data is removed from the whole distributed system.
The method for obtaining the layout data of the underlying file to execute the IO operation is shown in FIG. 3, which comprises the following steps:
1) The dir_layout needed for obtaining a file needs to be locked to each parent directory in sequence according to the hierarchy until the available dir_layout is obtained from a parent directory of a certain hierarchy.
2) When the file deleting or creating operation is performed, firstly judging whether cached available underlying file layout data dir_layout exists in the mdr corresponding to the IO operation, if yes, directly acquiring, otherwise, entering the step 3), and otherwise, entering the step 4).
3) If the current mdr has no cached underlying file layout data dir_layout, sequentially performing a distributed locking operation on each upper directory to obtain available underlying file layout data dir_layout, and in this process, if the required distributed lock is already in the distributed lock cache (mdr_lock_cache) of the mdr, directly skipping the locking process of the distributed lock.
4) And executing the subsequent operation of the IO after the bottom file layout data dir_layout is acquired.
5) After the operation is finished, if the IO enters step 3), that is, the cache data of the underlying file layout data dir_layout does not exist in the mdr, the underlying file layout data dir_layout is stored in the distributed lock cache (mdr_lock_cache) of the mdr, so that the newly acquired underlying file layout data dir_layout can be stored in the distributed file system for a longer time (the mdr_lock_cache has reference count protection and does not completely depend on the mdr to exist).
As shown in fig. 4, the system 400 includes:
a data caching unit 410, configured to cache, in advance, distributed lock data and underlying file layout data of a plurality of directories for a client operation request;
a data binding unit 420, configured to bind a client to which the distributed lock data client operation request belongs;
the cache management unit 430 is configured to record the number of times the cached distributed lock data and the underlying file layout data are referenced by the client operation request, and determine the cache time of the distributed lock data and the underlying file layout data according to the number of times of reference;
the operation execution unit 440 is configured to obtain a target directory of a target file requested by the client operation, retrieve distributed lock data and underlying file layout data of the target directory from the cached data, and execute the target file locking and the IO operation on the target file.
Optionally, as an embodiment of the present invention, the cache management unit includes:
the rule setting module is used for setting rules of decreasing reference times along with unreferenced time;
the coefficient calculation module is used for calculating a cache coefficient according to the reference times, unreferenced time and the rule of the cached distributed lock data and the underlying file layout data;
and the cache clearing module is used for clearing corresponding cache data if the cache coefficient is 0.
Optionally, as an embodiment of the present invention, the operation performing unit includes:
the target acquisition module is used for acquiring a target file of the current IO operation requested by the client operation and a target directory to which the target file belongs;
the data searching module is used for searching target distributed lock data and target bottom file layout data of the target directory from the cached data;
and the operation execution module is used for carrying out locking and unlocking operation on the target directory according to the target distributed lock data and executing the current IO operation by utilizing the target bottom file layout data.
Fig. 5 is a schematic structural diagram of a terminal 500 according to an embodiment of the present invention, where the terminal 500 may be used to execute the IO speed optimization method for distributed storage according to the embodiment of the present invention.
The terminal 500 may include: a processor 510, a memory 520 and a communication unit 530. The components may communicate via one or more buses, and it will be appreciated by those skilled in the art that the configuration of the server as shown in the drawings is not limiting of the invention, as it may be a bus-like structure, a star-like structure, or include more or fewer components than shown, or may be a combination of certain components or a different arrangement of components.
The memory 520 may be used to store instructions for execution by the processor 510, and the memory 520 may be implemented by any type of volatile or non-volatile memory terminal or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk. The execution of the instructions in memory 520, when executed by processor 510, enables terminal 500 to perform some or all of the steps in the method embodiments described below.
The processor 510 is a control center of the storage terminal, connects various parts of the entire electronic terminal using various interfaces and lines, and performs various functions of the electronic terminal and/or processes data by running or executing software programs and/or modules stored in the memory 520, and invoking data stored in the memory. The processor may be comprised of an integrated circuit (Integrated Circuit, simply referred to as an IC), for example, a single packaged IC, or may be comprised of a plurality of packaged ICs connected to the same function or different functions. For example, the processor 510 may include only a central processing unit (Central Processing Unit, simply CPU). In the embodiment of the invention, the CPU can be a single operation core or can comprise multiple operation cores.
A communication unit 530 for establishing a communication channel so that the storage terminal can communicate with other terminals. Receiving user data sent by other terminals or sending the user data to other terminals.
The present invention also provides a computer storage medium in which a program may be stored, which program may include some or all of the steps in the embodiments provided by the present invention when executed. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random-access memory (random access memory, RAM), or the like.
Therefore, the distributed lock data and the underlying file layout data of a plurality of catalogs are cached in advance for the client operation request, so that the client operation request only needs to acquire the target distributed lock data and the underlying file layout data from the cache when IO operation is executed each time, the data is not required to be acquired from the distributed storage metadata system, the interaction times with the metadata system are reduced, IO operation efficiency is improved, meanwhile, the cache data is managed by binding the client to which the cache data client operation request belongs and counting the reference times of the cache data, and the cache resources are prevented from being occupied by useless data.
It will be apparent to those skilled in the art that the techniques of embodiments of the present invention may be implemented in software plus a necessary general purpose hardware platform. Based on such understanding, the technical solution in the embodiments of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium such as a U-disc, a mobile hard disc, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk or an optical disk, etc. various media capable of storing program codes, including several instructions for causing a computer terminal (which may be a personal computer, a server, or a second terminal, a network terminal, etc.) to execute all or part of the steps of the method described in the embodiments of the present invention.
The same or similar parts between the various embodiments in this specification are referred to each other. In particular, for the terminal embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference should be made to the description in the method embodiment for relevant points.
In the several embodiments provided by the present invention, it should be understood that the disclosed systems and methods may be implemented in other ways. For example, the system embodiments described above are merely illustrative, e.g., the division of the elements is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple elements or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interface, system or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
Although the present invention has been described in detail by way of preferred embodiments with reference to the accompanying drawings, the present invention is not limited thereto. Various equivalent modifications and substitutions may be made in the embodiments of the present invention by those skilled in the art without departing from the spirit and scope of the present invention, and it is intended that all such modifications and substitutions be within the scope of the present invention/be within the scope of the present invention as defined by the appended claims. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (7)
1. The IO speed optimization method for distributed storage is characterized by comprising the following steps of:
caching distributed lock data of a plurality of catalogues and bottom file layout data for a client operation request in advance;
binding a client to which the distributed lock data client operation request belongs;
recording the number of times of the cached distributed lock data and the underlying file layout data which are referenced by the client operation request, and determining the caching time of the distributed lock data and the underlying file layout data according to the number of times of the reference;
acquiring a target directory of a target file of a client operation request, calling distributed lock data and bottom file layout data of the target directory from cached data, and executing target file locking and IO operation on the target file;
binding the client to which the distributed lock data client operation request belongs, including:
binding a client to which a distributed lock data client operation request belongs by setting a client operation request authority, and clearing invalid bound distributed lock data after all client operation requests of the client are released according to a binding relation;
recording the number of times of the cached distributed lock data and the underlying file layout data which are referenced by the client operation request, and determining the caching time of the distributed lock data and the underlying file layout data according to the number of times of the reference, wherein the method comprises the following steps:
setting a rule that the reference times decrease along with unreferenced time;
calculating a cache coefficient according to the reference times, unreferenced time and the rule of the cached distributed lock data and the underlying file layout data;
and if the cache coefficient is 0, clearing corresponding cache data.
2. The method of claim 1, wherein caching the distributed lock data and the underlying file layout data for the plurality of directories for the client operation request in advance comprises:
a lock cache member is created for a client operation request to store distributed lock data and underlying file layout data for a file directory to which the client operation request pertains.
3. The method of claim 1, wherein obtaining the target directory of the target file requested by the client operation, retrieving the distributed lock data and the underlying file layout data of the target directory from the cached data, performing target file locking and IO operations on the target file, comprises:
acquiring a target file of a client operation request of the current IO operation and a target directory to which the target file belongs;
searching target distributed lock data and target underlying file layout data of a target directory from the cached data;
and performing locking and unlocking operation on the target directory according to the target distributed lock data, and executing the current IO operation by using the target underlying file layout data.
4. An IO speed optimization system for distributed storage, comprising:
the data caching unit is used for caching distributed lock data of a plurality of catalogues and bottom file layout data for a client operation request in advance;
the data binding unit is used for binding the client to which the operation request of the distributed lock data client belongs;
the cache management unit is used for recording the times of the cached distributed lock data and the underlying file layout data which are referenced by the client operation request, and determining the cache time of the distributed lock data and the underlying file layout data according to the referenced times;
the operation execution unit is used for acquiring a target directory of a target file requested by the client operation, calling distributed lock data and bottom file layout data of the target directory from the cached data, and executing locking of the target file and IO operation on the target file;
binding the client to which the distributed lock data client operation request belongs, including:
binding a client to which a distributed lock data client operation request belongs by setting a client operation request authority, and clearing invalid bound distributed lock data after all client operation requests of the client are released according to a binding relation;
recording the number of times of the cached distributed lock data and the underlying file layout data which are referenced by the client operation request, and determining the caching time of the distributed lock data and the underlying file layout data according to the number of times of the reference, wherein the method comprises the following steps:
setting a rule that the reference times decrease along with unreferenced time;
calculating a cache coefficient according to the reference times, unreferenced time and the rule of the cached distributed lock data and the underlying file layout data;
and if the cache coefficient is 0, clearing corresponding cache data.
5. The system of claim 4, wherein the operation execution unit comprises:
the target acquisition module is used for acquiring a target file of the current IO operation requested by the client operation and a target directory to which the target file belongs;
the data searching module is used for searching target distributed lock data and target bottom file layout data of the target directory from the cached data;
and the operation execution module is used for carrying out locking and unlocking operation on the target directory according to the target distributed lock data and executing the current IO operation by utilizing the target bottom file layout data.
6. A terminal, comprising:
a processor;
a memory for storing execution instructions of the processor;
wherein the processor is configured to perform the method of any of claims 1-3.
7. A computer readable storage medium storing a computer program, which when executed by a processor implements the method of any one of claims 1-3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110677274.4A CN113485639B (en) | 2021-06-18 | 2021-06-18 | IO speed optimization method, system, terminal and storage medium for distributed storage |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110677274.4A CN113485639B (en) | 2021-06-18 | 2021-06-18 | IO speed optimization method, system, terminal and storage medium for distributed storage |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113485639A CN113485639A (en) | 2021-10-08 |
CN113485639B true CN113485639B (en) | 2024-02-20 |
Family
ID=77933931
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110677274.4A Active CN113485639B (en) | 2021-06-18 | 2021-06-18 | IO speed optimization method, system, terminal and storage medium for distributed storage |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113485639B (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7730258B1 (en) * | 2005-11-01 | 2010-06-01 | Netapp, Inc. | System and method for managing hard and soft lock state information in a distributed storage system environment |
CN102024017A (en) * | 2010-11-04 | 2011-04-20 | 天津曙光计算机产业有限公司 | Method for traversing directory entries of distribution type file system in repetition-free and omission-free way |
CN103902660A (en) * | 2014-03-04 | 2014-07-02 | 中国科学院计算技术研究所 | System and method for prefetching file layout through readdir++ in cluster file system |
CN104158897A (en) * | 2014-08-25 | 2014-11-19 | 曙光信息产业股份有限公司 | Updating method of file layout in distributed file system |
KR20170090594A (en) * | 2016-01-29 | 2017-08-08 | 한국전자통신연구원 | Data server device configured to manage distributed lock of file together with client device in storage system employing distributed file system |
CN109582658A (en) * | 2018-12-03 | 2019-04-05 | 郑州云海信息技术有限公司 | A kind of distributed file system realizes the method and device of data consistency |
CN110750507A (en) * | 2019-09-30 | 2020-02-04 | 华中科技大学 | Client persistent caching method and system under global namespace facing DFS |
CN111966635A (en) * | 2020-08-14 | 2020-11-20 | 苏州浪潮智能科技有限公司 | Method and device for improving file detection speed of distributed storage file system |
-
2021
- 2021-06-18 CN CN202110677274.4A patent/CN113485639B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7730258B1 (en) * | 2005-11-01 | 2010-06-01 | Netapp, Inc. | System and method for managing hard and soft lock state information in a distributed storage system environment |
CN102024017A (en) * | 2010-11-04 | 2011-04-20 | 天津曙光计算机产业有限公司 | Method for traversing directory entries of distribution type file system in repetition-free and omission-free way |
CN103902660A (en) * | 2014-03-04 | 2014-07-02 | 中国科学院计算技术研究所 | System and method for prefetching file layout through readdir++ in cluster file system |
CN104158897A (en) * | 2014-08-25 | 2014-11-19 | 曙光信息产业股份有限公司 | Updating method of file layout in distributed file system |
KR20170090594A (en) * | 2016-01-29 | 2017-08-08 | 한국전자통신연구원 | Data server device configured to manage distributed lock of file together with client device in storage system employing distributed file system |
CN109582658A (en) * | 2018-12-03 | 2019-04-05 | 郑州云海信息技术有限公司 | A kind of distributed file system realizes the method and device of data consistency |
CN110750507A (en) * | 2019-09-30 | 2020-02-04 | 华中科技大学 | Client persistent caching method and system under global namespace facing DFS |
CN111966635A (en) * | 2020-08-14 | 2020-11-20 | 苏州浪潮智能科技有限公司 | Method and device for improving file detection speed of distributed storage file system |
Non-Patent Citations (2)
Title |
---|
Lustre文件系统I/O锁的应用与优化;钱迎进;金士尧;肖侬;;计算机工程与应用(第03期);全文 * |
分布式文件系统中海量小文件异步创建技术;杨洪章;张军伟;齐颖;吴雪丽;;网络新媒体技术(第02期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN113485639A (en) | 2021-10-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10949551B2 (en) | Policy aware unified file system | |
JP7410181B2 (en) | Hybrid indexing methods, systems, and programs | |
US9754009B2 (en) | System and method for implementing a scalable data storage service | |
US20210200446A1 (en) | System and method for providing a committed throughput level in a data store | |
US7302520B2 (en) | Method and apparatus for data storage using striping | |
CN107783988B (en) | Method and equipment for locking directory tree | |
CN114490527B (en) | Metadata retrieval method, system, terminal and storage medium | |
WO2016192057A1 (en) | Updating method and device for index table | |
CN109460345B (en) | Real-time data calculation method and system | |
CN114610680A (en) | Method, device and equipment for managing metadata of distributed file system and storage medium | |
US20220342888A1 (en) | Object tagging | |
CN111581123B (en) | Classification-based locking of memory allocation | |
CN113485639B (en) | IO speed optimization method, system, terminal and storage medium for distributed storage | |
CN116466885A (en) | Data access method and data processing system | |
CN115878625A (en) | Data processing method and device and electronic equipment | |
CN115687359A (en) | Data table partitioning method and device, storage medium and computer equipment | |
US11580128B2 (en) | Preventing DBMS deadlock by eliminating shared locking | |
CN114443583A (en) | Method, device and equipment for arranging fragment space and storage medium | |
CN114036104A (en) | Cloud filing method, device and system for re-deleted data based on distributed storage | |
CN112015791A (en) | Data processing method and device, electronic equipment and computer storage medium | |
CN113625962B (en) | Dynamic subtree optimization method, system, terminal and storage medium for distributed storage | |
CN117632953B (en) | Data cycle storage method, device, server and storage medium | |
CN116821058B (en) | Metadata access method, device, equipment and storage medium | |
US11520769B1 (en) | Block level lock on data table | |
CN117493388A (en) | Data management method based on key value storage system and related equipment thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |