WO2019232994A1 - 后台写盘流控方法、装置、电子设备及存储介质 - Google Patents

后台写盘流控方法、装置、电子设备及存储介质 Download PDF

Info

Publication number
WO2019232994A1
WO2019232994A1 PCT/CN2018/108129 CN2018108129W WO2019232994A1 WO 2019232994 A1 WO2019232994 A1 WO 2019232994A1 CN 2018108129 W CN2018108129 W CN 2018108129W WO 2019232994 A1 WO2019232994 A1 WO 2019232994A1
Authority
WO
WIPO (PCT)
Prior art keywords
statistical period
cache
flow control
data block
control threshold
Prior art date
Application number
PCT/CN2018/108129
Other languages
English (en)
French (fr)
Inventor
陈学伟
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019232994A1 publication Critical patent/WO2019232994A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0866Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches for peripheral storage systems, e.g. disk cache
    • G06F12/0871Allocation or management of cache space

Definitions

  • the present application relates to the field of computer technology, and in particular, to a background write disk flow control method, device, electronic device, and storage medium.
  • Cache is a buffer for data exchange (also known as "Cache").
  • the hard disk After receiving the instruction to write data, the hard disk will not immediately write the data to the disk, but will temporarily store it in the cache and then send a "Data has been written” signal to the system, then the system will consider the data has been written, and continue to perform the following work.
  • the cache often uses RAM (non-permanent storage that is lost when power is lost), so after the data in the cache is used up, the data is still stored in the hard disk and other storage for permanent storage. This operation is called background disk writing.
  • a first aspect of the present application provides a background write disk flow control method, which includes:
  • the user data corresponding to the second identifier is cleared in the cache with the data identifier.
  • a second aspect of the present application provides a background write disk flow control device, where the device includes:
  • a cache write module configured to write the user data into a configured cache when a user data storage command is received
  • a first detection module configured to detect whether cache information in the cache satisfies a first preset condition
  • a flow control acquisition module configured to: when the first detection module detects that the buffer information in the cache meets a first preset condition, acquire a flow control threshold corresponding to a current statistical period in a write period;
  • a hard disk writing module configured to write the user data corresponding to the first identifier into the hard disk based on the flow control threshold corresponding to the current statistical period;
  • a second detection module for detecting whether the cache information in the cache satisfies a second preset when the first detection module detects that the cache information in the cache does not satisfy a first preset condition condition
  • the cache clearing module is configured to: when the second detecting module detects that the cache information in the cache satisfies the second preset condition, perform data identification on the cache as user data corresponding to the second identification. Clear.
  • a third aspect of the present application provides an electronic device including a processor and a memory, where the processor is configured to implement the background disk write flow control method when executing computer-readable instructions stored in the memory.
  • a fourth aspect of the present application provides a non-volatile readable storage medium, where computer-readable instructions are stored on the non-volatile readable storage medium, and the computer-readable instructions are implemented when executed by a processor.
  • Background write disk flow control method
  • the background disk write flow control method, device, electronic device, and storage medium described in this application write user data into a configured cache, and can detect when the cache information in the cache meets a first preset condition, According to different flow control thresholds, the data in the cache in the current statistical cycle is identified as user data corresponding to the first identifier and written to the pointed hard disk. This improves the efficiency of writing user data to the hard disk and reduces the risk of data loss. At the same time, it can avoid a significant impact on normal I / O service performance and has a good flow control effect. In addition, when it is detected that the cache information in the cache does not meet the first preset condition but meets the second preset condition , Clearing user data from the cache can save the storage space of the cache and improve the efficiency of writing user data into the cache.
  • FIG. 1 is a flowchart of a background disk write flow control method provided in Embodiment 1 of the present application.
  • FIG. 2 is a flowchart of a method for determining a flow control threshold corresponding to a current statistical period according to an IO load of a user application in a previous statistical period according to a second embodiment of the present application.
  • FIG. 3 is a functional module diagram of a background write disk flow control device provided in Embodiment 3 of the present application.
  • FIG. 4 is a schematic diagram of an electronic device according to a fourth embodiment of the present application.
  • the background write disk flow control method in the embodiment of the present application is applied to one or more electronic devices.
  • the background write disk flow control method can also be applied to a hardware environment composed of an electronic device and a server connected to the electronic device through a network.
  • the network includes, but is not limited to: a wide area network, a metropolitan area network, or a local area network.
  • the background write disk flow control method in the embodiment of the present application may be executed by a server or an electronic device; it may also be executed jointly by the server and the electronic device.
  • the background disk write flow control function provided by the method of the present application can be directly integrated on the electronic device, or a client for implementing the method of the application can be installed.
  • the method provided in this application can also be run on a device such as a server in the form of a Software Development Kit (SDK), and provide an interface for the background write disk flow control function in the form of an SDK, an electronic device, or other The device can implement the flow control function for background disk writing through the provided interface.
  • SDK Software Development Kit
  • FIG. 1 is a flowchart of a background disk write flow control method provided in Embodiment 1 of the present application. According to different requirements, the execution order in this flowchart can be changed, and some steps can be omitted.
  • the electronic device When the electronic device receives a user data storage instruction, it generates a data write instruction and configures a cache memory to write the user data into the configured cache memory.
  • the user data includes: data content, address information, and data identification.
  • the address information includes information such as a source address and a destination address of the user data.
  • the data identifier is used to indicate whether the user data needs to be written to the hard disk.
  • the data identifier may be a first identifier or a second identifier.
  • the data identifier indicates that the user data needs to be written to the hard disk; when the data identifier is the second identifier, it indicates that the user data does not need to be written to the hard disk. For example, if the data identifier is "1", it indicates that the user data needs to be written to the hard disk, and if the data identifier is "0", it indicates that the user data does not need to be written to the hard disk. , You can discard it after use.
  • the cache information includes: the remaining storage space in the cache, the total amount of user data in the cache, the cache time of the user data in the cache, and the user data.
  • the total amount of user data refers to the total size of the user data stored in the cache.
  • the detecting whether the cache information in the cache satisfies the first preset condition includes one or a combination of the following:
  • the cache information in the cache meets a first preset condition; when the remaining storage space in the cache is detected When it is greater than or equal to the preset space threshold, it is determined that the cache information in the cache does not satisfy the first preset condition.
  • the cache information in the cache satisfies a first preset condition; when a user in the cache is detected When the total amount of data is less than or equal to the preset limit threshold, it is determined that the cache information in the cache does not satisfy the first preset condition.
  • step S13 When it is detected that the cache information in the cache satisfies the first preset condition, step S13 is performed; otherwise, when it is detected that the cache information in the cache does not satisfy the first preset condition, execute Step S15.
  • a write cycle can be divided into multiple statistical cycles, and a statistical cycle can be a preset time period. For example, a statistical cycle is set to 1 second.
  • the flow control refers to flow control. There are two methods for implementing flow control: one is to implement flow control based on source address, destination address, source port, destination port, and protocol type through the QoS module of routers and switches; the other is to use professional flow control equipment Implement application-based flow control.
  • the acquiring the flow control threshold corresponding to the current statistical period in the writing period may specifically include:
  • the flow control threshold corresponding to the first statistical period in the writing period of the present application is a preset flow control threshold, which can be preset by a system administrator according to experience. That is, a preset flow control threshold is adopted as the flow control threshold of the first statistical period in the writing period.
  • Each remaining statistical period except the first statistical period in the writing period may correspond to a flow control threshold.
  • the flow control threshold corresponding to each remaining statistical period is dynamically adjusted.
  • the flow control threshold corresponding to the current statistical period can be calculated based on the IO load in the previous statistical period.
  • the flow control threshold corresponding to the next statistical period can be based on the current statistical period.
  • the calculated IO load is calculated. Specifically, the flow control threshold corresponding to the second statistical period is calculated according to the IO load in the first statistical period; the flow control threshold corresponding to the third statistical period is calculated according to the IO load in the second statistical period; analogy.
  • the data identifier in the cache is that the user data corresponding to the first identifier is data that needs to be written to the hard disk, and the data that needs to be written to the hard disk is written to the hard disk based on the flow control threshold corresponding to the current statistical period. If the flow control threshold corresponding to the current statistical period is large, controlling the speed at which the user data corresponding to the first identifier in the data identifier in the cache is written to the hard disk with a larger flow control threshold can improve the write speed in the hard disk. Speed, alleviates the storage pressure in the cache, and can avoid the problem of user data loss in the cache caused by system power failure or other abnormal situations. If the flow control threshold corresponding to the current statistical period is small, the user data corresponding to the first identifier in the cache data identifier is not written to the hard disk too fast, thereby avoiding a significant impact on normal I / O service performance.
  • the detecting whether the cache information in the cache satisfies a second preset condition is: detecting whether a cache time of user data in the cache is earlier than a preset time threshold.
  • step S16 When it is detected that the cache information in the cache satisfies the second preset condition, step S16 is performed; otherwise, when it is detected that the cache information in the cache does not satisfy the second preset condition, it may be Return to step S12.
  • the user data corresponding to the second identifier in the cache is the data that does not need to be written to the hard disk.
  • the user data corresponding to the second identifier is not written to the hard disk and it is determined that the second identifier
  • clearing it from the cache can save storage space in the cache, provide more storage space for user data that needs to be written to the hard disk, and improve user data writing to the cache. The speed can further reduce the impact on the IO data of the user application and improve the user experience.
  • FIG. 2 is a flowchart of a method for determining a flow control threshold corresponding to a current statistical period according to an IO load of a user application in a previous statistical period according to a second embodiment of the present application.
  • S21 Obtain a data block size of each IO applied by a user in a previous statistical period, and calculate an average data block size of the IO in the previous statistical period.
  • the average data block size of the IO in the last statistical period may be calculated by using an arithmetic average algorithm, a geometric mean algorithm, or a root mean square algorithm.
  • the data block sizes of the ten IOs are: 2M, 1M, 3M, 0.5M, 10M, 4M, 0.1M, 1.2M, 5M. And 8M. Calculating the average data block size of the IO in the previous statistical period by using the arithmetic average algorithm is:
  • the transmission delay refers to the time required for a node to enter a data block from the node to the transmission medium when transmitting data, that is, the time required for a sending site to start sending data frames to the completion of data frame transmission The total time required for a receiving station, or the time required for a receiving station to start receiving data frames and finish receiving data frames.
  • the transmission delay of the data block may be obtained from a load measurement tool or a performance monitoring tool installed in each storage node.
  • the average data block delay of the IO in the previous statistical period may also be calculated by using an arithmetic average algorithm, a geometric mean algorithm, or a root mean square algorithm. Assume that assuming that the transmission delays of ten IOs in the previous statistical period are: 1s, 0.8s, 1.5s, 0.4s, 5s, 2s, 0.02s, 0.6s, 3s, and 4.5s, then When the average IO block delay in the previous statistical period is calculated using the arithmetic mean algorithm, the result is:
  • the average data block size of the IO in the previous statistical period is calculated using the arithmetic average algorithm, the average data block delay of the IO in the previous statistical period is also calculated using the arithmetic average algorithm; if The average data block size of the IO in the previous statistical period is calculated using the geometric mean algorithm, and the average data block delay of the IO in the previous statistical period is also calculated using the geometric mean algorithm; or The average data block size of the IO is calculated using the root mean square average algorithm, and the average data block delay of the IO in the previous statistical period is also calculated using the root mean square average algorithm.
  • the reference value of the size of the IO data block and the reference value of the corresponding data block delay may be preset by an administrator of the storage system according to experience. For example, according to experience, when a 4K data block is transmitted, the delay is the smallest, and in the ideal state, it can reach 50ms, then the reference value of the IO data block size can be set to 4k, and the corresponding data block delay reference value can be set. It is 50ms.
  • the average data block size of the IO in the previous statistical period is X
  • the average data block delay is Y
  • the reference value of the data block size is M
  • the reference value of the corresponding data block delay is N
  • the calculation formula of the IO load intensity in the previous statistical period is:
  • the IO load category includes: a high load category, a normal load category, and a low load category.
  • the load classification model includes, but is not limited to, a Support Vector Machine (SVM) model.
  • SVM Support Vector Machine
  • Using the average data block size of the IO in the last statistical period, the average data block delay of the IO in the last statistical period, and the IO load intensity in the last statistical period as the load classification model The input is calculated by the load classification model, and the IO load category in the previous statistical period is output.
  • SVM Support Vector Machine
  • the training process of the load classification model includes:
  • training samples in the training sets of different load categories are distributed to different folders. For example, training samples of high load category are distributed to the first folder, training samples of normal load category are distributed to the second folder, and training samples of low load category are distributed to the third folder.
  • training samples of the first preset ratio for example, 70%
  • second preset ratios for example, 30%
  • the accuracy rate is greater than or equal to a preset accuracy rate, end training, and use the trained load classification model as a classifier to identify the IO load category in the current statistical period; if the accuracy rate is less than When the accuracy is preset, the number of positive samples and the number of negative samples are increased to retrain the load classification model until the accuracy is greater than or equal to the preset accuracy.
  • calculating the flow control threshold corresponding to the current statistical period according to the IO load category in the previous statistical period may include:
  • the first preset amplitude may be 1/2 of a flow control threshold corresponding to a previous statistical period. That is, the flow control threshold corresponding to the current statistical period is 1/2 of the flow control threshold corresponding to the previous statistical period, and the flow control threshold corresponding to the next statistical period is 1/2 of the flow control threshold corresponding to the current statistical period.
  • the second preset amplitude may be 1.5 times a flow control threshold corresponding to a previous statistical period. That is, the flow control threshold corresponding to the current statistical period is 1.5 times the flow control threshold corresponding to the previous statistical period, and the flow control threshold corresponding to the next statistical period is 1.5 times the flow control threshold corresponding to the current statistical period.
  • the flow control threshold corresponding to the previous statistical cycle is used as the flow control threshold corresponding to the current statistical cycle.
  • the background write disk flow control method described in this application writes user data into a configured cache, detects that the cache information in the cache satisfies the first preset condition, and in the current write cycle
  • the data in the cache is identified by a preset flow control threshold as user data corresponding to the first identifier and written to the pointed hard disk; and the cache information in the cache is detected to meet
  • the first preset condition and when the current writing cycle is not the first statistical cycle, the flow control threshold corresponding to the current statistical cycle can be dynamically adjusted according to the IO load of the user application in the previous statistical cycle,
  • the data identifier in the cache in the current statistical cycle is written into the hard disk pointed to by the user data corresponding to the first identifier. While improving the efficiency of user data writing to the hard disk and reducing the risk of data loss, it can avoid a significant impact on normal I / O service performance and has a good flow control effect.
  • the flow control threshold corresponding to the current statistical cycle is automatically adjusted dynamically according to the IO load of the user application in the previous statistical cycle, without manual adjustment by the manager, which reduces the workload of the manager and avoids the subjective factors of the manager The problem caused by inaccurate adjustment.
  • clearing the user data from the cache can save the storage space of the cache and improve the writing of user data into the cache. Efficiency.
  • FIG. 3 is a functional module diagram of a preferred embodiment of a background writing disk flow control device in the present application.
  • the background writing disk flow control device 30 runs in an electronic device.
  • the background writing disk flow control device 30 may include a plurality of functional modules composed of instruction code segments.
  • the program code of each instruction segment in the background writing disk flow control device 30 may be stored in a memory and executed by at least one processor to execute (see Figure 1-2 and related description for details) background writing disk flow ⁇ ⁇ Control method.
  • the background write disk flow control device 30 may be divided into a plurality of function modules according to the functions performed by the background write disk flow control device 30.
  • the functional modules may include: a cache write module 301, a first detection module 302, a flow control acquisition module 303, a hard disk write module 304, a second detection module 305, a cache removal module 306, a flow control calculation module 307, and Model training module 308.
  • the module referred to in the present application refers to a series of computer-readable instruction segments capable of being executed by at least one processor and capable of performing fixed functions, which are stored in a memory. In some embodiments, functions of each module will be described in detail in subsequent embodiments.
  • the cache writing module 301 is configured to write the user data into a configured cache when a user data storage command is received.
  • the electronic device When the electronic device receives a user data storage instruction, it generates a data write instruction and configures a cache memory to write the user data into the configured cache memory.
  • the user data includes: data content, address information, and data identification.
  • the address information includes information such as a source address and a destination address of the user data.
  • the data identifier is used to indicate whether the user data needs to be written to the hard disk.
  • the data identifier may be a first identifier or a second identifier.
  • the data identifier indicates that the user data needs to be written to the hard disk; when the data identifier is the second identifier, it indicates that the user data does not need to be written to the hard disk. For example, if the data identifier is "1", it indicates that the user data needs to be written to the hard disk, and if the data identifier is "0", it indicates that the user data does not need to be written to the hard disk. , You can discard it after use.
  • the first detection module 302 is configured to detect whether the buffered information in the buffer meets a first preset condition.
  • the cache information includes: the remaining storage space in the cache, the total amount of user data in the cache, the cache time of the user data in the cache, and the user data.
  • the total amount of user data refers to the total size of the user data stored in the cache.
  • the first detection module 302 detects whether the cache information in the cache satisfies a first preset condition includes one or more of the following combinations:
  • the cache information in the cache meets a first preset condition; when the remaining storage space in the cache is detected When it is greater than or equal to the preset space threshold, it is determined that the cache information in the cache does not satisfy the first preset condition.
  • the cache information in the cache satisfies a first preset condition; when a user in the cache is detected When the total amount of data is less than or equal to the preset limit threshold, it is determined that the cache information in the cache does not satisfy the first preset condition.
  • the flow control acquisition module 303 is configured to acquire a flow control threshold corresponding to a current statistical period in a write period when the first detection module 302 detects that the cache information in the cache meets the first preset condition.
  • a write cycle can be divided into multiple statistical cycles, and a statistical cycle can be a preset time period. For example, a statistical cycle is set to 1 second.
  • the flow control refers to flow control. There are two methods for implementing flow control: one is to implement flow control based on source address, destination address, source port, destination port, and protocol type through the QoS module of routers and switches; the other is to use professional flow control equipment Implement application-based flow control.
  • the flow control acquisition module 303 acquiring the flow control threshold corresponding to the current statistical period in the writing period may specifically include:
  • the flow control threshold corresponding to the first statistical period in the writing period of the present application is a preset flow control threshold, which can be preset by a system administrator according to experience. That is, a preset flow control threshold is adopted as the flow control threshold of the first statistical period in the writing period.
  • Each remaining statistical period except the first statistical period in the writing period may correspond to a flow control threshold.
  • the flow control threshold corresponding to each remaining statistical period is dynamically adjusted.
  • the flow control threshold corresponding to the current statistical period can be calculated based on the IO load in the previous statistical period.
  • the flow control threshold corresponding to the next statistical period can be based on the current statistical period.
  • the calculated IO load is calculated. Specifically, the flow control threshold corresponding to the second statistical period is calculated according to the IO load in the first statistical period; the flow control threshold corresponding to the third statistical period is calculated according to the IO load in the second statistical period; analogy.
  • the hard disk writing module 304 is configured to write the data in the cache as user data corresponding to the first identifier to the hard disk based on the flow control threshold corresponding to the current statistical period.
  • the data identifier in the cache is that the user data corresponding to the first identifier is data that needs to be written to the hard disk, and the data that needs to be written to the hard disk is written to the hard disk based on the flow control threshold corresponding to the current statistical period. If the flow control threshold corresponding to the current statistical period is large, controlling the speed at which the user data corresponding to the first identifier in the data identifier in the cache is written to the hard disk with a larger flow control threshold can improve the write speed in the hard disk. Speed, alleviates the storage pressure in the cache, and can avoid the problem of user data loss in the cache caused by system power failure or other abnormal situations. If the flow control threshold corresponding to the current statistical period is small, the user data corresponding to the first identifier in the cache data identifier is not written to the hard disk too fast, which avoids a significant impact on normal I / O service performance.
  • a second detection module 305 is configured to detect whether the cache information in the cache satisfies a second condition when the first detection module 302 detects that the cache information in the cache does not satisfy the first preset condition. Preset conditions.
  • the second detecting module 305 detecting whether the cache information in the cache satisfies a second preset condition is: detecting whether a cache time of user data in the cache is earlier than a preset time threshold.
  • the cache clearing module 306 is configured to: when the second detection module 305 detects that the cache information in the cache satisfies the second preset condition, performs identification on the data in the cache as user data corresponding to the second identifier. Clear.
  • the user data corresponding to the second identifier in the cache is the data that does not need to be written to the hard disk.
  • the user data corresponding to the second identifier is not written to the hard disk and it is determined that the second identifier
  • clearing it from the cache can save storage space in the cache, provide more storage space for user data that needs to be written to the hard disk, and improve user data writing to the cache. The speed can further reduce the impact on the IO data of the user application and improve the user experience.
  • the flow control obtaining module 303 is further specifically configured to obtain a data block size of each IO applied by a user in a previous statistical period, and calculate an average data block size of the IO in the previous statistical period.
  • the average data block size of the IO in the last statistical period may be calculated by using an arithmetic average algorithm, a geometric mean algorithm, or a root mean square algorithm.
  • the data block sizes of the ten IOs are: 2M, 1M, 3M, 0.5M, 10M, 4M, 0.1M, 1.2M, 5M. And 8M. Calculating the average data block size of the IO in the previous statistical period by using the arithmetic average algorithm is:
  • the flow control obtaining module 303 is further specifically configured to obtain a transmission delay of each data block in the last statistical period, and calculate an average data block delay of the IO in the last statistical period.
  • the transmission delay refers to the time required for a node to enter a data block from the node to the transmission medium when transmitting data, that is, the time required for a sending site to start sending data frames to the completion of data frame transmission The total time required for a receiving station, or the time required for a receiving station to start receiving data frames and finish receiving data frames.
  • the transmission delay of the data block may be obtained from a load measurement tool or a performance monitoring tool installed in each storage node.
  • the average data block delay of the IO in the last statistical period may also be calculated by using an arithmetic average algorithm, a geometric mean algorithm, or a root mean square algorithm. Assume that assuming that the transmission delays of ten IOs in the previous statistical period are: 1s, 0.8s, 1.5s, 0.4s, 5s, 2s, 0.02s, 0.6s, 3s, and 4.5s, then When the average IO block delay in the previous statistical period is calculated using the arithmetic mean algorithm, the result is:
  • the average data block size of the IO in the previous statistical period is calculated using the arithmetic average algorithm, the average data block delay of the IO in the previous statistical period is also calculated using the arithmetic average algorithm; if The average data block size of the IO in the previous statistical period is calculated using the geometric mean algorithm, and the average data block delay of the IO in the previous statistical period is also calculated using the geometric mean algorithm; or The average data block size of the IO is calculated using the root mean square average algorithm, and the average data block delay of the IO in the previous statistical period is also calculated using the root mean square average algorithm.
  • the flow control obtaining module 303 is further specifically configured to obtain a preset reference value of the data block size of the IO and a reference value of the corresponding data block delay.
  • the reference value of the size of the IO data block and the reference value of the corresponding data block delay may be preset by an administrator of the storage system according to experience. For example, according to experience, when a 4K data block is transmitted, the delay is the smallest, and in the ideal state, it can reach 50ms, then the reference value of the IO data block size can be set to 4k, and the corresponding data block delay reference value can be set. It is 50ms.
  • a flow control calculation module 307 is configured to calculate according to the average data block size, average data block delay, data block size reference value, and corresponding data block delay reference value of the IO in the last statistical period. The IO load intensity in the last statistical period.
  • the average data block size of the IO in the previous statistical period is X
  • the average data block delay is Y
  • the reference value of the data block size is M
  • the reference value of the corresponding data block delay is N
  • the calculation formula of the IO load intensity in the previous statistical period is:
  • the flow control acquisition module 303 determines a IO load category in the previous statistical period by using a pre-trained load classification model according to the IO load intensity in the last statistical period.
  • the IO load category includes: a high load category, a normal load category, and a low load category.
  • the load classification model includes, but is not limited to, a Support Vector Machine (SVM) model.
  • SVM Support Vector Machine
  • Using the average data block size of the IO in the last statistical period, the average data block delay of the IO in the last statistical period, and the IO load intensity in the last statistical period as the load classification model The input is calculated by the load classification model, and the IO load category in the previous statistical period is output.
  • SVM Support Vector Machine
  • a model training module 308 is configured to train a load classification model.
  • the process of training the load classification model by the model training module 308 includes:
  • training samples in the training sets of different load categories are distributed to different folders. For example, training samples of high load category are distributed to the first folder, training samples of normal load category are distributed to the second folder, and training samples of low load category are distributed to the third folder.
  • training samples of the first preset ratio for example, 70%
  • second preset ratios for example, 30%
  • the accuracy rate is greater than or equal to a preset accuracy rate, end training, and use the trained load classification model as a classifier to identify the IO load category in the current statistical period; if the accuracy rate is less than When the accuracy is preset, the number of positive samples and the number of negative samples are increased to retrain the load classification model until the accuracy is greater than or equal to the preset accuracy.
  • the flow control calculation module 307 is further configured to calculate a flow control threshold corresponding to the current statistical period according to the IO load category in the previous statistical period.
  • calculating the flow control threshold corresponding to the current statistical period according to the IO load category in the previous statistical period may include:
  • the first preset amplitude may be 1/2 of a flow control threshold corresponding to a previous statistical period. That is, the flow control threshold corresponding to the current statistical period is 1/2 of the flow control threshold corresponding to the previous statistical period, and the flow control threshold corresponding to the next statistical period is 1/2 of the flow control threshold corresponding to the current statistical period.
  • the second preset amplitude may be 1.5 times a flow control threshold corresponding to a previous statistical period. That is, the flow control threshold corresponding to the current statistical period is 1.5 times the flow control threshold corresponding to the previous statistical period, and the flow control threshold corresponding to the next statistical period is 1.5 times the flow control threshold corresponding to the current statistical period.
  • the flow control threshold corresponding to the previous statistical cycle is used as the flow control threshold corresponding to the current statistical cycle.
  • the background write disk flow control device described in this application writes user data into a configured cache, and detects that the cache information in the cache satisfies the first preset condition and in the current write cycle
  • the data in the cache is identified by a preset flow control threshold as user data corresponding to the first identifier and written to the pointed hard disk; and the cache information in the cache is detected to meet
  • the first preset condition and when the current writing cycle is not the first statistical cycle, the flow control threshold corresponding to the current statistical cycle can be dynamically adjusted according to the IO load of the user application in the previous statistical cycle,
  • the data identifier in the cache in the current statistical cycle is written into the hard disk pointed to by the user data corresponding to the first identifier. While improving the efficiency of user data writing to the hard disk and reducing the risk of data loss, it can avoid a significant impact on normal I / O service performance and has a good flow control effect.
  • the flow control threshold corresponding to the current statistical cycle is automatically adjusted dynamically according to the IO load of the user application in the previous statistical cycle, without manual adjustment by the manager, which reduces the workload of the manager and avoids the subjective factors of the manager The problem caused by inaccurate adjustment.
  • clearing the user data from the cache can save the storage space of the cache and improve the writing of user data into the cache. Efficiency.
  • the above integrated unit implemented in the form of a software functional module may be stored in a non-volatile readable storage medium.
  • the above software function module is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a dual-screen device, or a network device) or a processor to execute the embodiments described in this application. Part of the method.
  • FIG. 4 is a schematic diagram of an electronic device according to a fourth embodiment of the present application.
  • the electronic device 4 includes: a memory 41, at least one processor 42, computer-readable instructions 43 stored in the memory 41 and executable on the at least one processor 42, and at least one communication bus 44.
  • the computer-readable instructions 43 may be divided into one or more modules / units, and the one or more modules / units are stored in the memory 41 and processed by the at least one processor 42 Perform to complete the steps in the above method embodiment of the present application.
  • the one or more modules / units may be a series of computer-readable instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer-readable instructions 43 in the electronic device 4.
  • the electronic device 4 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • the schematic diagram 4 is only an example of the electronic device 4, and does not constitute a limitation on the electronic device 4. It may include more or fewer components than shown in the figure, or combine some components, or be different
  • the electronic device 4 may further include an input / output device, a network access device, a bus, and the like.
  • the at least one processor 42 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), and application-specific integrated circuits (ASICs). ), Ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • the processor 42 may be a microprocessor, or the processor 42 may be any conventional processor, etc.
  • the processor 42 is a control center of the electronic device 4, and uses various interfaces and lines to connect the entire electronic device 4 The various parts.
  • the memory 41 may be configured to store the computer-readable instructions 43 and / or modules / units, and the processor 42 may execute or execute the computer-readable instructions and / or modules / units stored in the memory 41, and Recalling the data stored in the memory 41 to implement various functions of the electronic device 4.
  • the memory 41 may mainly include a storage program area and a storage data area, where the storage program area may store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.), etc .; the storage data area may Data (such as audio data, phonebook, etc.) created according to the use of the electronic device 4 are stored.
  • the memory 41 may include a high-speed random access memory, and may also include a non-volatile memory, such as a hard disk, an internal memory, a plug-in hard disk, a Smart Memory Card (SMC), and a Secure Digital (SD). Card, flash memory card (Flash card), at least one disk storage device, flash memory device, or other volatile solid-state storage device.
  • a non-volatile memory such as a hard disk, an internal memory, a plug-in hard disk, a Smart Memory Card (SMC), and a Secure Digital (SD).
  • SSD Secure Digital
  • flash memory card Flash card
  • flash memory device at least one disk storage device, flash memory device, or other volatile solid-state storage device.
  • the integrated module / unit of the electronic device 4 When the integrated module / unit of the electronic device 4 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile readable storage medium. Based on this understanding, this application implements all or part of the processes in the methods of the above embodiments, and can also be completed by computer-readable instructions to instruct related hardware.
  • the computer-readable instructions can be stored in a non-volatile memory. In the read storage medium, when the computer-readable instructions are executed by a processor, the steps of the foregoing method embodiments can be implemented.
  • the computer-readable instruction code may be in a source code form, an object code form, an executable file, or some intermediate form.
  • the non-volatile readable medium may include: any entity or device capable of carrying the computer-readable instruction code, a recording medium, a U disk, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), electric carrier signals, telecommunication signals, and software distribution media.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • electric carrier signals telecommunication signals
  • telecommunication signals and software distribution media.
  • the content contained in the non-volatile readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practices in the jurisdictions. For example, in some jurisdictions, according to legislation and patent practices, non- Volatile readable media does not include electrical carrier signals and telecommunication signals.
  • each functional unit in each embodiment of the present application may be integrated in the same processing unit, or each unit may exist separately physically, or two or more units may be integrated in the same unit.
  • the integrated unit can be implemented in the form of hardware, or in the form of hardware plus software functional modules.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Debugging And Monitoring (AREA)

Abstract

一种后台写盘流控方法、装置、电子设备及存储介质,该方法包括:当接收到用户数据的存储命令时,将用户数据写入到配置的缓存中(S11);当侦测到缓存中的缓存信息满足第一预设条件时,获取写入周期内的当前统计周期对应的流控阈值(S13);基于当前统计周期对应的流控阈值,将缓存中具有第一标识的用户数据写入到硬盘中(S14);当侦测到缓存中的缓存信息没有满足第一预设条件但满足第二预设条件时,对缓存中具有第二标识的用户数据进行清除(S16)。该方法在提高数据写入硬盘的效率、降低数据丢失风险的同时,能够避免对正常输入输出业务性能造成明显冲击;节省缓存的存储空间,提高数据写入缓存的效率。

Description

后台写盘流控方法、装置、电子设备及存储介质
本申请要求于2018年06月04日提交中国专利局,申请号为201810565748.4发明名称为“后台写盘流控方法、装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,具体涉及一种后台写盘流控方法、装置、电子设备及存储介质。
背景技术
缓存就是数据交换的缓冲区(也称作“Cache”),硬盘接到写入数据的指令之后,并不会马上将数据写入到盘片上,而是先暂时存储在缓存里,然后发送一个“数据已写入”的信号给系统,这时系统就会认为数据已经写入,并继续执行下面的工作。而缓存往往使用的是RAM(断电即掉的非永久储存),所以在缓存中的数据用完后还是会将数据存储到硬盘等存储器里永久存储,这种操作称为后台写盘。
然而,在将缓存中的数据存储到硬盘等存储器的过程中,会产生大量的用户应用的输入输出(input/output,IO),如果此时正好是用户应用的IO高峰期,则会影响用户应用的响应时间,给用户带来不好的体验。传统的解决方法是采取错峰操作,即白天用户应用比较繁忙时,系统IO负载重,此时不进行将缓存中的数据存储到硬盘中的操作,而选择夜晚用户应用较少的时间段执行;但即使是夜晚用户应用的IO也很繁忙,因此错峰操作可能并不适用。
另外,在将缓存数据写入硬盘时,会将一些不需要写入硬盘中的缓存数据写入硬盘,浪费写入时间,挤占了应当被写入硬盘中的缓存数据的时间。
发明内容
鉴于以上内容,有必要提出一种后台写盘流控方法、装置、电子设备及存储介质,能够在提高将缓存中的数据写入到硬盘中的效率、降低数据丢失风险的同时,避免对正常输入输出业务性能造成明显冲击,具有很好的流控效果写入。
本申请的第一方面提供一种后台写盘流控方法,所述方法包括:
当接收到用户数据的存储命令时,将所述用户数据写入到配置的缓存中;
当侦测到所述缓存中的缓存信息满足第一预设条件时,获取写入周期内的当前统计周期对应的流控阈值;
基于所述当前统计周期对应的流控阈值,将所述缓存中数据标识为第一标识对应的用户数据写入到硬盘中;
当侦测到所述缓存中的缓存信息没有满足所述第一预设条件但满足第二预设条件时,对所述缓存中数据标识为第二标识对应的用户数据进行清除。
本申请的第二方面提供一种后台写盘流控装置,所述装置包括:
缓存写入模块,用于当接收到用户数据的存储命令时,将所述用户数据写入到配置的缓存中;
第一侦测模块,用于侦测所述缓存中的缓存信息是否满足第一预设条件;
流控获取模块,用于当所述第一侦测模块侦测到所述缓存中的缓存信息满足第一预设条件时,获取写入周期内的当前统计周期对应的流控阈值;
硬盘写入模块,用于基于所述当前统计周期对应的流控阈值,将所述缓存中数据标识为第一标识对应的用户数据写入到硬盘中;
第二侦测模块,用于当所述第一侦测模块侦测到所述缓存中的缓存信息没有满足第一预设条件时,侦测所述缓存中的缓存信息是否满足第二预设条件;
缓存清除模块,用于当所述第二侦测模块侦测到所述缓存中的缓存信息满足所述第二预设条件时,对所述缓存中数据标识为第二标识对应的用户数据进行清除。
本申请的第三方面提供一种电子设备,所述电子设备包括处理器和存储器,所述处理器用于执行所述存储器中存储的计算机可读指令时实现所述后台写盘流控方法。
本申请的第四方面提供一种非易失性可读存储介质,所述非易失性可读存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现所述后台写盘流控方法。
本申请所述的后台写盘流控方法、装置、电子设备及存储介质,将用户数据写入到配置的缓存中,通过侦测所述缓存中的缓存信息满足第一预设条件时,能够根据不同的流控阈值对当前统计周期内的所述缓存中数据标识为第一标识对应的用户数据写入到所指向的硬盘中,在提高用户数据写入硬盘的效率、降低数据丢失风险的同时,能够避免对正常输入输出业务性能造成明显冲击,具有很好的流控效果;另外,在侦测到所述缓存中的缓存信息不满足第一预设条件但满足第二预设条件时,将用户数据从缓存中清除,可以节省缓存的存储空间,提高用户数据写入缓存中的效率。
附图说明
图1是本申请实施例一提供的后台写盘流控方法的流程图。
图2是本申请实施例二提供的根据上一个统计周期内用户应用的IO负载确定当前统计周期对应的流控阈值的方法的流程图。
图3是本申请实施例三提供的后台写盘流控装置的功能模块图。
图4是本申请实施例四提供的电子设备的示意图。
具体实施方式
本申请实施例的后台写盘流控方法应用在一个或者多个电子设备中。所述后台写盘流控方法也可以应用于由电子设备和通过网络与所述电子设备进行连接的服务器所构成的硬件环境中。网络包括但不限于:广域网、城域网或局域网。本申请实施例的后台写盘流控方法可以由服务器来执行,也可以 由电子设备来执行;还可以是由服务器和电子设备共同执行。
对于需要进行后台写盘流控方法的电子设备,可以直接在电子设备上集成本申请的方法所提供的后台写盘流控功能,或者安装用于实现本申请的方法的客户端。再如,本申请所提供的方法还可以以软件开发工具包(Software Development Kit,SDK)的形式运行在服务器等设备上,以SDK的形式提供后台写盘流控功能的接口,电子设备或其他设备通过提供的接口即可实现对后台写盘进行流控的功能。
实施例一
图1是本申请实施例一提供的后台写盘流控方法的流程图。根据不同的需求,该流程图中的执行顺序可以改变,某些步骤可以省略。
S11、当接收到用户数据的存储命令时,将所述用户数据写入到配置的缓存中。
电子设备接收到用户数据的存储指令时,生成一个写数据指令,并配置一个缓存内存,将用户数据写入到所配置的缓存内存中。
所述用户数据包括:数据内容、地址信息以及数据标识。所述地址信息包括所述用户数据的源地址、目的地址等信息。
所述数据标识用以指示所述用户数据是否需要写入到硬盘中,在本实施例中,所述数据标识可以是第一标识,也可以是第二标识。当所述数据标识是第一标识时,指示所述用户数据需要写入到硬盘中;当所述数据标识是第二标识时,指示所述用户数据不需要写入到硬盘中。例如,若所述数据标识为“1”时,则表明所述用户数据需要写入到硬盘中,若所述数据标识为“0”时,则表明所述用户数据不需要写入到硬盘中,可以在用完之后直接丢弃。
S12、侦测所述缓存中的缓存信息是否满足第一预设条件。
本申请较佳实施例中,所述缓存信息包括:缓存中的剩余存储空间、缓存中的用户数据的总量、缓存中的用户数据的缓存时间及用户数据。所述用户数据的总量是指所述存储在缓存中的用户数据的总大小。
所述侦测所述缓存中的缓存信息是否满足第一预设条件包括以下一种或多种的组合:
1)侦测所述缓存中的剩余存储空间是否小于预设空间阈值;
当侦测到所述缓存中的剩余存储空间小于所述预设空间阈值时,则确定所述缓存中的缓存信息满足了第一预设条件;当侦测到所述缓存中的剩余存储空间大于或者等于所述预设空间阈值时,则确定所述缓存中的缓存信息没有满足第一预设条件。
2)侦测所述缓存中的用户数据的总量是否大于预设限制阈值。
当侦测到所述缓存中的用户数据的总量大于所述预设限制阈值时,则确定所述缓存中的缓存信息满足了第一预设条件;当侦测到所述缓存中的用户数据的总量小于或者等于所述预设限制阈值时,则确定所述缓存中的缓存信息没有满足第一预设条件。
当侦测到所述缓存中的缓存信息满足所述第一预设条件时,执行步骤S13;否则,当侦测到所述缓存中的缓存信息没有满足所述第一预设条件时, 执行步骤S15。
S13、获取写入周期内的当前统计周期对应的流控阈值。
将所述缓存中的用户数据从开始写入硬盘到完成写入的整个过程称之为一个写入周期。一个写入周期可以划分为多个统计周期,一个统计周期可以为一个预设时间段,例如,一个统计周期设置为1秒钟。
所述流控是指流量控制。流控的实现方法包括以下两种:一种是通过路由器、交换机的QoS模块实现基于源地址、目的地址、源端口、目的端口以及协议类型的流量控制;另一种是通过专业的流控设备实现基于应用层的流量控制。
本较佳实施例中,所述获取写入周期内的当前统计周期对应的流控阈值具体可以包括:
1)判断当前统计周期是否为第一个统计周期。
可以通过判断当前时间是否为第1秒来判断当前写入周期是否为第一个统计周期。
2)当确定所述当前统计周期为第一个统计周期时,将预设流控阈值确定为所述当前统计周期对应的流控阈值;
本申请的写入周期内的第一个统计周期对应的流控阈值为预先设置的流控阈值,可以由系统的管理者根据经验预先设置。即,采用一个预设的流控阈值作为写入周期内的第一个统计周期的流控阈值。
3)当确定所述当前统计周期不为第一个统计周期时,获取上一个统计周期内用户应用的IO负载,根据所述上一个统计周期内用户应用的IO负载,确定所述当前统计周期对应的流控阈值。
写入周期内的除第一个统计周期外的剩余每一个统计周期可以对应一个流控阈值。剩余每一个统计周期对应的流控阈值是动态调整的,当前统计周期对应的流控阈值可以根据上一个统计周期内的IO负载计算得到,下一个统计周期对应的流控阈值可以根据当前统计周期内的IO负载计算得到。具体而言,根据第一个统计同期内的IO负载计算第二个统计周期对应的流控阈值;根据第二个统计同期内的IO负载计算第三个统计周期对应的流控阈值;以此类推。
所述根据所述上一个统计周期内用户应用的IO负载,确定所述当前统计周期对应的流控阈值的具体过程可以参见图2及其相应描述。
S14、基于所述当前统计周期对应的流控阈值,将所述缓存中数据标识为第一标识对应的用户数据写入到硬盘中。
所述缓存中数据标识为第一标识对应的用户数据为需要写入到硬盘中的数据,基于当前统计周期对应的流控阈值将需要写入硬盘中的数据写入到硬盘中。若当前统计周期对应的流控阈值较大时,以较大的流控阈值控制所述缓存中数据标识为第一标识对应的用户数据写入到硬盘中的速度,能够提高写入硬盘中的速度,缓解所述缓存中的存储压力,且能避免因系统断电或其他非正常情况发生时导致的所述缓存中的用户数据丢失的问题。若当前统计周期对应的流控阈值较小时,使得所述缓存中数据标识为第一标识对应的用 户数据写入到硬盘中的速度不至于过快,避免对正常输入输出业务性能造成明显冲击。
S15、侦测所述缓存中的缓存信息是否满足第二预设条件。
所述侦测所述缓存中的缓存信息是否满足第二预设条件为:侦测所述缓存中的用户数据的缓存时间是否早于预设时间阈值。
当侦测到所述缓存中的用户数据的缓存时间早于所述预设时间阈值时,则确定所述缓存中的缓存信息满足了第二预设条件;当侦测到所述缓存中的用户数据的缓存时间不早于所述预设时间阈值时,则确定所述缓存中的缓存信息没有满足第二预设条件。
当侦测到所述缓存中的缓存信息满足所述第二预设条件时,执行步骤S16;否则,当侦测到所述缓存中的缓存信息没有满足所述第二预设条件时,可以返回执行步骤S12。
S16、对所述缓存中数据标识为第二标识对应的用户数据进行清除。
所述缓存中数据标识为第二标识对应的用户数据为不需要写入到硬盘中的数据,将数据标识为第二标识对应的用户数据不写入到硬盘中且在确定第二标识对应的用户数据早于预设时间阈值时,将其从所述缓存中清除,能够节省缓存中的存储空间,为需要写入硬盘中的用户数据提供更多的存储空间,提高用户数据写入缓存中的速度,能够进一步减少对用户应用的IO数据的冲击,提高用户体验。
实施例二
图2是本申请实施例二提供的根据上一个统计周期内用户应用的IO负载确定当前统计周期对应的流控阈值的方法的流程图。
S21、获取上一个统计周期内用户应用的每一个IO的数据块大小,计算所述上一个统计周期内的IO的平均数据块大小。
所述上一个统计周期内的IO的平均数据块大小可以采用算术平均值算法、几何平均数算法,或者均方根平均数算法来计算。
举例而言,假设检测到上一个统计周期内,用户应用共有十次IO,十次IO的数据块大小分别为:2M,1M,3M,0.5M,10M,4M,0.1M,1.2M,5M以及8M。利用所述算术平均值算法计算所述上一个统计周期内的IO的平均数据块大小为:
Figure PCTCN2018108129-appb-000001
Figure PCTCN2018108129-appb-000002
S22、获取所述上一个统计周期内的每个数据块的传输时延,计算所述上一个统计周期内的IO的平均数据块时延。
所述传输时延(简称为时延)是指结点在发送数据时使数据块从结点进入到传输媒体所需的时间,即一个发送站点从开始发送数据帧到数据帧发送完毕所需要的全部时间,或者一个接收站点从开始接收数据帧到数据帧接收完毕所需要的全部时间。
在本申请较佳实施例中,所述数据块的传输时延可以从每个存储节点中安装的一个负载量测工具或者性能监控工具中获取得到。
如上所述,所述上一个统计周期内的IO的平均数据块时延也可以采用 算术平均值算法、几何平均数算法,或者均方根平均数算法来计算。假设,假设检测到上一个统计周期内,十次IO的传输时延分别为:1s、0.8s、1.5s、0.4s、5s、2s、0.02s、0.6s、3s及4.5s,则所述上一个统计周期内的IO平均数据块时延采用算术平均值算法来计算时,其结果为:
(1s+0.8s+1.5s+0.4s+5s+2s+0.1s+0.6s+3s+4.4s)=1.88s。
应当理解的是,若上一个统计周期内的IO的平均数据块大小采用算术平均值算法来计算,则上一个统计周期内的IO的平均数据块时延也采用算术平均值算法来计算;若上一个统计周期内的IO的平均数据块大小采用几何平均数算法来计算,则上一个统计周期内的IO的平均数据块时延也采用几何平均数算法来计算;或者若上一个统计周期内的IO的平均数据块大小采用均方根平均数算法来计算,则上一个统计周期内的IO的平均数据块时延也采用均方根平均数算法来计算。
S23、获取预先设置的IO的数据块大小的基准值及对应的数据块时延的基准值。
在本申请较佳实施例中,所述IO数据块大小的基准值以及对应的数据块时延的基准值可以由存储系统的管理员根据经验预先设置。例如,根据经验,4K的数据块在传输时,时延最小,理想状态下可以达到50ms,则所述IO数据块大小的基准值可以设置为4k,对应的数据块时延的基准值可以设置为50ms。
S24、根据所述上一个统计周期内的所述IO的平均数据块大小、平均数据块时延、数据块大小的基准值、对应的数据块时延的基准值,计算所述上一个统计周期内的IO负载强度。
举例而言,假设上一个统计周期内的所述IO的平均数据块大小为X、平均数据块时延为Y、数据块大小的基准值为M、对应的数据块时延的基准值为N,则所述上一个统计周期内的IO负载强度的计算公式为:
Figure PCTCN2018108129-appb-000003
S25、根据所述上一个统计周期内的IO负载强度,利用预先训练好的负载分类模型确定所述上一个统计周期内的IO负载类别。
在本申请较佳实施例中,所述IO负载类别包括:高负载类别、正常负载类别、低负载类别。
优选地,所述负载分类模型包括,但不限于:支持向量机(Support Vector Machine,SVM)模型。将所述上一个统计周期内的IO的平均数据块大小、所述上一个统计周期内的IO的平均数据块时延、所述上一个统计周期内的IO负载强度作为所述负载分类模型的输入,经过所述负载分类模型计算后,输出上一个统计周期内的IO负载类别。
在本申请的优选实施例中,所述负载分类模型的训练过程包括:
1)获取正样本的IO负载数据及负样本的IO负载数据,并将正样本的IO负载数据标注负载类别,以使正样本的IO负载数据携带IO负载类别标签。
例如,分别选取500个高负载类别、正常负载类别、低负载类别对应的IO负载数据,并对每个IO负载数据标注类别,可以以“1”作为高负载的IO 数据标签,以“2”作为正常负载的IO数据标签,以“3”作为低负载的IO数据标签。
2)将所述正样本的IO负载数据及所述负样本的IO负载数据随机分成第一预设比例的训练集和第二预设比例的验证集,利用所述训练集训练所述负载分类模型,并利用所述验证集验证训练后的所述负载分类模型的准确率。
先将不同负载类别的训练集中的训练样本分发到不同的文件夹里。例如,将高负载类别的训练样本分发到第一文件夹里、正常负载类别的训练样本分发到第二文件夹里、低负载类别的训练样本分发到第三文件夹里。然后从不同的文件夹里分别提取第一预设比例(例如,70%)的训练样本作为总的训练样本进行负载分类模型的训练,从不同的文件夹里分别取剩余第二预设比例(例如,30%)的训练样本作为总的测试样本对训练完成的所述负载分类模型进行准确性验证。
3)若所述准确率大于或者等于预设准确率时,则结束训练,以训练后的所述负载分类模型作为分类器识别所述当前统计周期内的IO负载类别;若所述准确率小于预设准确率时,则增加正样本数量及负样本数量以重新训练所述负载分类模型直至所述准确率大于或者等于预设准确率。
S26、根据上一个统计周期内的IO负载类别计算当前统计周期对应的流控阈值。
具体的,所述根据上一个统计周期内的IO负载类别计算当前统计周期对应的流控阈值可以包括:
1)当所述上一个统计周期内的IO负载类别为高负载类别时,将所述上一个统计周期对应的流控阈值降低第一预设幅度,得到当前统计周期对应的流控阈值。
在上一个统计周期内的IO负载为高负载时,按照所述第一预设幅度降低流控阈值,以在当前统计周期内以低流控阈值对所述缓存中的数据执行写入操作,通过降低数据写入的速度来保证用户应用的高效访问。
在本申请的优选实施例中,所述第一预设幅度可以是上一个统计周期对应的流控阈值的1/2。即当前统计周期对应的流控阈值为上一个统计周期对应的流控阈值的1/2,下一个统计周期对应的流控阈值为当前统计周期对应的流控阈值的1/2。
2)当所述上一个统计周期内的IO负载类别为低负载类别时,将所述上一个统计周期对应的流控阈值提高第二预设幅度,得到下一个统计周期对应的流控阈值。
在上一个统计周期内的IO负载为低负载时,按照所述第二预设幅度提高流控阈值,以在当前统计周期内以高流控阈值对所述缓存中的数据执行写入操作,在保证用户应用的访问质量的基础上,提高数据写入的速度。
在本申请的优选实施例中,所述第二预设幅度可以是上一个统计周期对应的流控阈值的1.5倍。即当前统计周期对应的流控阈值为上一个统计周期对应的流控阈值的1.5倍,下一个统计周期对应的流控阈值为当前统计周期对应的流控阈值的1.5倍。
3)当所述上一个统计周期内的IO负载类别为正常负载类别时,将所述上一个统计周期对应的流控阈值作为当前统计周期对应的流控阈值。
综上所述,本申请所述的后台写盘流控方法,将用户数据写入到配置的缓存中,通过侦测所述缓存中的缓存信息满足第一预设条件并且在当前写入周期为第一个统计周期时,以预设流控阈值将所述缓存中数据标识为第一标识对应的用户数据写入到所指向的硬盘中;而在侦测所述缓存中的缓存信息满足第一预设条件并且在当前写入周期不为第一个统计周期时,能够根据上一个统计周期内用户应用的IO负载动态调整当前统计周期对应的流控阈值,根据不同的流控阈值对当前统计周期内的所述缓存中数据标识为第一标识对应的用户数据写入到所指向的硬盘中。在提高用户数据写入硬盘的效率、降低数据丢失风险的同时,能够避免对正常输入输出业务性能造成明显冲击,具有很好的流控效果。
其次,当前统计周期对应的流控阈值是根据上一个统计周期内用户应用的IO负载自动进行动态调整,不需管理者手动调节,减少了管理者的工作量,避免了因管理者的主观因素导致的调整不精准的问题。
另外,在侦测到所述缓存中的缓存信息不满足第一预设条件但满足第二预设条件时,将用户数据从缓存中清除,可以节省缓存的存储空间,提高用户数据写入缓存中的效率。
以上所述,仅是本申请的具体实施方式,但本申请的保护范围并不局限于此,对于本领域的普通技术人员来说,在不脱离本申请创造构思的前提下,还可以做出改进,但这些均属于本申请的保护范围。
下面结合第3至4图,分别对实现上述后台写盘流控方法的电子设备的功能模块及硬件结构进行介绍。
实施例三
图3为本申请后台写盘流控装置较佳实施例中的功能模块图。
在一些实施例中,所述后台写盘流控装置30运行于电子设备中。所述后台写盘流控装置30可以包括多个由指令代码段所组成的功能模块。所述后台写盘流控装置30中的各个指令段的程序代码可以存储于存储器中,并由至少一个处理器所执行,以执行(详见图1-2及其相关描述)后台写盘流控方法。
本实施例中,所述后台写盘流控装置30根据其所执行的功能,可以被划分为多个功能模块。所述功能模块可以包括:缓存写入模块301、第一侦测模块302、流控获取模块303、硬盘写入模块304、第二侦测模块305、缓存清除模块306、流控计算模块307及模型训练模块308。本申请所称的模块是指一种能够被至少一个处理器所执行并且能够完成固定功能的一系列计算机可读指令段,其存储在存储器中。在一些实施例中,关于各模块的功能将在后续的实施例中详述。
缓存写入模块301,用于当接收到用户数据的存储命令时,将所述用户数据写入到配置的缓存中。
电子设备接收到用户数据的存储指令时,生成一个写数据指令,并配置一个缓存内存,将用户数据写入到所配置的缓存内存中。
所述用户数据包括:数据内容、地址信息以及数据标识。所述地址信息包括所述用户数据的源地址、目的地址等信息。
所述数据标识用以指示所述用户数据是否需要写入到硬盘中,在本实施例中,所述数据标识可以是第一标识,也可以是第二标识。当所述数据标识是第一标识时,指示所述用户数据需要写入到硬盘中;当所述数据标识是第二标识时,指示所述用户数据不需要写入到硬盘中。例如,若所述数据标识为“1”时,则表明所述用户数据需要写入到硬盘中,若所述数据标识为“0”时,则表明所述用户数据不需要写入到硬盘中,可以在用完之后直接丢弃。
第一侦测模块302,用于侦测所述缓存中的缓存信息是否满足第一预设条件。
本申请较佳实施例中,所述缓存信息包括:缓存中的剩余存储空间、缓存中的用户数据的总量、缓存中的用户数据的缓存时间及用户数据。所述用户数据的总量是指所述存储在缓存中的用户数据的总大小。
所述第一侦测模块302侦测所述缓存中的缓存信息是否满足第一预设条件包括以下一种或多种的组合:
1)侦测所述缓存中的剩余存储空间是否小于预设空间阈值;
当侦测到所述缓存中的剩余存储空间小于所述预设空间阈值时,则确定所述缓存中的缓存信息满足了第一预设条件;当侦测到所述缓存中的剩余存储空间大于或者等于所述预设空间阈值时,则确定所述缓存中的缓存信息没有满足第一预设条件。
2)侦测所述缓存中的用户数据的总量是否大于预设限制阈值。
当侦测到所述缓存中的用户数据的总量大于所述预设限制阈值时,则确定所述缓存中的缓存信息满足了第一预设条件;当侦测到所述缓存中的用户数据的总量小于或者等于所述预设限制阈值时,则确定所述缓存中的缓存信息没有满足第一预设条件。
流控获取模块303,用于当第一侦测模块302侦测到所述缓存中的缓存信息满足所述第一预设条件时,获取写入周期内的当前统计周期对应的流控阈值。
将所述缓存中的用户数据从开始写入硬盘到完成写入的整个过程称之为一个写入周期。一个写入周期可以划分为多个统计周期,一个统计周期可以为一个预设时间段,例如,一个统计周期设置为1秒钟。
所述流控是指流量控制。流控的实现方法包括以下两种:一种是通过路由器、交换机的QoS模块实现基于源地址、目的地址、源端口、目的端口以及协议类型的流量控制;另一种是通过专业的流控设备实现基于应用层的流量控制。
本较佳实施例中,所述流控获取模块303获取写入周期内的当前统计周期对应的流控阈值具体可以包括:
1)判断当前统计周期是否为第一个统计周期。
可以通过判断当前时间是否为第1秒来判断当前写入周期是否为第一个统计周期。
2)当确定所述当前统计周期为第一个统计周期时,将预设流控阈值确定为所述当前统计周期对应的流控阈值;
本申请的写入周期内的第一个统计周期对应的流控阈值为预先设置的流控阈值,可以由系统的管理者根据经验预先设置。即,采用一个预设的流控阈值作为写入周期内的第一个统计周期的流控阈值。
3)当确定所述当前统计周期不为第一个统计周期时,获取上一个统计周期内用户应用的IO负载,根据所述上一个统计周期内用户应用的IO负载,确定所述当前统计周期对应的流控阈值。
写入周期内的除第一个统计周期外的剩余每一个统计周期可以对应一个流控阈值。剩余每一个统计周期对应的流控阈值是动态调整的,当前统计周期对应的流控阈值可以根据上一个统计周期内的IO负载计算得到,下一个统计周期对应的流控阈值可以根据当前统计周期内的IO负载计算得到。具体而言,根据第一个统计同期内的IO负载计算第二个统计周期对应的流控阈值;根据第二个统计同期内的IO负载计算第三个统计周期对应的流控阈值;以此类推。
硬盘写入模块304,用于基于所述当前统计周期对应的流控阈值,将所述缓存中数据标识为第一标识对应的用户数据写入到硬盘中。
所述缓存中数据标识为第一标识对应的用户数据为需要写入到硬盘中的数据,基于当前统计周期对应的流控阈值将需要写入硬盘中的数据写入到硬盘中。若当前统计周期对应的流控阈值较大时,以较大的流控阈值控制所述缓存中数据标识为第一标识对应的用户数据写入到硬盘中的速度,能够提高写入硬盘中的速度,缓解所述缓存中的存储压力,且能避免因系统断电或其他非正常情况发生时导致的所述缓存中的用户数据丢失的问题。若当前统计周期对应的流控阈值较小时,使得所述缓存中数据标识为第一标识对应的用户数据写入到硬盘中的速度不至于过快,避免对正常输入输出业务性能造成明显冲击。
第二侦测模块305,用于当第一侦测模块302侦测到所述缓存中的缓存信息没有满足所述第一预设条件时,侦测所述缓存中的缓存信息是否满足第二预设条件。
所述第二侦测模块305侦测所述缓存中的缓存信息是否满足第二预设条件为:侦测所述缓存中的用户数据的缓存时间是否早于预设时间阈值。
当侦测到所述缓存中的用户数据的缓存时间早于所述预设时间阈值时,则确定所述缓存中的缓存信息满足了第二预设条件;当侦测到所述缓存中的用户数据的缓存时间不早于所述预设时间阈值时,则确定所述缓存中的缓存信息没有满足第二预设条件。
缓存清除模块306,用于当第二侦测模块305侦测到所述缓存中的缓存信息满足所述第二预设条件时,对所述缓存中数据标识为第二标识对应的用户数据进行清除。
所述缓存中数据标识为第二标识对应的用户数据为不需要写入到硬盘中的数据,将数据标识为第二标识对应的用户数据不写入到硬盘中且在确定第 二标识对应的用户数据早于预设时间阈值时,将其从所述缓存中清除,能够节省缓存中的存储空间,为需要写入硬盘中的用户数据提供更多的存储空间,提高用户数据写入缓存中的速度,能够进一步减少对用户应用的IO数据的冲击,提高用户体验。
流控获取模块303具体还用于获取上一个统计周期内用户应用的每一个IO的数据块大小,计算所述上一个统计周期内的IO的平均数据块大小。
所述上一个统计周期内的IO的平均数据块大小可以采用算术平均值算法、几何平均数算法,或者均方根平均数算法来计算。
举例而言,假设检测到上一个统计周期内,用户应用共有十次IO,十次IO的数据块大小分别为:2M,1M,3M,0.5M,10M,4M,0.1M,1.2M,5M以及8M。利用所述算术平均值算法计算所述上一个统计周期内的IO的平均数据块大小为:
Figure PCTCN2018108129-appb-000004
Figure PCTCN2018108129-appb-000005
流控获取模块303具体还用于获取所述上一个统计周期内的每个数据块的传输时延,计算所述上一个统计周期内的IO的平均数据块时延。
所述传输时延(简称为时延)是指结点在发送数据时使数据块从结点进入到传输媒体所需的时间,即一个发送站点从开始发送数据帧到数据帧发送完毕所需要的全部时间,或者一个接收站点从开始接收数据帧到数据帧接收完毕所需要的全部时间。
在本申请较佳实施例中,所述数据块的传输时延可以从每个存储节点中安装的一个负载量测工具或者性能监控工具中获取得到。
如上所述,所述上一个统计周期内的IO的平均数据块时延也可以采用算术平均值算法、几何平均数算法,或者均方根平均数算法来计算。假设,假设检测到上一个统计周期内,十次IO的传输时延分别为:1s、0.8s、1.5s、0.4s、5s、2s、0.02s、0.6s、3s及4.5s,则所述上一个统计周期内的IO平均数据块时延采用算术平均值算法来计算时,其结果为:
(1s+0.8s+1.5s+0.4s+5s+2s+0.1s+0.6s+3s+4.4s)=1.88s。
应当理解的是,若上一个统计周期内的IO的平均数据块大小采用算术平均值算法来计算,则上一个统计周期内的IO的平均数据块时延也采用算术平均值算法来计算;若上一个统计周期内的IO的平均数据块大小采用几何平均数算法来计算,则上一个统计周期内的IO的平均数据块时延也采用几何平均数算法来计算;或者若上一个统计周期内的IO的平均数据块大小采用均方根平均数算法来计算,则上一个统计周期内的IO的平均数据块时延也采用均方根平均数算法来计算。
流控获取模块303具体还用于获取预先设置的IO的数据块大小的基准值及对应的数据块时延的基准值。
在本申请较佳实施例中,所述IO数据块大小的基准值以及对应的数据块时延的基准值可以由存储系统的管理员根据经验预先设置。例如,根据经验,4K的数据块在传输时,时延最小,理想状态下可以达到50ms,则所述IO数据块大小的基准值可以设置为4k,对应的数据块时延的基准值可以设 置为50ms。
流控计算模块307,用于根据所述上一个统计周期内的所述IO的平均数据块大小、平均数据块时延、数据块大小的基准值、对应的数据块时延的基准值,计算所述上一个统计周期内的IO负载强度。
举例而言,假设上一个统计周期内的所述IO的平均数据块大小为X、平均数据块时延为Y、数据块大小的基准值为M、对应的数据块时延的基准值为N,则所述上一个统计周期内的IO负载强度的计算公式为:
Figure PCTCN2018108129-appb-000006
流控获取模块303根据所述上一个统计周期内的IO负载强度,利用预先训练好的负载分类模型确定所述上一个统计周期内的IO负载类别。
在本申请较佳实施例中,所述IO负载类别包括:高负载类别、正常负载类别、低负载类别。
优选地,所述负载分类模型包括,但不限于:支持向量机(Support Vector Machine,SVM)模型。将所述上一个统计周期内的IO的平均数据块大小、所述上一个统计周期内的IO的平均数据块时延、所述上一个统计周期内的IO负载强度作为所述负载分类模型的输入,经过所述负载分类模型计算后,输出上一个统计周期内的IO负载类别。
模型训练模块308,用于训练负载分类模型。
在本申请的优选实施例中,所述模型训练模块308训练负载分类模型的过程包括:
1)获取正样本的IO负载数据及负样本的IO负载数据,并将正样本的IO负载数据标注负载类别,以使正样本的IO负载数据携带IO负载类别标签。
例如,分别选取500个高负载类别、正常负载类别、低负载类别对应的IO负载数据,并对每个IO负载数据标注类别,可以以“1”作为高负载的IO数据标签,以“2”作为正常负载的IO数据标签,以“3”作为低负载的IO数据标签。
2)将所述正样本的IO负载数据及所述负样本的IO负载数据随机分成第一预设比例的训练集和第二预设比例的验证集,利用所述训练集训练所述负载分类模型,并利用所述验证集验证训练后的所述负载分类模型的准确率。
先将不同负载类别的训练集中的训练样本分发到不同的文件夹里。例如,将高负载类别的训练样本分发到第一文件夹里、正常负载类别的训练样本分发到第二文件夹里、低负载类别的训练样本分发到第三文件夹里。然后从不同的文件夹里分别提取第一预设比例(例如,70%)的训练样本作为总的训练样本进行负载分类模型的训练,从不同的文件夹里分别取剩余第二预设比例(例如,30%)的训练样本作为总的测试样本对训练完成的所述负载分类模型进行准确性验证。
3)若所述准确率大于或者等于预设准确率时,则结束训练,以训练后的所述负载分类模型作为分类器识别所述当前统计周期内的IO负载类别;若所述准确率小于预设准确率时,则增加正样本数量及负样本数量以重新训练所述负载分类模型直至所述准确率大于或者等于预设准确率。
流控计算模块307,还用于根据上一个统计周期内的IO负载类别计算当前统计周期对应的流控阈值。
具体的,所述根据上一个统计周期内的IO负载类别计算当前统计周期对应的流控阈值可以包括:
1)当所述上一个统计周期内的IO负载类别为高负载类别时,将所述上一个统计周期对应的流控阈值降低第一预设幅度,得到当前统计周期对应的流控阈值。
在上一个统计周期内的IO负载为高负载时,按照所述第一预设幅度降低流控阈值,以在当前统计周期内以低流控阈值对所述缓存中的数据执行写入操作,通过降低数据写入的速度来保证用户应用的高效访问。
在本申请的优选实施例中,所述第一预设幅度可以是上一个统计周期对应的流控阈值的1/2。即当前统计周期对应的流控阈值为上一个统计周期对应的流控阈值的1/2,下一个统计周期对应的流控阈值为当前统计周期对应的流控阈值的1/2。
2)当所述上一个统计周期内的IO负载类别为低负载类别时,将所述上一个统计周期对应的流控阈值提高第二预设幅度,得到下一个统计周期对应的流控阈值。
在上一个统计周期内的IO负载为低负载时,按照所述第二预设幅度提高流控阈值,以在当前统计周期内以高流控阈值对所述缓存中的数据执行写入操作,在保证用户应用的访问质量的基础上,提高数据写入的速度。
在本申请的优选实施例中,所述第二预设幅度可以是上一个统计周期对应的流控阈值的1.5倍。即当前统计周期对应的流控阈值为上一个统计周期对应的流控阈值的1.5倍,下一个统计周期对应的流控阈值为当前统计周期对应的流控阈值的1.5倍。
3)当所述上一个统计周期内的IO负载类别为正常负载类别时,将所述上一个统计周期对应的流控阈值作为当前统计周期对应的流控阈值。
综上所述,本申请所述的后台写盘流控装置,将用户数据写入到配置的缓存中,通过侦测所述缓存中的缓存信息满足第一预设条件并且在当前写入周期为第一个统计周期时,以预设流控阈值将所述缓存中数据标识为第一标识对应的用户数据写入到所指向的硬盘中;而在侦测所述缓存中的缓存信息满足第一预设条件并且在当前写入周期不为第一个统计周期时,能够根据上一个统计周期内用户应用的IO负载动态调整当前统计周期对应的流控阈值,根据不同的流控阈值对当前统计周期内的所述缓存中数据标识为第一标识对应的用户数据写入到所指向的硬盘中。在提高用户数据写入硬盘的效率、降低数据丢失风险的同时,能够避免对正常输入输出业务性能造成明显冲击,具有很好的流控效果。
其次,当前统计周期对应的流控阈值是根据上一个统计周期内用户应用的IO负载自动进行动态调整,不需管理者手动调节,减少了管理者的工作量,避免了因管理者的主观因素导致的调整不精准的问题。
另外,在侦测到所述缓存中的缓存信息不满足第一预设条件但满足第二 预设条件时,将用户数据从缓存中清除,可以节省缓存的存储空间,提高用户数据写入缓存中的效率。
上述以软件功能模块的形式实现的集成的单元,可以存储在一个非易失性可读取存储介质中。上述软件功能模块存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,双屏设备,或者网络设备等)或处理器(processor)执行本申请各个实施例所述方法的部分。
实施例四
图4为本申请实施例四提供的电子设备的示意图。
所述电子设备4包括:存储器41、至少一个处理器42、存储在所述存储器41中并可在所述至少一个处理器42上运行的计算机可读指令43及至少一条通讯总线44。
所述至少一个处理器42执行所述计算机可读指令43时实现上述方法实施例中的步骤。
示例性的,所述计算机可读指令43可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器41中,并由所述至少一个处理器42执行,以完成本申请上述方法实施例中的步骤。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机可读指令段,该指令段用于描述所述计算机可读指令43在所述电子设备4中的执行过程。
所述电子设备4可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。本领域技术人员可以理解,所述示意图4仅仅是电子设备4的示例,并不构成对电子设备4的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述电子设备4还可以包括输入输出设备、网络接入设备、总线等。
所述至少一个处理器42可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。该处理器42可以是微处理器或者该处理器42也可以是任何常规的处理器等,所述处理器42是所述电子设备4的控制中心,利用各种接口和线路连接整个电子设备4的各个部分。
所述存储器41可用于存储所述计算机可读指令43和/或模块/单元,所述处理器42通过运行或执行存储在所述存储器41内的计算机可读指令和/或模块/单元,以及调用存储在存储器41内的数据,实现所述电子设备4的各种功能。所述存储器41可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据电子设备4的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器41可以包括高速随机存取存储器,还可以包括非易失性存储器,例如硬盘、内存、插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡, 闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。
所述电子设备4集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个非易失性可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一非易失性可读存储介质中,该计算机可读指令在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机可读指令代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述非易失性可读介质可以包括:能够携带所述计算机可读指令代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述非易失性可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,非易失性可读介质不包括电载波信号和电信信号。
在本申请所提供的几个实施例中,应该理解到,所揭露的电子设备和方法,可以通过其它的方式实现。例如,以上所描述的电子设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
另外,在本申请各个实施例中的各功能单元可以集成在相同处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在相同单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。
对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。此外,显然“包括”一词不排除其他单元或,单数不排除复数。系统权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第一,第二等词语用来表示名称,而并不表示任何特定的顺序。
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神范围。

Claims (20)

  1. 一种后台写盘流控方法,其特征在于,所述方法包括:
    当接收到用户数据的存储命令时,将所述用户数据写入到配置的缓存中;
    当侦测到所述缓存中的缓存信息满足第一预设条件时,获取写入周期内的当前统计周期对应的流控阈值;
    基于所述当前统计周期对应的流控阈值,将所述缓存中数据标识为第一标识对应的用户数据写入到硬盘中;
    当侦测到所述缓存中的缓存信息没有满足所述第一预设条件但满足第二预设条件时,对所述缓存中数据标识为第二标识对应的用户数据进行清除。
  2. 如权利要求1所述的方法,其特征在于,所述获取写入周期内的当前统计周期对应的流控阈值包括:
    判断当前统计周期是否为第一个统计周期;
    当确定所述当前统计周期为第一个统计周期时,将预设流控阈值确定为所述当前统计周期对应的流控阈值;
    当确定所述当前统计周期不为第一个统计周期时,获取上一个统计周期内用户应用的IO负载,根据所述上一个统计周期内用户应用的IO负载,确定所述当前统计周期对应的流控阈值。
  3. 如权利要求2所述的方法,其特征在于,根据所述上一个统计周期内用户应用的IO负载,确定所述当前统计周期对应的流控阈值包括:
    获取上一个统计周期内用户应用的每一个IO的数据块大小,计算所述上一个统计周期内的IO的平均数据块大小;
    获取所述上一个统计周期内的每个数据块的传输时延,计算所述上一个统计周期内的IO的平均数据块时延;
    获取预先设置的IO的数据块大小的基准值及对应的数据块时延的基准值;
    根据所述上一个统计周期内的所述IO的平均数据块大小、平均数据块时延、数据块大小的基准值、对应的数据块时延的基准值,计算所述上一个统计周期内的IO负载强度;
    根据所述上一个统计周期内的IO负载强度,利用预先训练好的负载分类模型确定所述上一个统计周期内的IO负载类别;
    根据上一个统计周期内的IO负载类别计算当前统计周期对应的流控阈值。
  4. 如权利要求3所述的方法,其特征在于,所述根据所述上一个统计周期内的所述IO的平均数据块大小、平均数据块时延、数据块大小的基准值、对应的数据块时延的基准值,计算所述上一个统计周期内的IO负载强度的计算公式为:
    Figure PCTCN2018108129-appb-100001
    其中,X为上述上一个统计周期内的所述IO的平均数据块大小,Y为所述平均数据块时延,M为所述数据块大小的基准值,N为所述对应的数据块时延的基准值。
  5. 如权利要求3或4所述的方法,其特征在于,所述根据上一个统计周期内的IO负载类别计算当前统计周期对应的流控阈值包括:
    当所述上一个统计周期内的IO负载类别为高负载类别时,将所述上一个统计周期对应的流控阈值降低第一预设幅度,得到当前统计周期对应的流控阈值;
    当所述上一个统计周期内的IO负载类别为低负载类别时,将所述上一个统计周期对应的流控阈值提高第二预设幅度,得到下一个统计周期对应的流控阈值;
    当所述上一个统计周期内的IO负载类别为正常负载类别时,将所述上一个统计周期对应的流控阈值作为当前统计周期对应的流控阈值。
  6. 如权利要求1至4中任意一项所述的方法,其特征在于,所述侦测所述缓存中的缓存信息是否满足第一预设条件包括以下一种或多种的组合:
    侦测所述缓存中的剩余存储空间是否小于预设空间阈值;
    侦测所述缓存中的用户数据的总量是否大于预设限制阈值。
  7. 如权利要求1至4中任意一项所述的方法,其特征在于,所述侦测所述缓存中的缓存信息是否满足第二预设条件为:侦测所述缓存中的用户数据的缓存时间是否早于预设时间阈值。
  8. 一种后台写盘流控装置,其特征在于,所述装置包括:
    缓存写入模块,用于当接收到用户数据的存储命令时,将所述用户数据写入到配置的缓存中;
    第一侦测模块,用于侦测所述缓存中的缓存信息是否满足第一预设条件;
    流控获取模块,用于当所述第一侦测模块侦测到所述缓存中的缓存信息满足第一预设条件时,获取写入周期内的当前统计周期对应的流控阈值;
    硬盘写入模块,用于基于所述当前统计周期对应的流控阈值,将所述缓存中数据标识为第一标识对应的用户数据写入到硬盘中;
    第二侦测模块,用于当所述第一侦测模块侦测到所述缓存中的缓存信息没有满足第一预设条件时,侦测所述缓存中的缓存信息是否满足第二预设条件;
    缓存清除模块,用于当所述第二侦测模块侦测到所述缓存中的缓存信息满足所述第二预设条件时,对所述缓存中数据标识为第二标识对应的用户数据进行清除。
  9. 一种电子设备,其特征在于,所述电子设备包括处理器和存储器,所述存储器用于存储至少一个计算机可读指令,所述处理器用于执行所述至少一个计算机可读指令时实现以下步骤:
    当接收到用户数据的存储命令时,将所述用户数据写入到配置的缓存中;
    当侦测到所述缓存中的缓存信息满足第一预设条件时,获取写入周期内的当前统计周期对应的流控阈值;
    基于所述当前统计周期对应的流控阈值,将所述缓存中数据标识为第一标识对应的用户数据写入到硬盘中;
    当侦测到所述缓存中的缓存信息没有满足所述第一预设条件但满足第二预设条件时,对所述缓存中数据标识为第二标识对应的用户数据进行清除。
  10. 如权利要求9所述的电子设备,其特征在于,所述获取写入周期内的当前统计周期对应的流控阈值包括:
    判断当前统计周期是否为第一个统计周期;
    当确定所述当前统计周期为第一个统计周期时,将预设流控阈值确定为所述当前统计周期对应的流控阈值;
    当确定所述当前统计周期不为第一个统计周期时,获取上一个统计周期内用户应用的IO负载,根据所述上一个统计周期内用户应用的IO负载,确定所述当前统计周期对应的流控阈值。
  11. 如权利要求10所述的电子设备,其特征在于,根据所述上一个统计周期内用户应用的IO负载,确定所述当前统计周期对应的流控阈值包括:
    获取上一个统计周期内用户应用的每一个IO的数据块大小,计算所述上一个统计周期内的IO的平均数据块大小;
    获取所述上一个统计周期内的每个数据块的传输时延,计算所述上一个统计周期内的IO的平均数据块时延;
    获取预先设置的IO的数据块大小的基准值及对应的数据块时延的基准值;
    根据所述上一个统计周期内的所述IO的平均数据块大小、平均数据块时延、数据块大小的基准值、对应的数据块时延的基准值,计算所述上一个统计周期内的IO负载强度;
    根据所述上一个统计周期内的IO负载强度,利用预先训练好的负载分类模型确定所述上一个统计周期内的IO负载类别;
    根据上一个统计周期内的IO负载类别计算当前统计周期对应的流控阈值。
  12. 如权利要求11所述的电子设备,其特征在于,所述根据所述上一个统计周期内的所述IO的平均数据块大小、平均数据块时延、数据块大小的基准值、对应的数据块时延的基准值,计算所述上一个统计周期内的IO负载强度的计算公式为:
    Figure PCTCN2018108129-appb-100002
    其中,X为上述上一个统计周期内的所述IO的平均数据块大小,Y为所述平均数据块时延,M为所述数据块大小的基准值,N为所述对应的数据块时延的基准值。
  13. 如权利要求11或12所述的电子设备,其特征在于,所述根据上一个统计周期内的IO负载类别计算当前统计周期对应的流控阈值包括:
    当所述上一个统计周期内的IO负载类别为高负载类别时,将所述上一个统计周期对应的流控阈值降低第一预设幅度,得到当前统计周期对应的流控阈值;
    当所述上一个统计周期内的IO负载类别为低负载类别时,将所述上一个统计周期对应的流控阈值提高第二预设幅度,得到下一个统计周期对应的流控阈值;
    当所述上一个统计周期内的IO负载类别为正常负载类别时,将所述上一个统计周期对应的流控阈值作为当前统计周期对应的流控阈值。
  14. 如权利要求9至12中任意一项所述的电子设备,其特征在于,所述侦测所述缓存中的缓存信息是否满足第一预设条件包括以下一种或多种的组合:
    侦测所述缓存中的剩余存储空间是否小于预设空间阈值;
    侦测所述缓存中的用户数据的总量是否大于预设限制阈值。
  15. 一种非易失性可读存储介质,所述非易失性可读存储介质上存储有计算机可读指令,其特征在于,所述至少一个指令被处理器执行时实现以下步骤:
    当接收到用户数据的存储命令时,将所述用户数据写入到配置的缓存中;
    当侦测到所述缓存中的缓存信息满足第一预设条件时,获取写入周期内的当前统计周期对应的流控阈值;
    基于所述当前统计周期对应的流控阈值,将所述缓存中数据标识为第一标识对应的用户数据写入到硬盘中;
    当侦测到所述缓存中的缓存信息没有满足所述第一预设条件但满足第二预设条件时,对所述缓存中数据标识为第二标识对应的用户数据进行清除。
  16. 如权利要求15所述的存储介质,其特征在于,所述获取写入周期内的当前统计周期对应的流控阈值包括:
    判断当前统计周期是否为第一个统计周期;
    当确定所述当前统计周期为第一个统计周期时,将预设流控阈值确定为所述当前统计周期对应的流控阈值;
    当确定所述当前统计周期不为第一个统计周期时,获取上一个统计周期内用户应用的IO负载,根据所述上一个统计周期内用户应用的IO负载,确定所述当前统计周期对应的流控阈值。
  17. 如权利要求16所述的存储介质,其特征在于,根据所述上一个统计周期内用户应用的IO负载,确定所述当前统计周期对应的流控阈值包括:
    获取上一个统计周期内用户应用的每一个IO的数据块大小,计算所述上一个统计周期内的IO的平均数据块大小;
    获取所述上一个统计周期内的每个数据块的传输时延,计算所述上一个统计周期内的IO的平均数据块时延;
    获取预先设置的IO的数据块大小的基准值及对应的数据块时延的基准值;
    根据所述上一个统计周期内的所述IO的平均数据块大小、平均数据块时延、数据块大小的基准值、对应的数据块时延的基准值,计算所述上一个统计周期内的IO负载强度;
    根据所述上一个统计周期内的IO负载强度,利用预先训练好的负载分类模型确定所述上一个统计周期内的IO负载类别;
    根据上一个统计周期内的IO负载类别计算当前统计周期对应的流控阈值。
  18. 如权利要求17所述的存储介质,其特征在于,所述根据所述上一个统计周期内的所述IO的平均数据块大小、平均数据块时延、数据块大小的基准值、对应的数据块时延的基准值,计算所述上一个统计周期内的IO负载强度的计算公式为:
    Figure PCTCN2018108129-appb-100003
    其中,X为上述上一个统计周期内的所述IO的平均数据块大小,Y为所述平均数据块时延,M为所述数据块大小的基准值,N为所述对应的数据块时延的基准值。
  19. 如权利要求17或18所述的存储介质,其特征在于,所述根据上一个统计周期内的IO负载类别计算当前统计周期对应的流控阈值包括:
    当所述上一个统计周期内的IO负载类别为高负载类别时,将所述上一个统计周期对应的流控阈值降低第一预设幅度,得到当前统计周期对应的流控阈值;
    当所述上一个统计周期内的IO负载类别为低负载类别时,将所述上一个统 计周期对应的流控阈值提高第二预设幅度,得到下一个统计周期对应的流控阈值;
    当所述上一个统计周期内的IO负载类别为正常负载类别时,将所述上一个统计周期对应的流控阈值作为当前统计周期对应的流控阈值。
  20. 如权利要求15至18中任意一项所述的存储介质,其特征在于,所述侦测所述缓存中的缓存信息是否满足第一预设条件包括以下一种或多种的组合:
    侦测所述缓存中的剩余存储空间是否小于预设空间阈值;
    侦测所述缓存中的用户数据的总量是否大于预设限制阈值。
PCT/CN2018/108129 2018-06-04 2018-09-27 后台写盘流控方法、装置、电子设备及存储介质 WO2019232994A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810565748.4A CN108763107B (zh) 2018-06-04 2018-06-04 后台写盘流控方法、装置、电子设备及存储介质
CN201810565748.4 2018-06-04

Publications (1)

Publication Number Publication Date
WO2019232994A1 true WO2019232994A1 (zh) 2019-12-12

Family

ID=64002695

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/108129 WO2019232994A1 (zh) 2018-06-04 2018-09-27 后台写盘流控方法、装置、电子设备及存储介质

Country Status (2)

Country Link
CN (1) CN108763107B (zh)
WO (1) WO2019232994A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114363640A (zh) * 2022-01-05 2022-04-15 上海哔哩哔哩科技有限公司 数据存储方法、装置及系统

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114449094B (zh) * 2020-10-30 2023-04-11 华为技术有限公司 管控方法及电子设备、芯片、存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103543955A (zh) * 2013-08-05 2014-01-29 记忆科技(深圳)有限公司 利用固态硬盘作为设备读缓存的方法、系统及固态硬盘
CN103729313A (zh) * 2012-10-11 2014-04-16 苏州捷泰科信息技术有限公司 Ssd缓存的输入输出流量控制方法及装置
CN104461935A (zh) * 2014-11-27 2015-03-25 华为技术有限公司 一种进行数据存储的方法、装置及系统
CN105677258A (zh) * 2016-02-23 2016-06-15 浪潮(北京)电子信息产业有限公司 一种日志数据管理方法及系统
US20170083447A1 (en) * 2015-09-22 2017-03-23 EMC IP Holding Company LLC Method and apparatus for data storage system

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7277982B2 (en) * 2004-07-27 2007-10-02 International Business Machines Corporation DRAM access command queuing structure
US20070294498A1 (en) * 2006-06-14 2007-12-20 International Business Machines Corporation Storage Allocation Management in Switches Utilizing a Flow Control
CN104978335B (zh) * 2014-04-04 2018-12-07 阿里巴巴集团控股有限公司 数据访问控制方法和装置
US9361145B1 (en) * 2014-06-27 2016-06-07 Amazon Technologies, Inc. Virtual machine state replication using DMA write records
CN107544862B (zh) * 2016-06-29 2022-03-25 中兴通讯股份有限公司 一种基于纠删码的存储数据重构方法和装置、存储节点

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103729313A (zh) * 2012-10-11 2014-04-16 苏州捷泰科信息技术有限公司 Ssd缓存的输入输出流量控制方法及装置
CN103543955A (zh) * 2013-08-05 2014-01-29 记忆科技(深圳)有限公司 利用固态硬盘作为设备读缓存的方法、系统及固态硬盘
CN104461935A (zh) * 2014-11-27 2015-03-25 华为技术有限公司 一种进行数据存储的方法、装置及系统
US20170083447A1 (en) * 2015-09-22 2017-03-23 EMC IP Holding Company LLC Method and apparatus for data storage system
CN105677258A (zh) * 2016-02-23 2016-06-15 浪潮(北京)电子信息产业有限公司 一种日志数据管理方法及系统

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114363640A (zh) * 2022-01-05 2022-04-15 上海哔哩哔哩科技有限公司 数据存储方法、装置及系统
CN114363640B (zh) * 2022-01-05 2023-11-21 上海哔哩哔哩科技有限公司 数据存储方法、装置及系统

Also Published As

Publication number Publication date
CN108763107B (zh) 2022-03-01
CN108763107A (zh) 2018-11-06

Similar Documents

Publication Publication Date Title
WO2019232927A1 (zh) 分布式数据删除流控方法、装置、电子设备及存储介质
WO2019232926A1 (zh) 数据一致性校验流控方法、装置、电子设备及存储介质
WO2019232993A1 (zh) 自适应的数据恢复流控方法、装置、电子设备及存储介质
WO2021068831A1 (zh) 一种业务告警方法、设备及存储介质
WO2019091361A1 (zh) 一种网卡模式切换方法、装置、电子设备及存储介质
US10097464B1 (en) Sampling based on large flow detection for network visibility monitoring
US20190190852A1 (en) Data processing method and physical machine
WO2019232925A1 (zh) 热点数据迁移流控方法、装置、电子设备及存储介质
CN108600053B (zh) 一种基于零拷贝技术的无线网络数据包捕获方法
WO2020026013A1 (zh) 数据传输方法、装置、设备/终端/服务器及计算机可读存储介质
CN106921665B (zh) 一种报文处理方法及网络设备
US10033613B1 (en) Historically large flows in network visibility monitoring
WO2019232994A1 (zh) 后台写盘流控方法、装置、电子设备及存储介质
CN111163018B (zh) 网络设备及其降低传输时延的方法
TW202123003A (zh) 用於一邊緣運算網路的負載平衡裝置及方法
WO2021189845A1 (zh) 时间序列异常点的检测方法、装置、设备及可读存储介质
US10554513B2 (en) Technologies for filtering network packets on ingress
CN110297785B (zh) 一种基于fpga的金融数据流控装置和流控方法
CN112073327A (zh) 一种抗拥塞的软件分流方法、装置及存储介质
WO2020103027A1 (zh) 网络功耗调整方法、网络功耗调整装置及移动终端
TW202223920A (zh) 幹細胞密度確定方法、裝置、電腦裝置及儲存介質
CN109120665B (zh) 高速数据包采集方法及装置
US10606751B2 (en) Techniques for cache delivery
TWI777481B (zh) 數據控制方法、數據處理方法、電子設備及儲存介質
CN114124854B (zh) 报文处理方法、装置、电子设备及可读存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18921523

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18921523

Country of ref document: EP

Kind code of ref document: A1