WO2021036909A1 - Picture write-in method and apparatus - Google Patents

Picture write-in method and apparatus Download PDF

Info

Publication number
WO2021036909A1
WO2021036909A1 PCT/CN2020/110330 CN2020110330W WO2021036909A1 WO 2021036909 A1 WO2021036909 A1 WO 2021036909A1 CN 2020110330 W CN2020110330 W CN 2020110330W WO 2021036909 A1 WO2021036909 A1 WO 2021036909A1
Authority
WO
WIPO (PCT)
Prior art keywords
target
storage node
picture
memory
target storage
Prior art date
Application number
PCT/CN2020/110330
Other languages
French (fr)
Chinese (zh)
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 WO2021036909A1 publication Critical patent/WO2021036909A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/51Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0631Configuration or reconfiguration of storage systems by allocating resources to storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket

Definitions

  • the present disclosure relates to the field of storage technology, and in particular to a method and device for writing pictures.
  • a camera set up on a road needs to store the picture after taking the picture, and when the manager views the picture, the picture needs to be extracted.
  • the picture is generally stored in a disk, and subsequently read from the disk.
  • a method for writing pictures is provided, the method is applied to a target storage node in a cloud storage system, and the target storage node is configured with a disk, a memory, and an SSD (Solid State Drives);
  • the methods include:
  • the target storage node receives the write request of the target picture, and determines whether the picture resource pool to which the target storage node belongs supports accelerated writing;
  • the configured cache type is obtained from the configuration information of the storage node, wherein the cache Type is the cache type of the target picture when the target storage node writes;
  • the target storage node writes the target picture into the memory of the target storage node
  • the target storage node writes the target picture into the SSD of the target storage node.
  • the picture when the amount of data of the picture is relatively small, the picture can be stored in the memory or SSD. Since the writing speed of the memory or SSD is faster, when the amount of data of the picture is relatively small, the writing speed of the picture can be relatively improved. Improve writing efficiency. Moreover, the pictures are stored in the memory or SSD. When reading the pictures, the pictures can be read from the memory or SSD. Since the reading speed of the memory or SSD is faster, the efficiency of reading pictures can also be improved.
  • the method further includes:
  • the writing the target picture into the memory of the target storage node includes:
  • the memory margin after deleting the picture is greater than or equal to the data amount of the target picture, then the picture is written into the memory, and if the memory margin after deleting the picture is less than the data amount of the target picture, execute The process of deleting the picture whose writing time point is the longest from the current time point in the memory.
  • the method further includes:
  • the target storage node receives the read request of the target picture sent by the requester, and determines whether the picture resource pool to which the target storage node belongs supports accelerated writing, wherein the read request carries the target picture Index information stored on disk;
  • the picture resource pool to which the target storage node belongs supports accelerated writing, read the target picture according to the cache type corresponding to the target picture and the read request;
  • the reading the target picture according to the cache type corresponding to the target picture and the read request includes:
  • the cache type corresponding to the target picture is memory acceleration, determining the first index of the target picture stored in the memory of the target storage node according to the index information;
  • the target picture is read from the disk;
  • the second index of the target picture stored in the SSD is determined according to the index information, and if the index table corresponding to the SSD configured on the target storage node is searched To the second index, read the target picture from the SSD configured on the target storage node according to the second index;
  • the target picture is read from the disk according to the read request.
  • the picture can also be read in the memory or SSD, the picture can be read quickly.
  • a device for writing pictures is provided, the device is applied to a target storage node in a cloud storage system, the target storage node is configured with a disk, a memory, and an SSD; the device includes:
  • the receiving module is used to receive the write request of the target picture
  • a judging module for judging whether the image resource pool to which the target storage node belongs supports accelerated writing
  • the determining module is configured to obtain the configured cache type from the configuration information of the storage node when the image resource pool to which the target storage node belongs supports accelerated writing, if the data amount of the target picture is less than the target value, Wherein, the cache type is the cache type of the target picture when the target storage node writes;
  • a writing module configured to write the target picture into the memory of the target storage node if the cache type is memory acceleration
  • the cache type is SSD acceleration
  • the target picture is written into the SSD of the target storage node.
  • the writing module is also used for:
  • the writing module is used for:
  • the memory margin after deleting the picture is greater than or equal to the data amount of the target picture, then the picture is written into the memory, and if the memory margin after deleting the picture is less than the data amount of the target picture, execute The process of deleting the picture whose writing time point is the longest from the current time point in the memory.
  • the receiving module is further configured to receive a read request of a target picture sent by a requesting party, wherein the read request carries index information of the target picture stored on a disk;
  • the judgment module is also used to judge whether the image resource pool to which the target storage node belongs supports accelerated writing;
  • the device also includes:
  • a reading module configured to read the target picture according to the cache type corresponding to the target picture and the read request if the picture resource pool to which the target storage node belongs supports accelerated writing;
  • the sending module is used to send the target picture to the requester.
  • the reading module is used for:
  • the cache type corresponding to the target picture is memory acceleration, determining the first index of the target picture stored in the memory of the target storage node according to the index information;
  • the target picture is read from the disk;
  • the second index of the target picture stored in the SSD is determined according to the index information, and if the index table corresponding to the SSD configured on the target storage node is searched To the second index, read the target picture from the SSD configured on the target storage node according to the second index;
  • the target picture is read from the disk according to the read request.
  • a method for reading pictures is provided, the method is applied to a target storage node in a cloud storage system, the target storage node is configured with a disk, a memory, and a solid-state hard drive (SSD); the method includes:
  • the target storage node receives the read request of the target picture sent by the requester, and determines whether the picture resource pool to which the target storage node belongs supports accelerated writing;
  • the target image is read in the memory configured by the target storage node according to the read request, where:
  • the cache type is the cache type of the target picture when the target storage node writes;
  • the picture resource pool to which the target storage node belongs supports accelerated writing, and the cache type is SSD accelerated, reading the target picture from the SSD configured on the target storage node according to the read request;
  • the pictures are stored in the memory or SSD, so the pictures can be read from the memory or SSD. Since the read speed of the memory or SSD is faster, the efficiency of reading pictures can be improved.
  • the read request carries index information of the target picture stored on the disk
  • the reading the target picture in the memory configured by the target storage node according to the reading request includes:
  • the target picture is read from the memory of the target storage node according to the first index.
  • the read request carries index information of the target picture stored on the disk
  • the reading the target picture in the SSD configured on the target storage node according to the reading request includes:
  • the target picture is read from the SSD configured on the target storage node according to the second index.
  • a storage node for writing pictures includes a processor and a memory, and at least one instruction is stored in the memory, and the instruction is loaded and executed by the processor to achieve the above The method of writing pictures described in the first aspect.
  • a computer-readable storage medium is provided, and at least one instruction is stored in the storage medium, and the instruction is loaded and executed by a processor to implement the method for writing a picture as described in the first aspect.
  • the target storage node in the cloud storage system is configured with a disk, a memory, and an SSD.
  • the target storage node can receive the write request of the target picture and determine whether the picture resource pool to which the target storage node belongs supports accelerated writing, and if the picture resource pool to which the storage node belongs supports accelerated writing , The data amount of the target picture and the size of the target value are judged. If the data amount of the target picture is less than the target value, the configured cache type is obtained from the configuration information of the storage node. If the cache type is memory acceleration, the target storage node writes the target image into the memory of the target storage node.
  • the target storage node writes the target image into the SSD configured by the target storage node.
  • the picture can be stored in the memory or SSD. Since the writing speed of the memory or SSD is faster, when the amount of data of the picture is relatively small, the writing speed of the picture can be relatively improved. Improve writing efficiency.
  • the picture is stored in the memory or SSD, and the picture can be read from the memory or SSD. Since the reading speed of the memory or SSD is faster, the reading efficiency of the picture can also be improved.
  • FIG. 1 is a schematic diagram of a cloud storage system provided by an embodiment of the present disclosure
  • FIG. 2 is a flowchart of a method for writing pictures according to an embodiment of the present disclosure
  • FIG. 3 is a schematic diagram of setting a cache type according to an embodiment of the present disclosure.
  • FIG. 4 is a schematic diagram of setting a target value provided by an embodiment of the present disclosure.
  • FIG. 5 is a schematic diagram of setting an acceleration strategy according to an embodiment of the present disclosure.
  • FIG. 6 is a flowchart of a method for extracting pictures provided by an embodiment of the present disclosure.
  • FIG. 7 is a schematic structural diagram of an apparatus for writing pictures according to an embodiment of the present disclosure.
  • FIG. 8 is a schematic structural diagram of an apparatus for writing pictures according to an embodiment of the present disclosure.
  • FIG. 9 is a schematic structural diagram of a storage node provided by an embodiment of the present disclosure.
  • the embodiment of the present disclosure provides a method for writing a picture.
  • the execution subject of the method may be a storage node, and the storage node may be a server.
  • the storage node may be provided with a processor, a memory, a transceiver, etc., and the processor may be used to process the process of writing pictures.
  • the processor is used to write pictures in the storage node, read pictures from the storage node, and so on.
  • the memory can be used for the data needed and generated during the process of writing pictures.
  • the memory is used for storing written pictures.
  • the transceiver can be used for receiving and sending data. For example, it can be used for sending or receiving pictures. It can also be used to receive picture write requests, picture read requests, and so on.
  • the method for writing pictures mentioned in the embodiments of the present disclosure is applied to a storage node of a cloud storage system, and there are multiple storage nodes.
  • the storage nodes in the cloud storage system can be divided into different picture resource pools, and the same storage node will not exist in different picture resource pools.
  • the cloud storage system includes multiple image resource pools, and each image resource pool can be configured to support accelerated writing or not to support accelerated writing.
  • the storage node in the image resource pool that supports accelerated writing is configured with disk, memory, and SSD.
  • the storage node in the image resource pool that does not support accelerated writing can be configured with disk, memory, and SSD, or only with disk and memory. . What needs to be explained here is that the image resource pool is a virtual storage space.
  • the cloud storage system may include an application layer and a device layer.
  • the application layer includes a management node and a storage node. Multiple storage nodes form a picture resource pool, and the management node can be used to manage storage nodes in the picture resource pool.
  • the device layer includes external storage components of storage nodes, such as disks and SSDs.
  • a virtual file system layer is also included between the application layer and the device layer to connect the device layer and the application layer.
  • an embodiment of the present disclosure provides a method for writing a picture, taking a picture taken by a camera for storage as an example for description, and the processing flow of the method may be as follows:
  • Step 201 The target storage node receives the write request of the target picture, and judges whether the picture resource pool to which the target storage node belongs supports accelerated writing.
  • the target picture can be any picture.
  • the camera after the camera captures the target picture, it can generate a write request and add the target picture to it, and the camera determines the management node to connect to. Then send the write request to the management node.
  • the management node After receiving the write request, the management node can view the image resource pool connected to the camera ID, and determine the storage capacity of each storage node in the storage nodes included in the image resource pool, and the total storage space of each storage node. For any storage node, compare the storage capacity of the storage node with the total storage space capacity of the storage node to obtain the storage occupancy rate of the storage node.
  • the management node may select the storage node with the least occupancy rate (hereinafter may be referred to as the target storage node), and send a write request of the target picture to the target storage node.
  • the target storage node may receive the write request sent by the management node, and parse the write request to obtain the target picture.
  • the target storage node may obtain the corresponding relationship between the storage node and the picture resource pool, and from the corresponding relationship, determine the picture resource pool to which the target storage node belongs, or the configuration information of the target storage node includes the identity of the picture resource pool to which it belongs, The target storage node can directly obtain the identification of the picture resource pool to which it belongs from the configuration information. Then the target storage node obtains the configuration file of the image resource pool, obtains the writing flag of the image resource pool from the configuration file, and determines whether the image resource pool supports accelerated writing according to the value of the writing flag.
  • the foregoing is based on the storage occupancy rate of the storage node to determine the target storage node. In the embodiments of the present disclosure, it may also be based on the weighting of the storage occupancy rate of the storage node and the central processing unit (CPU) occupancy rate of the storage node. Value to determine the target storage node.
  • the management node determines the storage node with the smallest weighted value of the storage occupancy rate and the CPU occupancy rate as the target storage node.
  • the weight coefficients corresponding to the storage occupancy rate and the CPU occupancy rate are different, and the sum is 1, and the weight coefficient corresponding to the storage occupancy rate is greater than the weight coefficient corresponding to the CPU occupancy rate.
  • Step 202 When the image resource pool to which the target storage node belongs supports accelerated writing, if the data amount of the target image is less than the target value, obtain the configured cache type from the configuration information of the storage node.
  • the target value can be set and stored in the storage node.
  • the target value generally belongs to 0 ⁇ 500k and can be set to 100k.
  • Cache types are generally divided into non-accelerated, memory accelerated, and SSD accelerated.
  • the target storage node may determine that the picture resource pool supports accelerated writing.
  • the target storage node may determine that the picture resource pool does not support accelerated writing.
  • the first value and the second value are different values. For example, the first value may be 1, and the second value may be zero.
  • the target storage node can determine the relationship between the data volume of the target image and the target value. If the data volume of the target image is less than the target value, it can obtain the configured cache type from the configuration information of the target storage node, and then set the cache type Set to the cache type corresponding to the target image. In this way, when the data volume of the picture is less than the target value, it can be accelerated by means of memory or SSD to increase the writing speed. In this way, because the target value is set, when the amount of image data is relatively small, it can be stored in SSD or memory, and when the amount of image data is relatively large, it can be stored in the disk, not only without losing the image, but also improving The reading speed of pictures with a relatively small amount of data.
  • the target storage node writes the target image to the disk of the target storage node.
  • the target storage node may first directly write the target image to the disk of the target storage node, and then determine whether the image resource pool to which the target storage node belongs supports accelerated writing.
  • the target storage node may first determine whether the picture resource pool to which the target storage node belongs supports accelerated writing, and then write the target picture to the disk. In this way, if the image resource pool does not support acceleration or supports acceleration, the image can also be written to the disk, which can prevent the loss of image data.
  • step 202 if the data amount of the target picture is greater than or equal to the target value, since the target picture has been written to the disk of the target storage node, subsequent processing is not required, and the writing process of the target picture is completed. In addition, if the target picture does not support accelerated writing, the target picture is written to the disk of the target storage node, no subsequent processing is required, and the writing process of the target picture is completed.
  • Step 203 If the cache type is memory acceleration, the target image is written into the memory of the storage node; if the cache type is solid state drive SSD acceleration, the target image is written into the SSD of the storage node.
  • the target storage node can write the target image into the memory of the target storage node, and create the index value of the target image for subsequent retrieval from the memory of the target storage node Read the target picture.
  • the index value here can be the identification of the target picture.
  • the target storage node maintains an index table.
  • the index table includes the corresponding relationship between the index value and the storage location information.
  • the target storage node also records the corresponding relationship between the index value and the block identifier of the target image stored on the disk. In this way, Later, you can use the identifier of the block in the disk to find the storage location information of the target picture in the memory.
  • the target storage node can determine its own SSD, write the target picture into its own SSD, and create the index value of the target picture for subsequent reading of the target picture from the SSD.
  • the index value here can be the identification of the target picture.
  • the target storage node maintains an index table.
  • the index table includes the corresponding relationship between the index value and the storage location information.
  • the target storage node also records the corresponding relationship between the index value and the block identifier of the picture stored on the disk. In this way, the subsequent You can use the identifier of the block in the disk to find the storage location information of the target image stored in the SSD.
  • the data amount of the target image and the size of the memory margin are also determined, and the processing can be as follows:
  • the target image is written into the memory of the target storage node; if the current memory margin of the target storage node is less than the data amount of the target image, then the target image is written in the memory Delete the picture that is the longest from the current time point in the writing time point; if the memory margin after deleting the picture is greater than or equal to the data amount of the target picture, then the picture is written into the memory, if the memory margin after deleting the picture is less than the target For the amount of data of the picture, the process of deleting the picture whose writing time point is the longest from the current time point in the memory is executed.
  • the target storage node can determine the memory margin of the current memory, and the memory margin refers to the space in the current memory that has not yet stored data. Then the target storage node can compare the memory margin with the size of the data volume of the target picture. If the memory margin is greater than or equal to the data amount of the target picture, the target picture can be directly written into the memory of the target storage node.
  • the target storage node can determine the picture with the longest time point from the current time point in the memory, and then delete the picture. Then determine the current memory margin, if the memory margin is greater than or equal to the data amount of the target picture, you can directly write the target picture into the memory. If the current memory margin is still less than the data amount of the target picture, you can continue to delete the picture in the current memory and write the picture with the longest time point from the current time point until the memory margin is greater than or equal to the data amount of the target picture. Write to the memory of the target storage node.
  • the target storage node after the target storage node writes the target image to the disk of the target storage node, it may return index information to the management node, where the index information is the identifier of the disk to which the target image is written and the identifier of the block. .
  • the process shown in FIG. 2 may be executed by an application on the target storage node.
  • the configuration information of the target storage node can be read, and configuration items such as the cache type, memory size, and target value can be obtained from it.
  • the application detects that the memory cache is enabled in the configuration item, it can create a memory for caching pictures according to the size of the memory, and initialize the memory, and then use the memory to cache pictures. If the memory allocation fails, the application fails to start, and the memory cannot be used to cache pictures subsequently.
  • process shown in Figure 2 it can be executed by an application on the target storage node.
  • the application there are two processes, one is A process, the other is B process, A and Process B is connected through a unix domain socket link.
  • process A can receive the requester’s write request and inform process B through the unix domain socket link.
  • Process B can perform the above step 202 To 203.
  • the index information (the index information is the identifier of the disk and the identifier of the block stored in the disk) is returned to the A process through the unix domain socket link.
  • Process A can feed back to the requesting party.
  • the user can click the option to set the cache type on the cloud storage system management page displayed on the terminal to trigger the terminal to display the storage node that has not set the cache type, find the target storage node in it, and select the cache for the target storage node Types of. Then the user can click the confirmation option to trigger the generation of the setting information of the cache type (the setting information carries the set cache type), and send the setting information of the cache type to the target storage node (a1).
  • the target storage node can update the cache type set by the user to the configuration file (a2), and then return success to the display terminal of the cloud storage system management page (a3).
  • the user can click the threshold setting option on the cloud storage system management page displayed on the terminal, and the terminal will display a threshold input box, and the user can enter the target value. Then the user can click the OK option to trigger the terminal to send the threshold setting information (the setting information carries the target value) (b1).
  • the management node inserts the target value into the database of the management node (b2), and updates the target value to the zookeeper node (b3).
  • the target storage node can monitor the zookeeper node, obtain the target value, write it into the memory, and write it to its configuration file (b4).
  • other management nodes can synchronize the target value to their own memory and database by monitoring the target value of the management node.
  • a process for the target storage node to obtain an indication message of whether the image resource pool supports acceleration is also provided:
  • the user can click the acceleration policy setting option on the cloud storage system management page of the terminal to trigger the terminal to display the image resource pool for which the acceleration policy is not set, and find the image resource pool to which the target storage node belongs, as the target Select the acceleration strategy for the image resource pool to which the storage node belongs.
  • the user can click the confirmation option to trigger the terminal to generate acceleration indication information, which can be used to indicate any acceleration strategy of acceleration support and non-support acceleration.
  • the terminal sends the acceleration instruction information to the management node (c1), and the management node can insert the acceleration strategy in the acceleration instruction information into the database of the management node (c2), and update the acceleration strategy to the zookeeper node (c3).
  • the target storage node can monitor the zookeeper node, obtain the acceleration strategy, write to the memory, and write to its own configuration file (c4).
  • other management nodes can synchronize the acceleration strategy to their own memory and database by monitoring the acceleration strategy of the management node.
  • the above-mentioned management node receives the acceleration indication information and the target value through CLI (command-line interface) interface.
  • CLI command-line interface
  • the above-mentioned target storage node receives the cache type, it also uses CLI to receive it. of.
  • the cache type of the picture resource pool can also be modified.
  • the user can select the image resource pool to which the target storage node belongs in the cloud storage system management page of the terminal, and re-select the acceleration strategy for the image resource pool to which the target storage node belongs.
  • the user can click the confirmation option to trigger the terminal to generate update acceleration indication information, which can be used to indicate the modified acceleration strategy.
  • the terminal sends the update acceleration instruction information to the management node, and the management node can use the acceleration strategy in the update acceleration instruction information to update the currently existing acceleration strategy.
  • the target storage node can monitor the zookeeper node, obtain the updated acceleration strategy, write the updated acceleration strategy into the memory, and update the existing acceleration strategy in its configuration file.
  • processing of reading the target picture is also provided, and the corresponding processing flow may be as follows:
  • Step 601 Receive a read request for a target picture sent by the requesting party, where the read request carries index information of the target picture stored on the disk.
  • the target picture when the target picture is to be viewed, the target picture can be read, and the user viewing the target picture can operate the terminal (that is, the requester) to send a read request of the target picture to the target storage node.
  • the read request carries the index information of the target picture stored in the disk, which may be the identifier of the disk and the identifier of the block in the disk.
  • the target storage node may receive the read request of the target picture, and parse the index information of the target picture stored on the disk, that is, the identifier of the stored disk and the identifier of the block in the disk.
  • Step 602 Determine whether the picture resource pool to which the target storage node belongs supports accelerated writing. If the picture resource pool to which the target storage node belongs supports accelerated writing, read the target picture according to the cache type and read request corresponding to the target picture.
  • the target storage node can obtain the corresponding relationship between the storage node and the picture resource pool, and from the corresponding relationship, determine the picture resource pool to which the target storage node belongs, or the configuration information of the target storage node includes the picture resource to which it belongs The identification of the pool, the target storage node can directly obtain the picture resource pool to which it belongs from the configuration information. Then obtain the configuration file of the picture resource pool, obtain the write flag of the picture resource pool from the configuration file, and determine the picture resource pool according to the value of the write flag if the value is the first value Support accelerated writing. If the value is the second value, it is determined that the image resource pool does not support accelerated writing.
  • the target storage node can obtain the configuration item of the cache type in the configuration file, and determine the cache type according to the value of the configuration item.
  • the cache type is no acceleration, memory acceleration, and SSD
  • the cache type in the configuration file is determined as the cache type corresponding to the target picture (this process has been discussed above, and will not be repeated here). For example, if the value of the configuration item is 0, the cache type is determined to be no acceleration, if the value of the configuration item is 1, the cache type is determined to be SSD acceleration, and if the value of the configuration item is 2, the cache type is determined to be memory acceleration.
  • the target storage node can use the cache type corresponding to the target picture and the index information of the target picture stored on the disk to read the target picture from the target storage node.
  • the target image can be read as follows:
  • the first index of the target image stored in the memory of the target storage node is determined according to the index information. If the first index is found in the index table corresponding to the memory of the target storage node, According to the first index, the target picture is read from the memory of the target storage node; if the first index is not found in the index table corresponding to the memory of the target storage node, the target picture is read from the disk. If the target picture corresponds to If the cache type of is SSD acceleration, the second index of the target image stored in the SSD is determined according to the index information.
  • the second index is found in the index table corresponding to the SSD configured on the target storage node, the second index is used from The target image is read from the SSD configured on the target storage node. If the second index is not found in the index table corresponding to the SSD configured on the target storage node, the target image is read from the disk according to the read request.
  • the cache type corresponding to the target picture is memory acceleration
  • the first index and then look for the first index in the index table corresponding to the memory of the target storage node. If the first index exists, the target image can be read at the position corresponding to the first index in the memory of the target storage node .
  • the first index does not exist in the index table corresponding to the memory of the target storage node, you can directly read the target image from the disk, using the disk identifier and block identifier (in this case, the target image is generally in the target storage node).
  • the storage time in the configured memory is relatively long and has been deleted).
  • the target image can be read directly from the disk using the disk identifier and the block identifier.
  • the cache type corresponding to the target image is SSD acceleration
  • the corresponding relationship between the index value and the identifier of the block stored in the disk of the image can be found according to the index information, and the second index of the target image stored in the SSD of the target storage node can be determined. If the second index can be found in the index table of the SSD of the target storage node, the target image can be read at the position corresponding to the second index in the SSD of the target storage node.
  • the disk identifier and block identifier in the index information can be used to read the target picture (in this case, the target picture is generally stored in the target storage).
  • the storage time in the SSD of the node configuration is relatively long and has been deleted).
  • the read request carries a MYSQL (Structured Query Language, structured query language) database index (that is, the identifier of the disk and the identifier of the block), which is used to locate the position of the image data on the disk.
  • the first index is generated when the data of the picture is stored in the memory, and can be called a memory index, which is used to locate the address of the data of the picture in the memory.
  • the second index is generated when the data of the picture is stored in the SSD, and can be called a DB (databases, database) index, which is used to locate the address of the data of the picture in the SSD.
  • step 603 If the target picture is read, step 603 is executed. If the target picture is not read, the target picture is read from the disk.
  • Step 603 Send the target picture to the requesting party.
  • the target storage node after the target storage node reads the target picture, it can send the target picture to the requesting party.
  • process A can receive the requester's read request and notify process B through the unix domain socket link.
  • Process B can perform the above steps 602 to 603, and then send the read target picture to the A process through the unix domain socket link, and the A process can feed back to the requester.
  • the unix domain socket link established by the A process and the B process can be connected all the time, and through the heartbeat message, it is detected whether the unix domain socket link is in a connected state. If it is not in a connected state, a unix domain socket link is established. If it is in the connected state, continue to use the heartbeat message to detect whether the unix domain socket link is in the connected state
  • the storage node in the cloud storage system is configured with a disk, a memory, and an SSD.
  • the target storage node can receive the write request of the target picture and determine whether the picture resource pool to which the target storage node belongs supports accelerated writing, and if the picture resource pool to which the storage node belongs supports accelerated writing , The data amount of the target picture and the size of the target value are judged. If the data amount of the target picture is less than the target value, the configured cache type is obtained from the configuration information of the storage node. If the cache type is memory acceleration, the target storage node writes the target image into the memory of the target storage node.
  • the target storage node writes the target image into the SSD configured by the target storage node.
  • the picture can be stored in the memory or SSD. Since the writing speed of the memory or SSD is faster, when the amount of data of the picture is relatively small, the writing speed of the picture can be relatively improved. Improve picture writing efficiency.
  • the picture is stored in the memory or SSD, and the picture can be read from the memory or SSD. Since the reading speed of the memory or SSD is faster, the reading efficiency of the picture can also be improved.
  • the embodiment of this application also provides a process of reading pictures: the target storage node receives the read request of the target picture sent by the requester, and judges whether the picture resource pool to which the target storage node belongs supports accelerated writing; if the target storage node The image resource pool to which the node belongs supports accelerated writing, and the cache type is memory acceleration.
  • the target image is read in the memory configured by the target storage node, where the cache type is that the target image is written in the target storage node If the image resource pool to which the target storage node belongs supports accelerated writing, and the cache type is SSD acceleration, then according to the read request, read the target image from the SSD configured on the target storage node; send the target to the requester image.
  • the target storage node After the target storage node receives the read request of the target picture sent by the requester, it determines whether the picture resource pool to which the target storage node belongs supports accelerated writing, and determines the cache type as described in the foregoing. If the image resource pool to which the target storage node belongs supports accelerated writing, and the cache type is memory acceleration, you can use a read request to read the target image in the memory. If the image resource pool to which the target storage node belongs supports accelerated writing, And the cache type is SSD acceleration, then the target image is read in the SSD according to the read request. After reading the target picture, the target storage node sends the target picture to the requester.
  • the picture when the amount of data of the picture is relatively small, the picture can be stored in the memory or SSD, and the picture can be stored in the memory or SSD, so the picture can be read from the memory or SSD. Since the reading speed of the memory or SSD is faster, Can improve the efficiency of image reading.
  • the read request carries index information of the target image stored on the disk; according to the index information, determine the first index of the target image stored in the memory of the target storage node; if it is in the index table corresponding to the memory of the target storage node If the first index is found in, the target image is read from the memory of the target storage node according to the first index.
  • the read request carries index information of the target image stored on the disk; according to the index information, determine the second index of the target image stored in the SSD; if it is found in the index table corresponding to the SSD configured on the target storage node
  • the second index reads the target picture from the SSD configured on the target storage node according to the second index.
  • the target storage node does not find the target image in the memory and SSD configured on the target storage node, the target image can be read from the disk configured by the target storage node. The detailed process is described in the foregoing and will not be repeated here.
  • the embodiments of the present disclosure also provide a device for writing pictures, the device is applied to a target storage node of a cloud storage system, and the target storage node is configured with a disk, a memory, and an SSD.
  • the device includes:
  • the receiving module 710 is configured to receive a write request of the target picture
  • the judging module 720 is configured to judge whether the image resource pool to which the target storage node belongs supports accelerated writing
  • the determining module 730 is configured to obtain the configured cache type from the configuration information of the storage node when the image resource pool to which the target storage node belongs supports accelerated writing, if the data amount of the target picture is less than the target value , Wherein the cache type is the cache type of the target picture when the target storage node writes;
  • the writing module 740 is configured to write the target picture into the memory of the target storage node if the cache type is memory acceleration; if the cache type is SSD acceleration, write the target picture The SSD of the target storage node.
  • the writing module 740 is also used for:
  • the writing module 740 is configured to:
  • the memory margin after deleting the picture is greater than or equal to the data amount of the target picture, then the picture is written into the memory, and if the memory margin after deleting the picture is less than the data amount of the target picture, execute The process of deleting the picture whose writing time point is the longest from the current time point in the memory.
  • the receiving module 710 is further configured to receive a read request of a target picture sent by a requesting party, wherein the read request carries index information of the target picture stored on a disk;
  • the judgment module 720 is further configured to judge whether the image resource pool to which the target storage node belongs supports accelerated writing;
  • the device further includes:
  • a reading module 750 configured to read the target picture according to the cache type corresponding to the target picture and the read request if the picture resource pool to which the target storage node belongs supports accelerated writing;
  • the sending module 760 is configured to send the target picture to the requester.
  • the reading module 750 is configured to:
  • the cache type corresponding to the target picture is memory acceleration, determining the first index of the target picture stored in the memory of the target storage node according to the index information;
  • the target picture is read from the disk;
  • the second index of the target picture stored in the SSD is determined according to the index information, and if the index table corresponding to the SSD configured on the target storage node is searched To the second index, read the target picture from the SSD configured on the target storage node according to the second index;
  • the target picture is read from the disk according to the read request.
  • the storage node in the cloud storage system is configured with a disk, a memory, and an SSD.
  • the target storage node can receive the write request of the target picture and determine whether the picture resource pool to which the target storage node belongs supports accelerated writing, and if the picture resource pool to which the storage node belongs supports accelerated writing , The data amount of the target picture and the size of the target value are judged. If the data amount of the target picture is less than the target value, the configured cache type is obtained from the configuration information of the storage node. If the cache type is memory acceleration, the target storage node writes the target image into the memory of the target storage node.
  • the target storage node writes the target image into the SSD configured by the target storage node.
  • the picture can be stored in the memory or SSD. Since the writing speed of the memory or SSD is faster, when the amount of data of the picture is relatively small, the writing speed of the picture can be relatively improved. Improve writing efficiency.
  • the picture is stored in the memory or SSD, and the picture can be read from the memory or SSD. Since the reading speed of the memory or SSD is faster, the reading efficiency of the picture can also be improved.
  • the device for writing pictures provided in the above embodiments writes pictures
  • only the division of the above-mentioned functional modules is used as an example for illustration.
  • the above-mentioned functions can be allocated to different functional modules according to needs.
  • Complete that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above.
  • the device for writing a picture provided in the above-mentioned embodiment belongs to the same concept as the embodiment of the method for writing a picture, and the specific implementation process is detailed in the method embodiment, and will not be repeated here.
  • FIG. 9 is a schematic structural diagram of a storage node provided by an embodiment of the present disclosure.
  • the storage node 900 may have relatively large differences due to different configurations or performance, and may include one or more processors (central processing units, CPU) 901 And one or more memories 902, wherein at least one instruction is stored in the memory 902, and the at least one instruction is loaded and executed by the processor 901 to implement the above-mentioned method steps of determining to write a picture.
  • processors central processing units, CPU
  • memories 902 wherein at least one instruction is stored in the memory 902, and the at least one instruction is loaded and executed by the processor 901 to implement the above-mentioned method steps of determining to write a picture.
  • the embodiments of the present disclosure also provide a storage node for writing pictures, the storage node includes a processor and a memory, and at least one instruction is stored in the memory, and the instruction is loaded and executed by the processor to realize The above-mentioned method of writing pictures.
  • the embodiment of the present disclosure also provides a computer-readable storage medium, in which at least one instruction is stored, and the instruction is loaded and executed by a processor to implement the method for writing a picture as described above.
  • the program can be stored in a computer-readable storage medium.
  • the storage medium mentioned can be a read-only memory, a magnetic disk or an optical disk, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

Provided are a picture write-in method and apparatus, falling within the technical field of storage machines. The method is applied to a target storage node in a cloud storage system, and the target storage node is configured with a memory, a magnetic disk and an SSD. The method comprises: a target storage node receiving a write-in request regarding a target picture; determining whether a picture resource pool to which the target storage node belongs supports accelerated write-in; when the picture resource pool to which the target storage node belongs supports accelerated write-in, if the data volume of the target picture is less than a target value, acquiring a configured cache type in configuration information of the storage node; if the cache type is memory acceleration, the target storage node writing the target picture into a memory of the target storage node; and if the cache type is SSD acceleration, the target storage node writing the target picture into an SSD of the target storage node. By means of the present disclosure, the picture write-in efficiency can be improved.

Description

写入图片的方法和装置Method and device for writing pictures
本公开要求于2019年08月23日提交的申请号为201910786664.8、发明名称为“写入图片的方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本公开中。This disclosure claims the priority of a Chinese patent application filed on August 23, 2019, with the application number 201910786664.8 and the invention title "Method and Apparatus for Writing Pictures", the entire contents of which are incorporated into this disclosure by reference.
技术领域Technical field
本公开涉及存储技术领域,特别涉及一种写入图片的方法和装置。The present disclosure relates to the field of storage technology, and in particular to a method and device for writing pictures.
背景技术Background technique
随着计算机技术和网络技术的发展,需要存储图片和提取图片的应用场景越来越多。例如,在道路上设置的摄像机,在拍摄得到图片之后,需要进行存储,在管理人员观看图片时,需要提取图片。With the development of computer technology and network technology, more and more application scenarios need to store pictures and extract pictures. For example, a camera set up on a road needs to store the picture after taking the picture, and when the manager views the picture, the picture needs to be extracted.
相关技术中,在拍摄得到图片之后,进行存储时,一般是将图片存储至磁盘中,后续从磁盘中读取。In the related art, after a picture is captured and stored, the picture is generally stored in a disk, and subsequently read from the disk.
由于磁盘的写入速度较慢,所以会导致图片的写入效率比较低。Since the writing speed of the disk is slow, the writing efficiency of the picture will be lower.
发明内容Summary of the invention
为了解决相关技术的问题,本公开实施例提供了一种写入图片的方法和装置。所述技术方案如下:In order to solve the related art problems, embodiments of the present disclosure provide a method and apparatus for writing pictures. The technical solution is as follows:
第一方面,提供了一种写入图片的方法,所述方法应用于云存储系统中的目标存储节点,所述目标存储节点配置有磁盘、内存和SSD(Solid State Drives,固态硬盘);所述方法包括:In the first aspect, a method for writing pictures is provided, the method is applied to a target storage node in a cloud storage system, and the target storage node is configured with a disk, a memory, and an SSD (Solid State Drives); The methods include:
目标存储节点接收目标图片的写入请求,判断所述目标存储节点所属的图片资源池是否支持加速写入;The target storage node receives the write request of the target picture, and determines whether the picture resource pool to which the target storage node belongs supports accelerated writing;
在所述目标存储节点所属的图片资源池支持加速写入时,如果所述目标图片的数据量小于目标数值,则在所述存储节点的配置信息中获取配置的缓存类型,其中,所述缓存类型为所述目标图片在所述目标存储节点写入时的缓存类型;When the picture resource pool to which the target storage node belongs supports accelerated writing, if the data amount of the target picture is less than the target value, the configured cache type is obtained from the configuration information of the storage node, wherein the cache Type is the cache type of the target picture when the target storage node writes;
如果所述缓存类型为内存加速,则所述目标存储节点将所述目标图片写入所述目标存储节点的内存中;If the cache type is memory acceleration, the target storage node writes the target picture into the memory of the target storage node;
如果所述缓存类型为SSD加速,则所述目标存储节点将所述目标图片写入所述目标存储节点的SSD中。If the cache type is SSD acceleration, the target storage node writes the target picture into the SSD of the target storage node.
这样,在图片的数据量比较小时,可以将图片存储至内存或SSD中,由于内存或SSD写入速度较快,所以在图片的数据量比较小时,可以相对提升图片的写入速度,进而可以提高写入效率。而且图片存储至内存或者SSD,在读取图片时,可以从内存或SSD中读取图片,由于内存或SSD的读取速度较快,也可以提升图片的读取效率。In this way, when the amount of data of the picture is relatively small, the picture can be stored in the memory or SSD. Since the writing speed of the memory or SSD is faster, when the amount of data of the picture is relatively small, the writing speed of the picture can be relatively improved. Improve writing efficiency. Moreover, the pictures are stored in the memory or SSD. When reading the pictures, the pictures can be read from the memory or SSD. Since the reading speed of the memory or SSD is faster, the efficiency of reading pictures can also be improved.
可选的,所述方法还包括:Optionally, the method further includes:
将所述目标图片写入所述存储节点的磁盘。Writing the target picture to the disk of the storage node.
这样,可以防止图片丢失。In this way, the picture can be prevented from being lost.
可选的,所述将所述目标图片写入所述目标存储节点的内存中,包括:Optionally, the writing the target picture into the memory of the target storage node includes:
如果所述目标存储节点当前的内存余量大于或等于所述目标图片的数据量,则将所述目标图片写入所述目标存储节点的内存中;If the current memory margin of the target storage node is greater than or equal to the data amount of the target picture, writing the target picture into the memory of the target storage node;
如果所述目标存储节点当前的内存余量小于所述目标图片的数据量,则在所述内存中删除写入时间点距离当前时间点最长的图片;If the current memory margin of the target storage node is less than the data amount of the target picture, deleting the picture whose writing time point is the longest from the current time point in the memory;
如果删除图片后的内存余量大于或等于所述目标图片的数据量,则将所述图片写入所述内存中,如果删除图片后的内存余量小于所述目标图片的数据量,则执行所述在所述内存中删除写入时间点距离当前时间点最长的图片的处理。If the memory margin after deleting the picture is greater than or equal to the data amount of the target picture, then the picture is written into the memory, and if the memory margin after deleting the picture is less than the data amount of the target picture, execute The process of deleting the picture whose writing time point is the longest from the current time point in the memory.
这样,可以尽可能的保证存储在内存中。In this way, it can be stored in the memory as much as possible.
可选的,所述方法还包括:Optionally, the method further includes:
所述目标存储节点接收请求方发送的所述目标图片的读取请求,判断所述目标存储节点所属的图片资源池是否支持加速写入,其中,所述读取请求中携带有所述目标图片存储在磁盘的索引信息;The target storage node receives the read request of the target picture sent by the requester, and determines whether the picture resource pool to which the target storage node belongs supports accelerated writing, wherein the read request carries the target picture Index information stored on disk;
如果所述目标存储节点所属的图片资源池支持加速写入,则根据所述目标图片对应的缓存类型和所述读取请求,读取所述目标图片;If the picture resource pool to which the target storage node belongs supports accelerated writing, read the target picture according to the cache type corresponding to the target picture and the read request;
向所述请求方发送所述目标图片。Sending the target picture to the requesting party.
这样,可以快速的读取到图片。In this way, the picture can be read quickly.
可选的,所述根据所述目标图片对应的缓存类型和所述读取请求,读取所 述目标图片,包括:Optionally, the reading the target picture according to the cache type corresponding to the target picture and the read request includes:
如果所述目标图片对应的缓存类型为内存加速,则根据所述索引信息,确定所述目标图片存储在所述目标存储节点的内存中的第一索引;If the cache type corresponding to the target picture is memory acceleration, determining the first index of the target picture stored in the memory of the target storage node according to the index information;
如果在所述目标存储节点的内存对应的索引表中查找到所述第一索引,则根据所述第一索引,从所述目标存储节点的内存中读取所述目标图片;如果在所述目标存储节点的内存对应的索引表中未查找到所述第一索引,则从磁盘中读取所述目标图片;If the first index is found in the index table corresponding to the memory of the target storage node, read the target picture from the memory of the target storage node according to the first index; if in the If the first index is not found in the index table corresponding to the memory of the target storage node, the target picture is read from the disk;
如果所述目标图片对应的缓存类型为SSD加速,则根据所述索引信息,确定所述目标图片存储在SSD中的第二索引,如果在所述目标存储节点配置的SSD对应的索引表中查找到所述第二索引,则根据所述第二索引,从所述目标存储节点配置的SSD中读取所述目标图片;If the cache type corresponding to the target picture is SSD acceleration, the second index of the target picture stored in the SSD is determined according to the index information, and if the index table corresponding to the SSD configured on the target storage node is searched To the second index, read the target picture from the SSD configured on the target storage node according to the second index;
如果在所述目标存储节点配置的SSD对应的索引表中未查找到所述第二索引,则根据所述读取请求,从磁盘中读取所述目标图片。If the second index is not found in the index table corresponding to the SSD configured on the target storage node, the target picture is read from the disk according to the read request.
这样,由于也可以在内存或SSD中读取图片,所以可以快速的读取到图片。In this way, since the picture can also be read in the memory or SSD, the picture can be read quickly.
第二方面,提供了一种写入图片的装置,所述装置应用于云存储系统中的目标存储节点,所述目标存储节点配置有磁盘、内存和SSD;所述装置包括:In a second aspect, a device for writing pictures is provided, the device is applied to a target storage node in a cloud storage system, the target storage node is configured with a disk, a memory, and an SSD; the device includes:
接收模块,用于接收目标图片的写入请求;The receiving module is used to receive the write request of the target picture;
判断模块,用于判断所述目标存储节点所属的图片资源池是否支持加速写入;A judging module for judging whether the image resource pool to which the target storage node belongs supports accelerated writing;
确定模块,用于在所述目标存储节点所属的图片资源池支持加速写入时,如果所述目标图片的数据量小于目标数值,则在所述存储节点的配置信息中获取配置的缓存类型,其中,所述缓存类型为所述目标图片在所述目标存储节点写入时的缓存类型;The determining module is configured to obtain the configured cache type from the configuration information of the storage node when the image resource pool to which the target storage node belongs supports accelerated writing, if the data amount of the target picture is less than the target value, Wherein, the cache type is the cache type of the target picture when the target storage node writes;
写入模块,用于如果所述缓存类型为内存加速,则将所述目标图片写入所述目标存储节点的内存中;A writing module, configured to write the target picture into the memory of the target storage node if the cache type is memory acceleration;
如果所述缓存类型为SSD加速,则将所述目标图片写入所述目标存储节点的SSD中。If the cache type is SSD acceleration, the target picture is written into the SSD of the target storage node.
可选的,所述写入模块,还用于:Optionally, the writing module is also used for:
将所述目标图片写入所述目标存储节点的磁盘。Writing the target picture to the disk of the target storage node.
可选的,所述写入模块,用于:Optionally, the writing module is used for:
如果所述目标存储节点当前的内存余量大于或等于所述目标图片的数据量,则将所述目标图片写入所述目标存储节点的内存中;If the current memory margin of the target storage node is greater than or equal to the data amount of the target picture, writing the target picture into the memory of the target storage node;
如果所述目标存储节点当前的内存余量小于所述目标图片的数据量,则在所述内存中删除写入时间点距离当前时间点最长的图片;If the current memory margin of the target storage node is less than the data amount of the target picture, deleting the picture whose writing time point is the longest from the current time point in the memory;
如果删除图片后的内存余量大于或等于所述目标图片的数据量,则将所述图片写入所述内存中,如果删除图片后的内存余量小于所述目标图片的数据量,则执行所述在所述内存中删除写入时间点距离当前时间点最长的图片的处理。If the memory margin after deleting the picture is greater than or equal to the data amount of the target picture, then the picture is written into the memory, and if the memory margin after deleting the picture is less than the data amount of the target picture, execute The process of deleting the picture whose writing time point is the longest from the current time point in the memory.
可选的,所述接收模块,还用于接收请求方发送的目标图片的读取请求,其中,所述读取请求中携带有所述目标图片存储在磁盘的索引信息;Optionally, the receiving module is further configured to receive a read request of a target picture sent by a requesting party, wherein the read request carries index information of the target picture stored on a disk;
所述判断模块,还用于判断所述目标存储节点所属的图片资源池是否支持加速写入;The judgment module is also used to judge whether the image resource pool to which the target storage node belongs supports accelerated writing;
所述装置还包括:The device also includes:
读取模块,用于如果所述目标存储节点所属的图片资源池支持加速写入,则根据所述目标图片对应的缓存类型和所述读取请求,读取所述目标图片;A reading module, configured to read the target picture according to the cache type corresponding to the target picture and the read request if the picture resource pool to which the target storage node belongs supports accelerated writing;
发送模块,用于向所述请求方发送所述目标图片。The sending module is used to send the target picture to the requester.
可选的,所述读取模块,用于:Optionally, the reading module is used for:
如果所述目标图片对应的缓存类型为内存加速,则根据所述索引信息,确定所述目标图片存储在所述目标存储节点的内存中的第一索引;If the cache type corresponding to the target picture is memory acceleration, determining the first index of the target picture stored in the memory of the target storage node according to the index information;
如果在所述目标存储节点的内存对应的索引表中查找到所述第一索引,则根据所述第一索引,从所述目标存储节点的内存中读取所述目标图片;如果在所述目标存储节点的内存对应的索引表中未查找到所述第一索引,则从磁盘中读取所述目标图片;If the first index is found in the index table corresponding to the memory of the target storage node, read the target picture from the memory of the target storage node according to the first index; if in the If the first index is not found in the index table corresponding to the memory of the target storage node, the target picture is read from the disk;
如果所述目标图片对应的缓存类型为SSD加速,则根据所述索引信息,确定所述目标图片存储在SSD中的第二索引,如果在所述目标存储节点配置的SSD对应的索引表中查找到所述第二索引,则根据所述第二索引,从所述目标存储节点配置的SSD中读取所述目标图片;If the cache type corresponding to the target picture is SSD acceleration, the second index of the target picture stored in the SSD is determined according to the index information, and if the index table corresponding to the SSD configured on the target storage node is searched To the second index, read the target picture from the SSD configured on the target storage node according to the second index;
如果在所述目标存储节点配置的SSD对应的索引表中未查找到所述第二索引,则根据所述读取请求,从磁盘中读取所述目标图片。If the second index is not found in the index table corresponding to the SSD configured on the target storage node, the target picture is read from the disk according to the read request.
第三方面,提供了一种读取图片的方法,所述方法应用于云存储系统中的目标存储节点,所述目标存储节点配置有磁盘、内存和固态硬盘SSD;所述方 法包括:In a third aspect, a method for reading pictures is provided, the method is applied to a target storage node in a cloud storage system, the target storage node is configured with a disk, a memory, and a solid-state hard drive (SSD); the method includes:
所述目标存储节点接收请求方发送的目标图片的读取请求,判断所述目标存储节点所属的图片资源池是否支持加速写入;The target storage node receives the read request of the target picture sent by the requester, and determines whether the picture resource pool to which the target storage node belongs supports accelerated writing;
如果所述目标存储节点所属的图片资源池支持加速写入,且缓存类型为内存加速,则根据所述读取请求,在所述目标存储节点配置的内存中读取所述目标图片,其中,所述缓存类型为所述目标图片在所述目标存储节点写入时的缓存类型;If the image resource pool to which the target storage node belongs supports accelerated writing, and the cache type is memory acceleration, the target image is read in the memory configured by the target storage node according to the read request, where: The cache type is the cache type of the target picture when the target storage node writes;
如果所述目标存储节点所属的图片资源池支持加速写入,且所述缓存类型为SSD加速,则根据所述读取请求,在所述目标存储节点配置的SSD中读取所述目标图片;If the picture resource pool to which the target storage node belongs supports accelerated writing, and the cache type is SSD accelerated, reading the target picture from the SSD configured on the target storage node according to the read request;
向所述请求方发送所述目标图片。Sending the target picture to the requesting party.
这样,图片存储在内存或者SSD,所以可以从内存或SSD中读取图片,由于内存或SSD的读取速度较快,所以可以提升图片的读取效率。In this way, the pictures are stored in the memory or SSD, so the pictures can be read from the memory or SSD. Since the read speed of the memory or SSD is faster, the efficiency of reading pictures can be improved.
可选的,所述读取请求中携带有所述目标图片存储在磁盘的索引信息;Optionally, the read request carries index information of the target picture stored on the disk;
所述根据所述读取请求,在所述目标存储节点配置的内存中读取所述目标图片,包括:The reading the target picture in the memory configured by the target storage node according to the reading request includes:
根据所述索引信息,确定所述目标图片存储在所述目标存储节点的内存中的第一索引;Determine the first index of the target picture stored in the memory of the target storage node according to the index information;
如果在所述目标存储节点的内存对应的索引表中查找到所述第一索引,则根据所述第一索引,从所述目标存储节点的内存中读取所述目标图片。If the first index is found in the index table corresponding to the memory of the target storage node, the target picture is read from the memory of the target storage node according to the first index.
可选的,所述读取请求中携带有所述目标图片存储在磁盘的索引信息;Optionally, the read request carries index information of the target picture stored on the disk;
所述根据所述读取请求,在所述目标存储节点配置的SSD中读取所述目标图片,包括:The reading the target picture in the SSD configured on the target storage node according to the reading request includes:
根据所述索引信息,确定所述目标图片存储在SSD中的第二索引;Determine the second index of the target picture stored in the SSD according to the index information;
如果在所述目标存储节点配置的SSD对应的索引表中查找到所述第二索引,则根据所述第二索引,从所述目标存储节点配置的SSD中读取所述目标图片。If the second index is found in the index table corresponding to the SSD configured on the target storage node, the target picture is read from the SSD configured on the target storage node according to the second index.
第四方面,提供了一种写入图片的存储节点,所述存储节点包括处理器和存储器,所述存储器中存储有至少一条指令,所述指令由所述处理器加载并执行以实现如上述第一方面所述的写入图片的方法。In a fourth aspect, a storage node for writing pictures is provided, the storage node includes a processor and a memory, and at least one instruction is stored in the memory, and the instruction is loaded and executed by the processor to achieve the above The method of writing pictures described in the first aspect.
第五方面,提供了一种计算机可读存储介质,所述存储介质中存储有至少一条指令,所述指令由处理器加载并执行以实现如上述第一方面所述的写入图片的方法。In a fifth aspect, a computer-readable storage medium is provided, and at least one instruction is stored in the storage medium, and the instruction is loaded and executed by a processor to implement the method for writing a picture as described in the first aspect.
本公开实施例提供的技术方案带来的有益效果至少包括:The beneficial effects brought about by the technical solutions provided by the embodiments of the present disclosure include at least:
本公开实施例中,云存储系统中的目标存储节点配置有磁盘、内存和SSD。在云存储系统中写入目标图片时,目标存储节点可以接收目标图片的写入请求,判断目标存储节点所属的图片资源池是否支持加速写入,如果存储节点所属的图片资源池支持加速写入,则判断目标图片的数据量与目标数值的大小,如果目标图片的数据量小于目标数值,则在存储节点的配置信息中获取配置的缓存类型。如果缓存类型为内存加速,则目标存储节点将目标图片写入目标存储节点的内存中,如果缓存类型为SSD加速,则目标存储节点将目标图片写入目标存储节点配置的SSD中。这样,在图片的数据量比较小时,可以将图片存储至内存或SSD中,由于内存或SSD写入速度较快,所以在图片的数据量比较小时,可以相对提升图片的写入速度,进而可以提高写入效率。而且图片存储至内存或者SSD,可以从内存或SSD中读取图片,由于内存或SSD的读取速度较快,也可以提升图片的读取效率。In the embodiment of the present disclosure, the target storage node in the cloud storage system is configured with a disk, a memory, and an SSD. When writing a target picture in the cloud storage system, the target storage node can receive the write request of the target picture and determine whether the picture resource pool to which the target storage node belongs supports accelerated writing, and if the picture resource pool to which the storage node belongs supports accelerated writing , The data amount of the target picture and the size of the target value are judged. If the data amount of the target picture is less than the target value, the configured cache type is obtained from the configuration information of the storage node. If the cache type is memory acceleration, the target storage node writes the target image into the memory of the target storage node. If the cache type is SSD acceleration, the target storage node writes the target image into the SSD configured by the target storage node. In this way, when the amount of data of the picture is relatively small, the picture can be stored in the memory or SSD. Since the writing speed of the memory or SSD is faster, when the amount of data of the picture is relatively small, the writing speed of the picture can be relatively improved. Improve writing efficiency. And the picture is stored in the memory or SSD, and the picture can be read from the memory or SSD. Since the reading speed of the memory or SSD is faster, the reading efficiency of the picture can also be improved.
附图说明Description of the drawings
图1是本公开实施例提供的一种云存储系统的示意图;FIG. 1 is a schematic diagram of a cloud storage system provided by an embodiment of the present disclosure;
图2是本公开实施例提供的一种写入图片的方法流程图;FIG. 2 is a flowchart of a method for writing pictures according to an embodiment of the present disclosure;
图3是本公开实施例提供的一种设置缓存类型的示意图;FIG. 3 is a schematic diagram of setting a cache type according to an embodiment of the present disclosure;
图4是本公开实施例提供的一种设置目标数值的示意图;FIG. 4 is a schematic diagram of setting a target value provided by an embodiment of the present disclosure;
图5是本公开实施例提供的一种设置加速策略的示意图;FIG. 5 is a schematic diagram of setting an acceleration strategy according to an embodiment of the present disclosure;
图6是本公开实施例提供的一种提取图片的方法流程图;FIG. 6 is a flowchart of a method for extracting pictures provided by an embodiment of the present disclosure;
图7是本公开实施例提供的一种写入图片的装置的结构示意图;FIG. 7 is a schematic structural diagram of an apparatus for writing pictures according to an embodiment of the present disclosure;
图8是本公开实施例提供的一种写入图片的装置的结构示意图;FIG. 8 is a schematic structural diagram of an apparatus for writing pictures according to an embodiment of the present disclosure;
图9是本公开实施例提供的一种存储节点的结构示意图。FIG. 9 is a schematic structural diagram of a storage node provided by an embodiment of the present disclosure.
具体实施方式detailed description
为使本公开的目的、技术方案和优点更加清楚,下面将结合附图对本公开 实施方式作进一步地详细描述。In order to make the objectives, technical solutions, and advantages of the present disclosure clearer, the following further describes the embodiments of the present disclosure in detail with reference to the accompanying drawings.
本公开实施例提供了一种写入图片的方法,该方法的执行主体可以是存储节点,存储节点可以是服务器。The embodiment of the present disclosure provides a method for writing a picture. The execution subject of the method may be a storage node, and the storage node may be a server.
存储节点中可以设置有处理器、存储器和收发器等,处理器可以用于写入图片的过程的处理,例如,处理器用于在存储节点中写入图片,从存储节点中读取图片等。存储器可以用于写入图片的过程中需要的数据以及产生的数据,例如,存储器用于存储写入的图片等,收发器可以用于接收以及发送数据,例如,可以用于发送或者接收图片,还可以用于接收图片的写入请求、图片的读取请求等。The storage node may be provided with a processor, a memory, a transceiver, etc., and the processor may be used to process the process of writing pictures. For example, the processor is used to write pictures in the storage node, read pictures from the storage node, and so on. The memory can be used for the data needed and generated during the process of writing pictures. For example, the memory is used for storing written pictures. The transceiver can be used for receiving and sending data. For example, it can be used for sending or receiving pictures. It can also be used to receive picture write requests, picture read requests, and so on.
在进行实施前,首先介绍一下本公开实施例涉及的应用场景:Before implementation, first introduce the application scenarios involved in the embodiments of the present disclosure:
本公开实施例中提到的写入图片的方法,应用于云存储系统的存储节点,存储节点为多个。云存储系统中的存储节点可以被划分到不同的图片资源池中,且不同的图片资源池中不会存在相同的存储节点。这样可以认为云存储系统中包括多个图片资源池,每个图片资源池可以被配置为支持加速写入或者不支持加速写入。支持加速写入的图片资源池中的存储节点配置有磁盘、内存和SSD,不支持加速写入的图片资源池中的存储节点可以配置有磁盘、内存和SSD,也可以仅配置有磁盘和内存。此处需要说明的是图片资源池是一个虚拟的存储空间。The method for writing pictures mentioned in the embodiments of the present disclosure is applied to a storage node of a cloud storage system, and there are multiple storage nodes. The storage nodes in the cloud storage system can be divided into different picture resource pools, and the same storage node will not exist in different picture resource pools. In this way, it can be considered that the cloud storage system includes multiple image resource pools, and each image resource pool can be configured to support accelerated writing or not to support accelerated writing. The storage node in the image resource pool that supports accelerated writing is configured with disk, memory, and SSD. The storage node in the image resource pool that does not support accelerated writing can be configured with disk, memory, and SSD, or only with disk and memory. . What needs to be explained here is that the image resource pool is a virtual storage space.
如图1所示,云存储系统可以包括应用层、设备层。应用层包括管理节点和存储节点,多个存储节点形成图片资源池,管理节点可以用于管理图片资源池中的存储节点。设备层包括存储节点的外部存储部件,如磁盘和SSD。另外,在应用层和设备层之间还包括虚拟文件系统层,用于连接设备层和应用层。As shown in Figure 1, the cloud storage system may include an application layer and a device layer. The application layer includes a management node and a storage node. Multiple storage nodes form a picture resource pool, and the management node can be used to manage storage nodes in the picture resource pool. The device layer includes external storage components of storage nodes, such as disks and SSDs. In addition, a virtual file system layer is also included between the application layer and the device layer to connect the device layer and the application layer.
如图2所示,本公开实施例提供了一种写入图片的方法,以摄像机拍摄的图片进行存储时为例进行说明,该方法的处理流程可以如下:As shown in FIG. 2, an embodiment of the present disclosure provides a method for writing a picture, taking a picture taken by a camera for storage as an example for description, and the processing flow of the method may be as follows:
步骤201,目标存储节点接收目标图片的写入请求,判断目标存储节点所属的图片资源池是否支持加速写入。Step 201: The target storage node receives the write request of the target picture, and judges whether the picture resource pool to which the target storage node belongs supports accelerated writing.
其中,目标图片可以是任一张图片。Among them, the target picture can be any picture.
在实施中,摄像机拍摄到目标图片之后,可以生成写入请求,并在其中添加目标图片,摄像机确定连接的管理节点。然后向该管理节点发送该写入请求。 管理节点接收到写入请求后,可以查看该摄像机的标识所连接的图片资源池,确定该图片资源池中包括的存储节点中各存储节点的存储量,以及各存储节点的总存储空间。对于任一存储节点,将该存储节点的存储量与该存储节点的总存储空间容量相比,得到该存储节点的存储占用率。管理节点可以选择占用率最少的存储节点(后可以称为是目标存储节点),向该目标存储节点发送目标图片的写入请求。In implementation, after the camera captures the target picture, it can generate a write request and add the target picture to it, and the camera determines the management node to connect to. Then send the write request to the management node. After receiving the write request, the management node can view the image resource pool connected to the camera ID, and determine the storage capacity of each storage node in the storage nodes included in the image resource pool, and the total storage space of each storage node. For any storage node, compare the storage capacity of the storage node with the total storage space capacity of the storage node to obtain the storage occupancy rate of the storage node. The management node may select the storage node with the least occupancy rate (hereinafter may be referred to as the target storage node), and send a write request of the target picture to the target storage node.
目标存储节点可以接收管理节点发送的写入请求,从该写入请求中解析得到目标图片。The target storage node may receive the write request sent by the management node, and parse the write request to obtain the target picture.
目标存储节点可以获取存储节点与图片资源池的对应关系,从该对应关系中,确定目标存储节点所属的图片资源池,或者,目标存储节点的配置信息中包括自身所属的图片资源池的标识,目标存储节点可以直接从配置信息获取到自身所属的图片资源池的标识。然后目标存储节点获取该图片资源池的配置文件,从该配置文件中,获取该图片资源池的写入标识位,根据该写入标识位的数值,确定图片资源池是否支持加速写入。The target storage node may obtain the corresponding relationship between the storage node and the picture resource pool, and from the corresponding relationship, determine the picture resource pool to which the target storage node belongs, or the configuration information of the target storage node includes the identity of the picture resource pool to which it belongs, The target storage node can directly obtain the identification of the picture resource pool to which it belongs from the configuration information. Then the target storage node obtains the configuration file of the image resource pool, obtains the writing flag of the image resource pool from the configuration file, and determines whether the image resource pool supports accelerated writing according to the value of the writing flag.
另外,上述是基于存储节点的存储占用率,确定目标存储节点,在本公开实施例中也可以基于存储节点的存储占用率和存储节点的中央处理器(Central Processing Unit,CPU)占用率的加权值,确定目标存储节点。例如,管理节点将存储占用率和CPU占用率的加权值最小的存储节点,确定为目标存储节点。存储占用率和CPU占用率分别对应的权值系数不相同,且和为1,且存储占用率对应的权值系数大于CPU占用率对应的权值系数。In addition, the foregoing is based on the storage occupancy rate of the storage node to determine the target storage node. In the embodiments of the present disclosure, it may also be based on the weighting of the storage occupancy rate of the storage node and the central processing unit (CPU) occupancy rate of the storage node. Value to determine the target storage node. For example, the management node determines the storage node with the smallest weighted value of the storage occupancy rate and the CPU occupancy rate as the target storage node. The weight coefficients corresponding to the storage occupancy rate and the CPU occupancy rate are different, and the sum is 1, and the weight coefficient corresponding to the storage occupancy rate is greater than the weight coefficient corresponding to the CPU occupancy rate.
步骤202,在目标存储节点所属的图片资源池支持加速写入时,如果目标图片的数据量小于目标数值,则在存储节点的配置信息中获取配置的缓存类型。Step 202: When the image resource pool to which the target storage node belongs supports accelerated writing, if the data amount of the target image is less than the target value, obtain the configured cache type from the configuration information of the storage node.
其中,目标数值可以被设置,并且存储在存储节点中,目标数值一般属于0~500k,可以设置为100k。缓存类型一般分为不加速、内存加速和SSD加速等。Among them, the target value can be set and stored in the storage node. The target value generally belongs to 0~500k and can be set to 100k. Cache types are generally divided into non-accelerated, memory accelerated, and SSD accelerated.
在实施中,在目标存储节点所属的图片资源池的写入标识位的数值为第一数值时,目标存储节点可以确定该图片资源池支持加速写入。在目标存储节点所属的图片资源池的写入标识位的数值为第二数值时,目标存储节点可以确定该图片资源池不支持加速写入。第一数值与第二数值是不同的数值。例如,第一数值可以为1,第二数值可以为0。In implementation, when the value of the write flag of the picture resource pool to which the target storage node belongs is the first value, the target storage node may determine that the picture resource pool supports accelerated writing. When the value of the write flag of the picture resource pool to which the target storage node belongs is the second value, the target storage node may determine that the picture resource pool does not support accelerated writing. The first value and the second value are different values. For example, the first value may be 1, and the second value may be zero.
然后目标存储节点可以确定目标图片的数据量与目标数值的大小关系,如 果目标图片的数据量小于目标数值,则可以在目标存储节点的配置信息中,获取配置的缓存类型,然后将该缓存类型设置为目标图片对应的缓存类型。这样,在图片的数据量小于目标数值时,可以通过内存或者SSD的方式进行加速,提高写入速度。这样,由于设置了目标数值,图片的数据量比较小的时候,可以存储在SSD或者内存中,图片的数据量比较大的时候,可以存储在磁盘中,不仅不会丢失图片,而且也提升了数据量比较小的图片的读取速度。Then the target storage node can determine the relationship between the data volume of the target image and the target value. If the data volume of the target image is less than the target value, it can obtain the configured cache type from the configuration information of the target storage node, and then set the cache type Set to the cache type corresponding to the target image. In this way, when the data volume of the picture is less than the target value, it can be accelerated by means of memory or SSD to increase the writing speed. In this way, because the target value is set, when the amount of image data is relatively small, it can be stored in SSD or memory, and when the amount of image data is relatively large, it can be stored in the disk, not only without losing the image, but also improving The reading speed of pictures with a relatively small amount of data.
可选的,为了防止图片的数据丢失,还可以进行如下处理:Optionally, in order to prevent the loss of image data, you can also perform the following processing:
目标存储节点将目标图片写入目标存储节点的磁盘。The target storage node writes the target image to the disk of the target storage node.
在实施中,目标存储节点在接收到写入请求后,可以首先将目标图片直接写入到目标存储节点的磁盘中,然后再判断目标存储节点所属的图片资源池是否支持加速写入。或者,目标存储节点在接收到目标图片的写入请求后,可以先判断目标存储节点所属的图片资源池是否支持加速写入,再将目标图片写入到磁盘中。这样,在图片资源池不支持加速或者支持加速,均也可以将图片写入磁盘,可以防止图片数据丢失。In implementation, after receiving the write request, the target storage node may first directly write the target image to the disk of the target storage node, and then determine whether the image resource pool to which the target storage node belongs supports accelerated writing. Alternatively, after receiving the write request of the target picture, the target storage node may first determine whether the picture resource pool to which the target storage node belongs supports accelerated writing, and then write the target picture to the disk. In this way, if the image resource pool does not support acceleration or supports acceleration, the image can also be written to the disk, which can prevent the loss of image data.
另外,在步骤202中,如果目标图片的数据量大于或等于目标数值,由于目标图片已经写入目标存储节点的磁盘中,所以就不需要进行后续处理,目标图片的写入处理完成。另外,如果目标图片不支持加速写入,则将目标图片写入到目标存储节点的磁盘中,就不需要进行后续处理,目标图片的写入处理完成。In addition, in step 202, if the data amount of the target picture is greater than or equal to the target value, since the target picture has been written to the disk of the target storage node, subsequent processing is not required, and the writing process of the target picture is completed. In addition, if the target picture does not support accelerated writing, the target picture is written to the disk of the target storage node, no subsequent processing is required, and the writing process of the target picture is completed.
步骤203,如果缓存类型为内存加速,则将目标图片写入存储节点的内存中;如果缓存类型为固态硬盘SSD加速,则将目标图片写入存储节点的SSD中。Step 203: If the cache type is memory acceleration, the target image is written into the memory of the storage node; if the cache type is solid state drive SSD acceleration, the target image is written into the SSD of the storage node.
在实施中,如果目标图片的缓存类型为内存加速,则目标存储节点可以将目标图片写入到目标存储节点的内存中,并且创建目标图片的索引值,用于后续从目标存储节点的内存中读取目标图片。此处索引值可以是目标图片的标识。对应内存,目标存储节点维护有索引表,索引表中包括索引值与存储位置信息的对应关系,目标存储节点还记录了索引值与目标图片存储在磁盘中的块的标识的对应关系,这样,后续可以使用磁盘中的块的标识,找到目标图片在内存中的存储位置信息。In implementation, if the cache type of the target image is memory acceleration, the target storage node can write the target image into the memory of the target storage node, and create the index value of the target image for subsequent retrieval from the memory of the target storage node Read the target picture. The index value here can be the identification of the target picture. Corresponding to the memory, the target storage node maintains an index table. The index table includes the corresponding relationship between the index value and the storage location information. The target storage node also records the corresponding relationship between the index value and the block identifier of the target image stored on the disk. In this way, Later, you can use the identifier of the block in the disk to find the storage location information of the target picture in the memory.
如果缓存类型为SSD加速,则目标存储节点可以确定自身的SSD,将目标图片写入到自身的SSD中,并且创建目标图片的索引值,用于后续从SSD中读 取目标图片。此处索引值可以是目标图片的标识。对应SSD,目标存储节点维护有索引表,索引表中包括索引值与存储位置信息的对应关系,目标存储节点还记录了索引值与图片存储在磁盘中的块的标识的对应关系,这样,后续可以使用磁盘中的块的标识,找到目标图片存储在SSD中的存储位置信息。If the cache type is SSD acceleration, the target storage node can determine its own SSD, write the target picture into its own SSD, and create the index value of the target picture for subsequent reading of the target picture from the SSD. The index value here can be the identification of the target picture. Corresponding to the SSD, the target storage node maintains an index table. The index table includes the corresponding relationship between the index value and the storage location information. The target storage node also records the corresponding relationship between the index value and the block identifier of the picture stored on the disk. In this way, the subsequent You can use the identifier of the block in the disk to find the storage location information of the target image stored in the SSD.
这样,由于有了内存存储和SSD存储,所以对于数据量较小的图片,可以使写入图片和读取图片的速度更快。In this way, due to the memory storage and SSD storage, for pictures with a small amount of data, the speed of writing pictures and reading pictures can be made faster.
可选的,在将目标图片写入目标存储节点的内存中时,还会判断目标图片的数据量与内存余量的大小,处理可以如下:Optionally, when the target image is written into the memory of the target storage node, the data amount of the target image and the size of the memory margin are also determined, and the processing can be as follows:
如果目标存储节点当前的内存余量大于或等于目标图片的数据量,则将目标图片写入目标存储节点的内存中;如果目标存储节点当前的内存余量小于目标图片的数据量,则在内存中删除写入时间点距离当前时间点最长的图片;如果删除图片后的内存余量大于或等于目标图片的数据量,则将图片写入内存中,如果删除图片后的内存余量小于目标图片的数据量,则执行在内存中删除写入时间点距离当前时间点最长的图片的处理。If the current memory margin of the target storage node is greater than or equal to the data amount of the target image, the target image is written into the memory of the target storage node; if the current memory margin of the target storage node is less than the data amount of the target image, then the target image is written in the memory Delete the picture that is the longest from the current time point in the writing time point; if the memory margin after deleting the picture is greater than or equal to the data amount of the target picture, then the picture is written into the memory, if the memory margin after deleting the picture is less than the target For the amount of data of the picture, the process of deleting the picture whose writing time point is the longest from the current time point in the memory is executed.
在实施中,目标存储节点可以确定当前内存的内存余量,内存余量指当前内存中还未存储数据的空间。然后目标存储节点可以比较内存余量与目标图片的数据量的大小。如果内存余量大于或等于目标图片的数据量,则可以直接将目标图片写入到目标存储节点的内存中。In implementation, the target storage node can determine the memory margin of the current memory, and the memory margin refers to the space in the current memory that has not yet stored data. Then the target storage node can compare the memory margin with the size of the data volume of the target picture. If the memory margin is greater than or equal to the data amount of the target picture, the target picture can be directly written into the memory of the target storage node.
如果内存余量小于目标图片的数据量,则目标存储节点可以确定内存中,写入时间点距离当前时间点最长的图片,然后将该图片删除。然后判断当前的内存余量,如果内存余量大于或等于目标图片的数据量,则可以直接将目标图片写入到内存中。如果当前内存余量依然小于目标图片的数据量,则可以继续删除当前内存中,写入时间点距离当前时间点最长的图片,直到内存余量大于或等于目标图片的数据量,将目标图片写入到目标存储节点的内存中。If the memory margin is less than the data amount of the target picture, the target storage node can determine the picture with the longest time point from the current time point in the memory, and then delete the picture. Then determine the current memory margin, if the memory margin is greater than or equal to the data amount of the target picture, you can directly write the target picture into the memory. If the current memory margin is still less than the data amount of the target picture, you can continue to delete the picture in the current memory and write the picture with the longest time point from the current time point until the memory margin is greater than or equal to the data amount of the target picture. Write to the memory of the target storage node.
另外,在本公开实施例中,目标存储节点在将目标图片写入到目标存储节点的磁盘中后,可以向管理节点返回索引信息,索引信息为目标图片写入的磁盘的标识以及块的标识。In addition, in the embodiment of the present disclosure, after the target storage node writes the target image to the disk of the target storage node, it may return index information to the management node, where the index information is the identifier of the disk to which the target image is written and the identifier of the block. .
需要说明的是,上述图2所示的流程可以是通过目标存储节点上的一个应用程序执行。在该应用程序启动后,可以读取目标存储节点的配置信息,从中获取缓存类型、内存大小,目标数值等配置项。如果该应用程序检测到配置项 中内存缓存开启,则可以根据内存大小,创建用于缓存图片的内存,并初始化内存,后续可以使用内存缓存图片。如果内存分配失败,则该应用程序启动失败,后续不能使用内存缓存图片。It should be noted that the process shown in FIG. 2 may be executed by an application on the target storage node. After the application is started, the configuration information of the target storage node can be read, and configuration items such as the cache type, memory size, and target value can be obtained from it. If the application detects that the memory cache is enabled in the configuration item, it can create a memory for caching pictures according to the size of the memory, and initialize the memory, and then use the memory to cache pictures. If the memory allocation fails, the application fails to start, and the memory cannot be used to cache pictures subsequently.
另外,在图2所示的流程中,可以是通过目标存储节点上的一个应用程序执行,该应用程序中,有两个进程,一个进程为A进程,另一个进程为B进程,A进程与B进程通过unix域套接字链路连接,在图2的流程中,A进程可以接收请求方的写入请求,通过unix域套接字链路告知给B进程,B进程可以执行上述步骤202至203。然后写入目标图片之后,通过unix域套接字链路返回索引信息(该索引信息为存储在磁盘中的磁盘的标识和块的标识),给A进程。A进程可以反馈给请求方。In addition, in the process shown in Figure 2, it can be executed by an application on the target storage node. In the application, there are two processes, one is A process, the other is B process, A and Process B is connected through a unix domain socket link. In the process shown in Figure 2, process A can receive the requester’s write request and inform process B through the unix domain socket link. Process B can perform the above step 202 To 203. Then after writing the target picture, the index information (the index information is the identifier of the disk and the identifier of the block stored in the disk) is returned to the A process through the unix domain socket link. Process A can feed back to the requesting party.
另外,本公开实施例中,还提供了目标存储节点获取缓存类型的过程:In addition, in the embodiment of the present disclosure, a process for the target storage node to obtain the cache type is also provided:
如图3所示,用户可以在终端显示的云存储系统管理页面中,点击设置缓存类型的选项,触发终端显示未设置缓存类型的存储节点,在其中找到目标存储节点,为目标存储节点选择缓存类型。然后用户可以点击确认选项,触发生成缓存类型的设置信息(该设置信息中携带有设置的缓存类型),向目标存储节点发送缓存类型的设置信息(a1)。目标存储节点可以将用户设置的缓存类型更新到配置文件中(a2),然后向云存储系统管理页面的显示终端返回成功(a3)。As shown in Figure 3, the user can click the option to set the cache type on the cloud storage system management page displayed on the terminal to trigger the terminal to display the storage node that has not set the cache type, find the target storage node in it, and select the cache for the target storage node Types of. Then the user can click the confirmation option to trigger the generation of the setting information of the cache type (the setting information carries the set cache type), and send the setting information of the cache type to the target storage node (a1). The target storage node can update the cache type set by the user to the configuration file (a2), and then return success to the display terminal of the cloud storage system management page (a3).
另外,本公开实施例中,还提供了目标存储节点获取目标数值的过程:In addition, in the embodiments of the present disclosure, a process for the target storage node to obtain the target value is also provided:
如图4所示,用户可以在终端显示的云存储系统管理页面中,点击阈值设置选项,终端则会显示阈值输入框,用户可以输入目标数值。然后用户可以点击确定选项,触发终端向管理节点发送阈值的设置信息(该设置信息中携带有目标数值)(b1)。管理节点将目标数值插入到管理节点的数据库中(b2),并且将目标数值更新至zookeeper节点(b3)。目标存储节点可以监听zookeeper节点,获取目标数值,写入内存,并写入到自身的配置文件中(b4)。另外,其它管理节点可以通过监听该管理节点的目标数值,将目标数值同步到自己的内存和数据库中。As shown in Figure 4, the user can click the threshold setting option on the cloud storage system management page displayed on the terminal, and the terminal will display a threshold input box, and the user can enter the target value. Then the user can click the OK option to trigger the terminal to send the threshold setting information (the setting information carries the target value) (b1). The management node inserts the target value into the database of the management node (b2), and updates the target value to the zookeeper node (b3). The target storage node can monitor the zookeeper node, obtain the target value, write it into the memory, and write it to its configuration file (b4). In addition, other management nodes can synchronize the target value to their own memory and database by monitoring the target value of the management node.
另外,本公开实施例中,还提供了目标存储节点获取图片资源池是否支持加速的指示消息的过程:In addition, in the embodiment of the present disclosure, a process for the target storage node to obtain an indication message of whether the image resource pool supports acceleration is also provided:
如图5所示,用户可以在终端的云存储系统管理页面中,点击加速策略设置选项,触发终端显示未设置加速策略的图片资源池,在其中找到目标存储节 点所属的图片资源池,为目标存储节点所属的图片资源池选择加速策略。然后用户可以点击确认选项,触发终端生成加速指示信息,加速指示信息可以用于指示支持加速和不支持加速中的任一种加速策略。然后终端将加速指示信息发送至管理节点(c1),管理节点可以将加速指示信息中加速策略插入到管理节点的数据库中(c2),并且将加速策略更新至zookeeper节点(c3)。目标存储节点可以监听zookeeper节点,获取加速策略,写入内存,并写入到自身的配置文件中(c4)。另外,其它管理节点可以通过监听该管理节点的加速策略,将加速策略同步到自己的内存和数据库中。As shown in Figure 5, the user can click the acceleration policy setting option on the cloud storage system management page of the terminal to trigger the terminal to display the image resource pool for which the acceleration policy is not set, and find the image resource pool to which the target storage node belongs, as the target Select the acceleration strategy for the image resource pool to which the storage node belongs. Then the user can click the confirmation option to trigger the terminal to generate acceleration indication information, which can be used to indicate any acceleration strategy of acceleration support and non-support acceleration. Then the terminal sends the acceleration instruction information to the management node (c1), and the management node can insert the acceleration strategy in the acceleration instruction information into the database of the management node (c2), and update the acceleration strategy to the zookeeper node (c3). The target storage node can monitor the zookeeper node, obtain the acceleration strategy, write to the memory, and write to its own configuration file (c4). In addition, other management nodes can synchronize the acceleration strategy to their own memory and database by monitoring the acceleration strategy of the management node.
可选的,上述管理节点接收加速指示信息和目标数值,均是使用CLI(command-line interface,命令行界面)接口进行接收的,同样,上述目标存储节点接收缓存类型时,也是使用CLI进行接收的。Optionally, the above-mentioned management node receives the acceleration indication information and the target value through CLI (command-line interface) interface. Similarly, when the above-mentioned target storage node receives the cache type, it also uses CLI to receive it. of.
另外,本公开实施例中,也可以修改图片资源池的缓存类型。用户可以在终端的云存储系统管理页面中,选择目标存储节点所属的图片资源池,重新为目标存储节点所属的图片资源池选择加速策略。然后用户可以点击确认选项,触发终端生成更新加速指示信息,更新加速指示信息可以用于指示修改后的加速策略。然后终端将更新加速指示信息发送至管理节点,管理节点可以使用更新加速指示信息中的加速策略更新当前已有的加速策略。目标存储节点可以监听zookeeper节点,获取更新后的加速策略,将更新后的加速策略写入内存,并更新自身配置文件中已有的加速策略。In addition, in the embodiments of the present disclosure, the cache type of the picture resource pool can also be modified. The user can select the image resource pool to which the target storage node belongs in the cloud storage system management page of the terminal, and re-select the acceleration strategy for the image resource pool to which the target storage node belongs. Then the user can click the confirmation option to trigger the terminal to generate update acceleration indication information, which can be used to indicate the modified acceleration strategy. Then the terminal sends the update acceleration instruction information to the management node, and the management node can use the acceleration strategy in the update acceleration instruction information to update the currently existing acceleration strategy. The target storage node can monitor the zookeeper node, obtain the updated acceleration strategy, write the updated acceleration strategy into the memory, and update the existing acceleration strategy in its configuration file.
可选的,如图6所示,本公开实施例中,还提供了读取目标图片的处理,相应的处理流程可以如下:Optionally, as shown in FIG. 6, in the embodiment of the present disclosure, processing of reading the target picture is also provided, and the corresponding processing flow may be as follows:
步骤601,接收请求方发送的目标图片的读取请求,其中,读取请求中携带有目标图片存储在磁盘的索引信息。Step 601: Receive a read request for a target picture sent by the requesting party, where the read request carries index information of the target picture stored on the disk.
在实施中,在要查看目标图片时,可以进行目标图片的读取,查看目标图片的用户可以操作终端(即请求方),向目标存储节点发送目标图片的读取请求。在该读取请求中携带有目标图片存储在磁盘中的索引信息,可以是磁盘的标识和磁盘中的块的标识。In implementation, when the target picture is to be viewed, the target picture can be read, and the user viewing the target picture can operate the terminal (that is, the requester) to send a read request of the target picture to the target storage node. The read request carries the index information of the target picture stored in the disk, which may be the identifier of the disk and the identifier of the block in the disk.
目标存储节点可以接收目标图片的读取请求,从中解析到目标图片存储在磁盘的索引信息,即所存储磁盘的标识和磁盘中的块的标识。The target storage node may receive the read request of the target picture, and parse the index information of the target picture stored on the disk, that is, the identifier of the stored disk and the identifier of the block in the disk.
步骤602,判断目标存储节点所属的图片资源池是否支持加速写入,如果目 标存储节点所属的图片资源池支持加速写入,则根据目标图片对应的缓存类型和读取请求,读取目标图片。Step 602: Determine whether the picture resource pool to which the target storage node belongs supports accelerated writing. If the picture resource pool to which the target storage node belongs supports accelerated writing, read the target picture according to the cache type and read request corresponding to the target picture.
在实施中,目标存储节点可以获取存储节点与图片资源池的对应关系,从该对应关系中,确定目标存储节点所属的图片资源池,或者,目标存储节点的配置信息中包括自身所属的图片资源池的标识,目标存储节点可以直接从配置信息获取到自身所属的图片资源池。然后获取该图片资源池的配置文件,从该配置文件中,获取该图片资源池的写入标识位,根据该写入标识位的数值,如果该数值为第一数值,则确定该图片资源池支持加速写入,如果该数值为第二数值,则确定该图片资源池不支持加速写入。In implementation, the target storage node can obtain the corresponding relationship between the storage node and the picture resource pool, and from the corresponding relationship, determine the picture resource pool to which the target storage node belongs, or the configuration information of the target storage node includes the picture resource to which it belongs The identification of the pool, the target storage node can directly obtain the picture resource pool to which it belongs from the configuration information. Then obtain the configuration file of the picture resource pool, obtain the write flag of the picture resource pool from the configuration file, and determine the picture resource pool according to the value of the write flag if the value is the first value Support accelerated writing. If the value is the second value, it is determined that the image resource pool does not support accelerated writing.
如果目标存储节点所属的图片资源池支持加速写入,则目标存储节点可以在配置文件中获取缓存类型的配置项,根据配置项的数值,确定缓存类型,缓存类型为不加速、内存加速和SSD加速中任意一种,将配置文件中的缓存类型确定为目标图片对应的缓存类型(此过程在前面已经论述,此处不再赘述)。例如,如果配置项的数值为0,则确定缓存类型为不加速,如果配置项的数值为1,则确定缓存类型为SSD加速,如果配置项的数值为2,则确定缓存类型为内存加速。If the image resource pool to which the target storage node belongs supports accelerated writing, the target storage node can obtain the configuration item of the cache type in the configuration file, and determine the cache type according to the value of the configuration item. The cache type is no acceleration, memory acceleration, and SSD In any of the acceleration, the cache type in the configuration file is determined as the cache type corresponding to the target picture (this process has been discussed above, and will not be repeated here). For example, if the value of the configuration item is 0, the cache type is determined to be no acceleration, if the value of the configuration item is 1, the cache type is determined to be SSD acceleration, and if the value of the configuration item is 2, the cache type is determined to be memory acceleration.
目标存储节点可以使用目标图片对应的缓存类型和目标图片存储在磁盘的索引信息,在目标存储节点中读取出目标图片。The target storage node can use the cache type corresponding to the target picture and the index information of the target picture stored on the disk to read the target picture from the target storage node.
可选的,可以按照如下方式读取目标图片:Optionally, the target image can be read as follows:
如果目标图片对应的缓存类型为内存加速,则根据索引信息,确定目标图片存储在目标存储节点的内存中的第一索引,如果在目标存储节点的内存对应的索引表中查找到第一索引,则根据第一索引,从目标存储节点的内存中读取目标图片;如果在目标存储节点的内存对应的索引表中未查找到第一索引,则从磁盘中读取目标图片,如果目标图片对应的缓存类型为SSD加速,则根据索引信息,确定目标图片存储在SSD中的第二索引,如果在目标存储节点配置的SSD对应的索引表中查找到第二索引,则根据第二索引,从目标存储节点配置的SSD中读取目标图片,如果在目标存储节点配置的SSD对应的索引表中未查找到第二索引,则根据读取请求,从磁盘中读取目标图片。If the cache type corresponding to the target image is memory acceleration, the first index of the target image stored in the memory of the target storage node is determined according to the index information. If the first index is found in the index table corresponding to the memory of the target storage node, According to the first index, the target picture is read from the memory of the target storage node; if the first index is not found in the index table corresponding to the memory of the target storage node, the target picture is read from the disk. If the target picture corresponds to If the cache type of is SSD acceleration, the second index of the target image stored in the SSD is determined according to the index information. If the second index is found in the index table corresponding to the SSD configured on the target storage node, the second index is used from The target image is read from the SSD configured on the target storage node. If the second index is not found in the index table corresponding to the SSD configured on the target storage node, the target image is read from the disk according to the read request.
在实施中,如果目标图片对应的缓存类型为内存加速,则可以使用索引信息,查找索引值与图片存储在磁盘中的块的标识的对应关系,确定目标图片存 储在目标存储节点的内存中的第一索引,然后在目标存储节点的内存对应的索引表中查找是否存在第一索引,如果存在第一索引,则可以在目标存储节点的内存中第一索引对应的位置处读取出目标图片。In implementation, if the cache type corresponding to the target picture is memory acceleration, you can use the index information to find the correspondence between the index value and the identifier of the block stored in the picture on the disk, and determine the target picture stored in the memory of the target storage node. The first index, and then look for the first index in the index table corresponding to the memory of the target storage node. If the first index exists, the target image can be read at the position corresponding to the first index in the memory of the target storage node .
如果在目标存储节点的内存对应的索引表中不存在第一索引,则可以直接从磁盘中,使用磁盘的标识和块的标识,读取目标图片(这种情况一般是目标图片在目标存储节点配置的内存中的存储时间比较久,被删除了)。If the first index does not exist in the index table corresponding to the memory of the target storage node, you can directly read the target image from the disk, using the disk identifier and block identifier (in this case, the target image is generally in the target storage node). The storage time in the configured memory is relatively long and has been deleted).
如果目标图片对应的缓存类型为不加速,则可以直接从磁盘中,使用磁盘的标识和块的标识,读取目标图片。If the cache type corresponding to the target image is not accelerated, the target image can be read directly from the disk using the disk identifier and the block identifier.
如果目标图片对应的缓存类型为SSD加速,则可以根据索引信息,查找索引值与图片存储在磁盘中的块的标识的对应关系,确定目标图片存储在目标存储节点的SSD中的第二索引,如果在目标存储节点的SSD的索引表中能查找到第二索引,则可以在目标存储节点的SSD中第二索引对应的位置处,读取出目标图片。If the cache type corresponding to the target image is SSD acceleration, the corresponding relationship between the index value and the identifier of the block stored in the disk of the image can be found according to the index information, and the second index of the target image stored in the SSD of the target storage node can be determined. If the second index can be found in the index table of the SSD of the target storage node, the target image can be read at the position corresponding to the second index in the SSD of the target storage node.
如果在目标存储节点的SSD的索引表未中能查找到第二索引,则可以使用索引信息中的磁盘的标识和块的标识,读取出目标图片(这种情况一般是目标图片在目标存储节点配置的SSD中的存储时间比较久,被删除了)。If the second index cannot be found in the index table of the SSD of the target storage node, the disk identifier and block identifier in the index information can be used to read the target picture (in this case, the target picture is generally stored in the target storage). The storage time in the SSD of the node configuration is relatively long and has been deleted).
需要说明的是,读取请求中携带MYSQL(Structured Query Language,构造化查询言语)数据库索引(即磁盘的标识和块的标识),用于定位图片的数据在磁盘中的位置。第一索引是图片的数据存储在内存中时生成的,可以称为是内存索引,用于定位图片的数据在内存中的地址。第二索引是图片的数据存储在SSD中时生成,可以称为是DB(databases,数据库)索引,用于定位图片的数据在SSD中的地址。It should be noted that the read request carries a MYSQL (Structured Query Language, structured query language) database index (that is, the identifier of the disk and the identifier of the block), which is used to locate the position of the image data on the disk. The first index is generated when the data of the picture is stored in the memory, and can be called a memory index, which is used to locate the address of the data of the picture in the memory. The second index is generated when the data of the picture is stored in the SSD, and can be called a DB (databases, database) index, which is used to locate the address of the data of the picture in the SSD.
另外,此处也可以是先判断目标图片对应的缓存类型是否为内存加速。若为内存加速,则在内存中读取目标图片,若读取到目标图片,则执行步骤603,若未读取到目标图片,则在磁盘中读取目标图片,若不为内存加速,则在SSD中读取目标图片,若读取到目标图片,则执行步骤603,若未读取到目标图片,则在磁盘中读取目标图片。In addition, it is also possible to first determine whether the cache type corresponding to the target image is memory acceleration. If it is memory acceleration, then read the target image in the memory, if it reads the target image, then go to step 603, if the target image is not read, then read the target image from the disk, if it is not memory acceleration, then The target picture is read in the SSD. If the target picture is read, step 603 is executed. If the target picture is not read, the target picture is read from the disk.
步骤603,向请求方发送目标图片。Step 603: Send the target picture to the requesting party.
在实施中,目标存储节点读取到目标图片之后,可以向请求方发送目标图片。In implementation, after the target storage node reads the target picture, it can send the target picture to the requesting party.
另外,在图6所示的流程中,可以是通过目标存储节点上的一个应用程序执行,该应用程序中,有两个进程,一个进程为A进程,另一个进程可以为B进程,A进程与B进程通过unix域套接字链路连接,在图6的流程中,A进程可以接收请求方的读取请求,通过unix域套接字链路告知给B进程,B进程可以执行上述步骤602至603,然后将读取到的目标图片,通过unix域套接字链路发送给A进程,A进程可以反馈给请求方。此处的A进程与B进程建立的unix域套接字链路可以一直连接,并且通过心跳消息,检测该unix域套接字链路是否处于连接状态。若未处于连接状态,则建立unix域套接字链路。若处于连接状态,则继续通过心跳消息,检测该unix域套接字链路是否处于连接状态In addition, in the process shown in Figure 6, it can be executed by an application on the target storage node. In the application, there are two processes, one process is A process, the other process can be B process, A process It is connected to process B through a unix domain socket link. In the process shown in Figure 6, process A can receive the requester's read request and notify process B through the unix domain socket link. Process B can perform the above steps 602 to 603, and then send the read target picture to the A process through the unix domain socket link, and the A process can feed back to the requester. Here, the unix domain socket link established by the A process and the B process can be connected all the time, and through the heartbeat message, it is detected whether the unix domain socket link is in a connected state. If it is not in a connected state, a unix domain socket link is established. If it is in the connected state, continue to use the heartbeat message to detect whether the unix domain socket link is in the connected state
本公开实施例中,云存储系统中的存储节点配置有磁盘、内存和SSD。在云存储系统中写入目标图片时,目标存储节点可以接收目标图片的写入请求,判断目标存储节点所属的图片资源池是否支持加速写入,如果存储节点所属的图片资源池支持加速写入,则判断目标图片的数据量与目标数值的大小,如果目标图片的数据量小于目标数值,则在存储节点的配置信息中获取配置的缓存类型。如果缓存类型为内存加速,则目标存储节点将目标图片写入目标存储节点的内存中,如果缓存类型为SSD加速,则目标存储节点将目标图片写入目标存储节点配置的SSD中。这样,在图片的数据量比较小时,可以将图片存储至内存或SSD中,由于内存或SSD写入速度较快,所以在图片的数据量比较小时,可以相对提升图片的写入速度,进而可以提高图片的写入效率。而且图片存储至内存或者SSD,可以从内存或SSD中读取图片,由于内存或SSD的读取速度较快,也可以提升图片的读取效率。In the embodiment of the present disclosure, the storage node in the cloud storage system is configured with a disk, a memory, and an SSD. When writing a target picture in the cloud storage system, the target storage node can receive the write request of the target picture and determine whether the picture resource pool to which the target storage node belongs supports accelerated writing, and if the picture resource pool to which the storage node belongs supports accelerated writing , The data amount of the target picture and the size of the target value are judged. If the data amount of the target picture is less than the target value, the configured cache type is obtained from the configuration information of the storage node. If the cache type is memory acceleration, the target storage node writes the target image into the memory of the target storage node. If the cache type is SSD acceleration, the target storage node writes the target image into the SSD configured by the target storage node. In this way, when the amount of data of the picture is relatively small, the picture can be stored in the memory or SSD. Since the writing speed of the memory or SSD is faster, when the amount of data of the picture is relatively small, the writing speed of the picture can be relatively improved. Improve picture writing efficiency. And the picture is stored in the memory or SSD, and the picture can be read from the memory or SSD. Since the reading speed of the memory or SSD is faster, the reading efficiency of the picture can also be improved.
另外,在本申请实施例中还提供了读取图片的过程:目标存储节点接收请求方发送的目标图片的读取请求,判断目标存储节点所属的图片资源池是否支持加速写入;如果目标存储节点所属的图片资源池支持加速写入,且缓存类型为内存加速,则根据读取请求,在目标存储节点配置的内存中读取目标图片,其中,缓存类型为目标图片在目标存储节点写入时的缓存类型;如果目标存储节点所属的图片资源池支持加速写入,且缓存类型为SSD加速,则根据读取请求,在目标存储节点配置的SSD中读取目标图片;向请求方发送目标图片。In addition, the embodiment of this application also provides a process of reading pictures: the target storage node receives the read request of the target picture sent by the requester, and judges whether the picture resource pool to which the target storage node belongs supports accelerated writing; if the target storage node The image resource pool to which the node belongs supports accelerated writing, and the cache type is memory acceleration. According to the read request, the target image is read in the memory configured by the target storage node, where the cache type is that the target image is written in the target storage node If the image resource pool to which the target storage node belongs supports accelerated writing, and the cache type is SSD acceleration, then according to the read request, read the target image from the SSD configured on the target storage node; send the target to the requester image.
在实施例中,目标存储节点接收请求方发送的目标图片的读取请求后,判断目标存储节点所属的图片资源池是否支持加速写入,以及确定缓存类型在前 文中已经进行说明。在目标存储节点所属的图片资源池支持加速写入,且缓存类型为内存加速,则可以使用读取请求,在内存中读取目标图片,如果目标存储节点所属的图片资源池支持加速写入,且缓存类型为SSD加速,则根据读取请求,在SSD中读取目标图片。在读取到目标图片后,目标存储节点向请求方发送目标图片。这样,在图片的数据量比较小时,可以将图片存储至内存或SSD中,图片存储在内存或者SSD,所以可以从内存或SSD中读取图片,由于内存或SSD的读取速度较快,所以可以提升图片的读取效率。In the embodiment, after the target storage node receives the read request of the target picture sent by the requester, it determines whether the picture resource pool to which the target storage node belongs supports accelerated writing, and determines the cache type as described in the foregoing. If the image resource pool to which the target storage node belongs supports accelerated writing, and the cache type is memory acceleration, you can use a read request to read the target image in the memory. If the image resource pool to which the target storage node belongs supports accelerated writing, And the cache type is SSD acceleration, then the target image is read in the SSD according to the read request. After reading the target picture, the target storage node sends the target picture to the requester. In this way, when the amount of data of the picture is relatively small, the picture can be stored in the memory or SSD, and the picture can be stored in the memory or SSD, so the picture can be read from the memory or SSD. Since the reading speed of the memory or SSD is faster, Can improve the efficiency of image reading.
可选的,读取请求中携带有目标图片存储在磁盘的索引信息;根据索引信息,确定目标图片存储在目标存储节点的内存中的第一索引;如果在目标存储节点的内存对应的索引表中查找到第一索引,则根据第一索引,从目标存储节点的内存中读取目标图片。此过程在前文中已经有说明,此处不再赘述。Optionally, the read request carries index information of the target image stored on the disk; according to the index information, determine the first index of the target image stored in the memory of the target storage node; if it is in the index table corresponding to the memory of the target storage node If the first index is found in, the target image is read from the memory of the target storage node according to the first index. This process has been explained in the previous article, so I won't repeat it here.
可选的,读取请求中携带有目标图片存储在磁盘的索引信息;根据索引信息,确定目标图片存储在SSD中的第二索引;如果在目标存储节点配置的SSD对应的索引表中查找到第二索引,则根据第二索引,从目标存储节点配置的SSD中读取目标图片。此过程在前文中已经有说明,此处不再赘述。Optionally, the read request carries index information of the target image stored on the disk; according to the index information, determine the second index of the target image stored in the SSD; if it is found in the index table corresponding to the SSD configured on the target storage node The second index reads the target picture from the SSD configured on the target storage node according to the second index. This process has been explained in the previous article, so I won't repeat it here.
另外,如果目标存储节点未在目标存储节点配置的内存和SSD找到目标图片,则可以从目标存储节点配置的磁盘中读取目标图片,详细过程在前文中有说明,此处不再赘述。In addition, if the target storage node does not find the target image in the memory and SSD configured on the target storage node, the target image can be read from the disk configured by the target storage node. The detailed process is described in the foregoing and will not be repeated here.
基于相同的技术构思,本公开实施例还提供了一种写入图片的装置,所述装置应用于云存储系统的目标存储节点,目标存储节点配置有磁盘、内存和SSD。如图7所示,该装置包括:Based on the same technical concept, the embodiments of the present disclosure also provide a device for writing pictures, the device is applied to a target storage node of a cloud storage system, and the target storage node is configured with a disk, a memory, and an SSD. As shown in Figure 7, the device includes:
接收模块710,用于接收目标图片的写入请求;The receiving module 710 is configured to receive a write request of the target picture;
判断模块720,用于判断所述目标存储节点所属的图片资源池是否支持加速写入;The judging module 720 is configured to judge whether the image resource pool to which the target storage node belongs supports accelerated writing;
确定模块730,用于在所述目标存储节点所属的图片资源池支持加速写入时,如果所述目标图片的数据量小于目标数值,则在所述存储节点的配置信息中获取配置的缓存类型,其中,所述缓存类型为所述目标图片在所述目标存储节点写入时的缓存类型;The determining module 730 is configured to obtain the configured cache type from the configuration information of the storage node when the image resource pool to which the target storage node belongs supports accelerated writing, if the data amount of the target picture is less than the target value , Wherein the cache type is the cache type of the target picture when the target storage node writes;
写入模块740,用于如果所述缓存类型为内存加速,则将所述目标图片写入 所述目标存储节点的内存中;如果所述缓存类型为SSD加速,则将所述目标图片写入所述目标存储节点的SSD中。The writing module 740 is configured to write the target picture into the memory of the target storage node if the cache type is memory acceleration; if the cache type is SSD acceleration, write the target picture The SSD of the target storage node.
可选的,所述写入模块740,还用于:Optionally, the writing module 740 is also used for:
将所述目标图片写入所述目标存储节点的磁盘。Writing the target picture to the disk of the target storage node.
可选的,所述写入模块740,用于:Optionally, the writing module 740 is configured to:
如果所述目标存储节点当前的内存余量大于或等于所述目标图片的数据量,则将所述目标图片写入所述目标存储节点的内存中;If the current memory margin of the target storage node is greater than or equal to the data amount of the target picture, writing the target picture into the memory of the target storage node;
如果所述目标存储节点当前的内存余量小于所述目标图片的数据量,则在所述内存中删除写入时间点距离当前时间点最长的图片;If the current memory margin of the target storage node is less than the data amount of the target picture, deleting the picture whose writing time point is the longest from the current time point in the memory;
如果删除图片后的内存余量大于或等于所述目标图片的数据量,则将所述图片写入所述内存中,如果删除图片后的内存余量小于所述目标图片的数据量,则执行所述在所述内存中删除写入时间点距离当前时间点最长的图片的处理。If the memory margin after deleting the picture is greater than or equal to the data amount of the target picture, then the picture is written into the memory, and if the memory margin after deleting the picture is less than the data amount of the target picture, execute The process of deleting the picture whose writing time point is the longest from the current time point in the memory.
可选的,所述接收模块710,还用于接收请求方发送的目标图片的读取请求,其中,所述读取请求中携带有所述目标图片存储在磁盘的索引信息;Optionally, the receiving module 710 is further configured to receive a read request of a target picture sent by a requesting party, wherein the read request carries index information of the target picture stored on a disk;
所述判断模块720,还用于判断所述目标存储节点所属的图片资源池是否支持加速写入;The judgment module 720 is further configured to judge whether the image resource pool to which the target storage node belongs supports accelerated writing;
如图8所示,所述装置还包括:As shown in Figure 8, the device further includes:
读取模块750,用于如果所述目标存储节点所属的图片资源池支持加速写入,则根据所述目标图片对应的缓存类型和所述读取请求,读取所述目标图片;A reading module 750, configured to read the target picture according to the cache type corresponding to the target picture and the read request if the picture resource pool to which the target storage node belongs supports accelerated writing;
发送模块760,用于向所述请求方发送所述目标图片。The sending module 760 is configured to send the target picture to the requester.
可选的,所述读取模块750,用于:Optionally, the reading module 750 is configured to:
如果所述目标图片对应的缓存类型为内存加速,则根据所述索引信息,确定所述目标图片存储在所述目标存储节点的内存中的第一索引;If the cache type corresponding to the target picture is memory acceleration, determining the first index of the target picture stored in the memory of the target storage node according to the index information;
如果在所述目标存储节点的内存对应的索引表中查找到所述第一索引,则根据所述第一索引,从所述目标存储节点的内存中读取所述目标图片;如果在所述目标存储节点的内存对应的索引表中未查找到所述第一索引,则从磁盘中读取所述目标图片;If the first index is found in the index table corresponding to the memory of the target storage node, read the target picture from the memory of the target storage node according to the first index; if in the If the first index is not found in the index table corresponding to the memory of the target storage node, the target picture is read from the disk;
如果所述目标图片对应的缓存类型为SSD加速,则根据所述索引信息,确定所述目标图片存储在SSD中的第二索引,如果在所述目标存储节点配置的SSD对应的索引表中查找到所述第二索引,则根据所述第二索引,从所述目标 存储节点配置的SSD中读取所述目标图片;If the cache type corresponding to the target picture is SSD acceleration, the second index of the target picture stored in the SSD is determined according to the index information, and if the index table corresponding to the SSD configured on the target storage node is searched To the second index, read the target picture from the SSD configured on the target storage node according to the second index;
如果在所述目标存储节点配置的SSD对应的索引表中未查找到所述第二索引,则根据所述读取请求,从磁盘中读取所述目标图片。If the second index is not found in the index table corresponding to the SSD configured on the target storage node, the target picture is read from the disk according to the read request.
本公开实施例中,云存储系统中的存储节点配置有磁盘、内存和SSD。在云存储系统中写入目标图片时,目标存储节点可以接收目标图片的写入请求,判断目标存储节点所属的图片资源池是否支持加速写入,如果存储节点所属的图片资源池支持加速写入,则判断目标图片的数据量与目标数值的大小,如果目标图片的数据量小于目标数值,则在存储节点的配置信息中获取配置的缓存类型。如果缓存类型为内存加速,则目标存储节点将目标图片写入目标存储节点的内存中,如果缓存类型为SSD加速,则目标存储节点将目标图片写入目标存储节点配置的SSD中。这样,在图片的数据量比较小时,可以将图片存储至内存或SSD中,由于内存或SSD写入速度较快,所以在图片的数据量比较小时,可以相对提升图片的写入速度,进而可以提高写入效率。而且图片存储至内存或者SSD,可以从内存或SSD中读取图片,由于内存或SSD的读取速度较快,也可以提升图片的读取效率。In the embodiment of the present disclosure, the storage node in the cloud storage system is configured with a disk, a memory, and an SSD. When writing a target picture in the cloud storage system, the target storage node can receive the write request of the target picture and determine whether the picture resource pool to which the target storage node belongs supports accelerated writing, and if the picture resource pool to which the storage node belongs supports accelerated writing , The data amount of the target picture and the size of the target value are judged. If the data amount of the target picture is less than the target value, the configured cache type is obtained from the configuration information of the storage node. If the cache type is memory acceleration, the target storage node writes the target image into the memory of the target storage node. If the cache type is SSD acceleration, the target storage node writes the target image into the SSD configured by the target storage node. In this way, when the amount of data of the picture is relatively small, the picture can be stored in the memory or SSD. Since the writing speed of the memory or SSD is faster, when the amount of data of the picture is relatively small, the writing speed of the picture can be relatively improved. Improve writing efficiency. And the picture is stored in the memory or SSD, and the picture can be read from the memory or SSD. Since the reading speed of the memory or SSD is faster, the reading efficiency of the picture can also be improved.
需要说明的是:上述实施例提供的写入图片的装置在写入图片时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的写入图片的装置与写入图片的方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that when the device for writing pictures provided in the above embodiments writes pictures, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned functions can be allocated to different functional modules according to needs. Complete, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above. In addition, the device for writing a picture provided in the above-mentioned embodiment belongs to the same concept as the embodiment of the method for writing a picture, and the specific implementation process is detailed in the method embodiment, and will not be repeated here.
图9是本公开实施例提供的一种存储节点的结构示意图,该存储节点900可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上处理器(central processing units,CPU)901和一个或一个以上的存储器902,其中,所述存储器902中存储有至少一条指令,所述至少一条指令由所述处理器901加载并执行以实现上述确定写入图片的方法步骤。FIG. 9 is a schematic structural diagram of a storage node provided by an embodiment of the present disclosure. The storage node 900 may have relatively large differences due to different configurations or performance, and may include one or more processors (central processing units, CPU) 901 And one or more memories 902, wherein at least one instruction is stored in the memory 902, and the at least one instruction is loaded and executed by the processor 901 to implement the above-mentioned method steps of determining to write a picture.
本公开实施例还提供了一种写入图片的存储节点,所述存储节点包括处理器和存储器,所述存储器中存储有至少一条指令,所述指令由所述处理器加载 并执行以实现如上述所述的写入图片的方法。The embodiments of the present disclosure also provide a storage node for writing pictures, the storage node includes a processor and a memory, and at least one instruction is stored in the memory, and the instruction is loaded and executed by the processor to realize The above-mentioned method of writing pictures.
本公开实施例还提供了一种计算机可读存储介质,所述存储介质中存储有至少一条指令,所述指令由处理器加载并执行以实现如上述所述的写入图片的方法。The embodiment of the present disclosure also provides a computer-readable storage medium, in which at least one instruction is stored, and the instruction is loaded and executed by a processor to implement the method for writing a picture as described above.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。A person of ordinary skill in the art can understand that all or part of the steps in the above embodiments can be implemented by hardware, or by a program to instruct relevant hardware. The program can be stored in a computer-readable storage medium. The storage medium mentioned can be a read-only memory, a magnetic disk or an optical disk, etc.
以上所述仅为本公开的较佳实施例,并不用以限制本公开,凡在本公开的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本公开的保护范围之内。The above descriptions are only preferred embodiments of the present disclosure and are not intended to limit the present disclosure. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present disclosure shall be included in the protection of the present disclosure. Within range.

Claims (15)

  1. 一种写入图片的方法,其特征在于,所述方法应用于云存储系统中的目标存储节点,所述目标存储节点配置有磁盘、内存和固态硬盘SSD;所述方法包括:A method for writing pictures, characterized in that the method is applied to a target storage node in a cloud storage system, and the target storage node is configured with a disk, a memory, and a solid-state hard drive (SSD); the method includes:
    所述目标存储节点接收目标图片的写入请求,判断所述目标存储节点所属的图片资源池是否支持加速写入;The target storage node receives the write request of the target picture, and determines whether the picture resource pool to which the target storage node belongs supports accelerated writing;
    在所述目标存储节点所属的图片资源池支持加速写入时,如果所述目标图片的数据量小于目标数值,则在所述存储节点的配置信息中获取配置的缓存类型,其中,所述缓存类型为所述目标图片在所述目标存储节点写入时的缓存类型;When the picture resource pool to which the target storage node belongs supports accelerated writing, if the data amount of the target picture is less than the target value, the configured cache type is obtained from the configuration information of the storage node, wherein the cache Type is the cache type of the target picture when the target storage node writes;
    如果所述缓存类型为内存加速,则所述目标存储节点将所述目标图片写入所述目标存储节点的内存中;If the cache type is memory acceleration, the target storage node writes the target picture into the memory of the target storage node;
    如果所述缓存类型为SSD加速,则所述目标存储节点将所述目标图片写入所述目标存储节点的SSD中。If the cache type is SSD acceleration, the target storage node writes the target picture into the SSD of the target storage node.
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    将所述目标图片写入所述目标存储节点的磁盘。Writing the target picture to the disk of the target storage node.
  3. 根据权利要求1所述的方法,其特征在于,所述将所述目标图片写入所述目标存储节点的内存中,包括:The method according to claim 1, wherein the writing the target picture into the memory of the target storage node comprises:
    如果所述目标存储节点当前的内存余量大于或等于所述目标图片的数据量,则将所述目标图片写入所述目标存储节点的内存中;If the current memory margin of the target storage node is greater than or equal to the data amount of the target picture, writing the target picture into the memory of the target storage node;
    如果所述目标存储节点当前的内存余量小于所述目标图片的数据量,则在所述内存中删除写入时间点距离当前时间点最长的图片;If the current memory margin of the target storage node is less than the data amount of the target picture, deleting the picture whose writing time point is the longest from the current time point in the memory;
    如果删除图片后的内存余量大于或等于所述目标图片的数据量,则将所述图片写入所述内存中,如果删除图片后的内存余量小于所述目标图片的数据量,则执行所述在所述内存中删除写入时间点距离当前时间点最长的图片的处理。If the memory margin after deleting the picture is greater than or equal to the data amount of the target picture, then the picture is written into the memory, and if the memory margin after deleting the picture is less than the data amount of the target picture, execute The process of deleting the picture whose writing time point is the longest from the current time point in the memory.
  4. 根据权利要求1至3任一所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 3, wherein the method further comprises:
    所述目标存储节点接收请求方发送的所述目标图片的读取请求,判断所述目标存储节点所属的图片资源池是否支持加速写入,其中,所述读取请求中携带有所述目标图片存储在磁盘的索引信息;The target storage node receives the read request of the target picture sent by the requester, and determines whether the picture resource pool to which the target storage node belongs supports accelerated writing, wherein the read request carries the target picture Index information stored on disk;
    如果所述目标存储节点所属的图片资源池支持加速写入,则根据所述目标图片对应的缓存类型和所述读取请求,读取所述目标图片;If the picture resource pool to which the target storage node belongs supports accelerated writing, read the target picture according to the cache type corresponding to the target picture and the read request;
    向所述请求方发送所述目标图片。Sending the target picture to the requesting party.
  5. 根据权利要求4所述的方法,其特征在于,所述根据所述目标图片对应的缓存类型和所述读取请求,读取所述目标图片,包括:The method according to claim 4, wherein the reading the target picture according to the cache type corresponding to the target picture and the read request comprises:
    如果所述目标图片对应的缓存类型为内存加速,则根据所述索引信息,确定所述目标图片存储在所述目标存储节点的内存中的第一索引;如果在所述目标存储节点的内存对应的索引表中查找到所述第一索引,则根据所述第一索引,从所述目标存储节点的内存中读取所述目标图片;如果在所述目标存储节点的内存对应的索引表中未查找到所述第一索引,则从磁盘中读取所述目标图片;If the cache type corresponding to the target picture is memory acceleration, then according to the index information, determine the first index of the target picture stored in the memory of the target storage node; if it corresponds to the memory of the target storage node If the first index is found in the index table of the target storage node, the target picture is read from the memory of the target storage node according to the first index; if it is in the index table corresponding to the memory of the target storage node If the first index is not found, read the target picture from the disk;
    如果所述目标图片对应的缓存类型为SSD加速,则根据所述索引信息,确定所述目标图片存储在SSD中的第二索引,如果在所述目标存储节点配置的SSD对应的索引表中查找到所述第二索引,则根据所述第二索引,从所述目标存储节点配置的SSD中读取所述目标图片;如果在所述目标存储节点配置的SSD对应的索引表中未查找到所述第二索引,则根据所述读取请求,从磁盘中读取所述目标图片。If the cache type corresponding to the target picture is SSD acceleration, the second index of the target picture stored in the SSD is determined according to the index information, and if the index table corresponding to the SSD configured on the target storage node is searched To the second index, read the target picture from the SSD configured on the target storage node according to the second index; if it is not found in the index table corresponding to the SSD configured on the target storage node The second index reads the target picture from the disk according to the read request.
  6. 一种写入图片的装置,其特征在于,所述装置应用于云存储系统中的目标存储节点,所述目标存储节点配置有磁盘、内存和固态硬盘SSD;所述装置包括:A device for writing pictures, characterized in that the device is applied to a target storage node in a cloud storage system, and the target storage node is configured with a magnetic disk, a memory, and a solid-state hard drive (SSD); the device includes:
    接收模块,用于接收目标图片的写入请求;The receiving module is used to receive the write request of the target picture;
    判断模块,用于判断所述目标存储节点所属的图片资源池是否支持加速写入;A judging module for judging whether the image resource pool to which the target storage node belongs supports accelerated writing;
    确定模块,用于在所述目标存储节点所属的图片资源池支持加速写入时,如果所述目标图片的数据量小于目标数值,则在所述存储节点的配置信息中获取配置的缓存类型,其中,所述缓存类型为所述目标图片在所述目标存储节点写入时的缓存类型;The determining module is configured to obtain the configured cache type from the configuration information of the storage node when the image resource pool to which the target storage node belongs supports accelerated writing, if the data amount of the target picture is less than the target value, Wherein, the cache type is the cache type of the target picture when the target storage node writes;
    写入模块,用于如果所述缓存类型为内存加速,则将所述目标图片写入所述目标存储节点的内存中;如果所述缓存类型为SSD加速,则将所述目标图片写入所述目标存储节点的SSD中。A writing module, configured to write the target picture into the memory of the target storage node if the cache type is memory acceleration; if the cache type is SSD acceleration, write the target picture into the memory In the SSD of the target storage node.
  7. 根据权利要求6所述的装置,其特征在于,所述写入模块,还用于:The device according to claim 6, wherein the writing module is further used for:
    将所述目标图片写入所述目标存储节点的磁盘。Writing the target picture to the disk of the target storage node.
  8. 根据权利要求7所述的装置,其特征在于,所述写入模块,用于:The device according to claim 7, wherein the writing module is configured to:
    如果所述目标存储节点当前的内存余量大于或等于所述目标图片的数据量,则将所述目标图片写入所述目标存储节点的内存中;If the current memory margin of the target storage node is greater than or equal to the data amount of the target picture, writing the target picture into the memory of the target storage node;
    如果所述目标存储节点当前的内存余量小于所述目标图片的数据量,则在所述内存中删除写入时间点距离当前时间点最长的图片;If the current memory margin of the target storage node is less than the data amount of the target picture, deleting the picture whose writing time point is the longest from the current time point in the memory;
    如果删除图片后的内存余量大于或等于所述目标图片的数据量,则将所述图片写入所述内存中,如果删除图片后的内存余量小于所述目标图片的数据量,则执行所述在所述内存中删除写入时间点距离当前时间点最长的图片的处理。If the memory margin after deleting the picture is greater than or equal to the data amount of the target picture, then the picture is written into the memory, and if the memory margin after deleting the picture is less than the data amount of the target picture, execute The process of deleting the picture whose writing time point is the longest from the current time point in the memory.
  9. 根据权利要求6至8任一所述的装置,其特征在于,所述接收模块,还用于接收请求方发送的目标图片的读取请求,其中,所述读取请求中携带有所述目标图片存储在磁盘的索引信息;The device according to any one of claims 6 to 8, wherein the receiving module is further configured to receive a read request for a target picture sent by a requesting party, wherein the read request carries the target Index information of pictures stored on disk;
    所述判断模块,还用于判断所述目标存储节点所属的图片资源池是否支持加速写入;The judgment module is also used to judge whether the image resource pool to which the target storage node belongs supports accelerated writing;
    所述装置还包括:The device also includes:
    读取模块,用于如果所述目标存储节点所属的图片资源池支持加速写入,则根据所述目标图片对应的缓存类型和所述读取请求,读取所述目标图片;A reading module, configured to read the target picture according to the cache type corresponding to the target picture and the read request if the picture resource pool to which the target storage node belongs supports accelerated writing;
    发送模块,用于向所述请求方发送所述目标图片。The sending module is used to send the target picture to the requester.
  10. 根据权利要求9所述的装置,其特征在于,所述读取模块,用于:The device according to claim 9, wherein the reading module is configured to:
    如果所述目标图片对应的缓存类型为内存加速,则根据所述索引信息,确定所述目标图片存储在所述目标存储节点的内存中的第一索引;如果在所述目标存储节点的内存对应的索引表中查找到所述第一索引,则根据所述第一索引,从所述目标存储节点的内存中读取所述目标图片;如果在所述目标存储节点的内存对应的索引表中未查找到所述第一索引,则从磁盘中读取所述目标图片;If the cache type corresponding to the target picture is memory acceleration, then according to the index information, determine the first index of the target picture stored in the memory of the target storage node; if it corresponds to the memory of the target storage node If the first index is found in the index table of the target storage node, the target picture is read from the memory of the target storage node according to the first index; if it is in the index table corresponding to the memory of the target storage node If the first index is not found, read the target picture from the disk;
    如果所述目标图片对应的缓存类型为SSD加速,则根据所述索引信息,确定所述目标图片存储在SSD中的第二索引,如果在所述目标存储节点配置的SSD对应的索引表中查找到所述第二索引,则根据所述第二索引,从所述目标存储节点配置的SSD中读取所述目标图片;如果在所述目标存储节点配置的SSD对应的索引表中未查找到所述第二索引,则根据所述读取请求,从磁盘中 读取所述目标图片。If the cache type corresponding to the target picture is SSD acceleration, the second index of the target picture stored in the SSD is determined according to the index information, and if the index table corresponding to the SSD configured on the target storage node is searched To the second index, read the target picture from the SSD configured on the target storage node according to the second index; if it is not found in the index table corresponding to the SSD configured on the target storage node The second index reads the target picture from the disk according to the read request.
  11. 一种写入图片的存储节点,其特征在于,包括处理器和存储器;所述存储器,用于存放至少一条指令;所述处理器,用于执行所述存储器上所存放的至少一条指令,实现权利要求1-5任一项所述的方法步骤。A storage node for writing pictures, comprising a processor and a memory; the memory is used to store at least one instruction; the processor is used to execute at least one instruction stored in the memory to implement The method step of any one of claims 1-5.
  12. 一种计算机可读存储介质,其特征在于,所述存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1-5任一项所述的方法步骤。A computer-readable storage medium, characterized in that a computer program is stored in the storage medium, and when the computer program is executed by a processor, the method steps according to any one of claims 1 to 5 are realized.
  13. 一种读取图片的方法,其特征在于,所述方法应用于云存储系统中的目标存储节点,所述目标存储节点配置有磁盘、内存和固态硬盘SSD;所述方法包括:A method for reading pictures, characterized in that the method is applied to a target storage node in a cloud storage system, and the target storage node is configured with a disk, a memory, and a solid-state hard drive (SSD); the method includes:
    所述目标存储节点接收请求方发送的目标图片的读取请求,判断所述目标存储节点所属的图片资源池是否支持加速写入;The target storage node receives the read request of the target picture sent by the requester, and determines whether the picture resource pool to which the target storage node belongs supports accelerated writing;
    如果所述目标存储节点所属的图片资源池支持加速写入,且缓存类型为内存加速,则根据所述读取请求,在所述目标存储节点配置的内存中读取所述目标图片,其中,所述缓存类型为所述目标图片在所述目标存储节点写入时的缓存类型;If the image resource pool to which the target storage node belongs supports accelerated writing, and the cache type is memory acceleration, the target image is read in the memory configured by the target storage node according to the read request, where: The cache type is the cache type of the target picture when the target storage node writes;
    如果所述目标存储节点所属的图片资源池支持加速写入,且所述缓存类型为SSD加速,则根据所述读取请求,在所述目标存储节点配置的SSD中读取所述目标图片;If the picture resource pool to which the target storage node belongs supports accelerated writing, and the cache type is SSD accelerated, reading the target picture from the SSD configured on the target storage node according to the read request;
    向所述请求方发送所述目标图片。Sending the target picture to the requesting party.
  14. 根据权利要求13所述的方法,其特征在于,所述读取请求中携带有所述目标图片存储在磁盘的索引信息;The method according to claim 13, wherein the read request carries index information of the target picture stored on a disk;
    所述根据所述读取请求,在所述目标存储节点配置的内存中读取所述目标图片,包括:The reading the target picture in the memory configured by the target storage node according to the reading request includes:
    根据所述索引信息,确定所述目标图片存储在所述目标存储节点的内存中的第一索引;Determine the first index of the target picture stored in the memory of the target storage node according to the index information;
    如果在所述目标存储节点的内存对应的索引表中查找到所述第一索引,则根据所述第一索引,从所述目标存储节点的内存中读取所述目标图片。If the first index is found in the index table corresponding to the memory of the target storage node, the target picture is read from the memory of the target storage node according to the first index.
  15. 根据权利要求13或14所述的方法,其特征在于,所述读取请求中携带有所述目标图片存储在磁盘的索引信息;The method according to claim 13 or 14, wherein the read request carries index information of the target picture stored on a disk;
    所述根据所述读取请求,在所述目标存储节点配置的SSD中读取所述目标图片,包括:The reading the target picture in the SSD configured on the target storage node according to the reading request includes:
    根据所述索引信息,确定所述目标图片存储在SSD中的第二索引;Determine the second index of the target picture stored in the SSD according to the index information;
    如果在所述目标存储节点配置的SSD对应的索引表中查找到所述第二索引,则根据所述第二索引,从所述目标存储节点配置的SSD中读取所述目标图片。If the second index is found in the index table corresponding to the SSD configured on the target storage node, the target picture is read from the SSD configured on the target storage node according to the second index.
PCT/CN2020/110330 2019-08-23 2020-08-20 Picture write-in method and apparatus WO2021036909A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910786664.8 2019-08-23
CN201910786664.8A CN111399753B (en) 2019-08-23 2019-08-23 Method and device for writing pictures

Publications (1)

Publication Number Publication Date
WO2021036909A1 true WO2021036909A1 (en) 2021-03-04

Family

ID=71430246

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/110330 WO2021036909A1 (en) 2019-08-23 2020-08-20 Picture write-in method and apparatus

Country Status (2)

Country Link
CN (1) CN111399753B (en)
WO (1) WO2021036909A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111399753B (en) * 2019-08-23 2022-08-05 杭州海康威视系统技术有限公司 Method and device for writing pictures

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104111898A (en) * 2014-05-26 2014-10-22 中国能源建设集团广东省电力设计研究院 Hybrid storage system based on multidimensional data similarity and data management method
US20160004637A1 (en) * 2014-01-08 2016-01-07 Netapp, Inc. Nvram caching and logging in a storage system
CN107301090A (en) * 2016-04-14 2017-10-27 华为技术有限公司 It is using the method and device for setting data handling path in storage server
CN107463627A (en) * 2017-07-11 2017-12-12 深圳市云领天下科技有限公司 A kind of picture loading method and terminal
CN107861891A (en) * 2017-11-14 2018-03-30 郑州天迈科技股份有限公司 Audio/video data access method for public transport vehicle-mounted hard disk
CN108008912A (en) * 2016-11-02 2018-05-08 华为技术有限公司 A kind of memory buffers method and intelligent terminal based on DRAM
CN111399753A (en) * 2019-08-23 2020-07-10 杭州海康威视系统技术有限公司 Method and device for writing pictures

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9075754B1 (en) * 2011-12-31 2015-07-07 Emc Corporation Managing cache backup and restore
TW201508484A (en) * 2013-08-22 2015-03-01 Acer Inc Data writing method, hard disc module, and data writing system
US10013344B2 (en) * 2014-01-14 2018-07-03 Avago Technologies General Ip (Singapore) Pte. Ltd. Enhanced SSD caching
CN108268219B (en) * 2018-02-01 2021-02-09 杭州宏杉科技股份有限公司 Method and device for processing IO (input/output) request
CN108845768A (en) * 2018-06-19 2018-11-20 郑州云海信息技术有限公司 A kind of date storage method, device, equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160004637A1 (en) * 2014-01-08 2016-01-07 Netapp, Inc. Nvram caching and logging in a storage system
CN104111898A (en) * 2014-05-26 2014-10-22 中国能源建设集团广东省电力设计研究院 Hybrid storage system based on multidimensional data similarity and data management method
CN107301090A (en) * 2016-04-14 2017-10-27 华为技术有限公司 It is using the method and device for setting data handling path in storage server
CN108008912A (en) * 2016-11-02 2018-05-08 华为技术有限公司 A kind of memory buffers method and intelligent terminal based on DRAM
CN107463627A (en) * 2017-07-11 2017-12-12 深圳市云领天下科技有限公司 A kind of picture loading method and terminal
CN107861891A (en) * 2017-11-14 2018-03-30 郑州天迈科技股份有限公司 Audio/video data access method for public transport vehicle-mounted hard disk
CN111399753A (en) * 2019-08-23 2020-07-10 杭州海康威视系统技术有限公司 Method and device for writing pictures

Also Published As

Publication number Publication date
CN111399753A (en) 2020-07-10
CN111399753B (en) 2022-08-05

Similar Documents

Publication Publication Date Title
US7480654B2 (en) Achieving cache consistency while allowing concurrent changes to metadata
CN105027070B (en) Roll up the security of operation
CN110515539B (en) Cloud disk mounting method, device, equipment and storage medium based on cloud storage
EP2863310B1 (en) Data processing method and apparatus, and shared storage device
JP2017199439A (en) System and method for implementing data storage service
CN111338766A (en) Transaction processing method and device, computer equipment and storage medium
WO2022063322A1 (en) Hard drive migration method, distributed storage cluster system and storage medium
CN110998557A (en) High availability database through distributed storage
US10318475B2 (en) System and method for persistence of application data using replication over remote direct memory access
WO2021147935A1 (en) Log playback method and apparatus
WO2020098654A1 (en) Data storage method and device based on cloud storage, and storage medium
CN108540510B (en) Cloud host creation method and device and cloud service system
CN109714229B (en) Performance bottleneck positioning method of distributed storage system
WO2021143351A1 (en) Distributed retrieval method, apparatus and system, computer device, and storage medium
US20240061712A1 (en) Method, apparatus, and system for creating training task on ai training platform, and medium
WO2022111188A1 (en) Transaction processing method, system, apparatus, device, storage medium, and program product
WO2022048358A1 (en) Data processing method and device, and storage medium
CN110457263A (en) A kind of date storage method and device
CN113010549A (en) Data processing method based on remote multi-active system, related equipment and storage medium
CN107181773A (en) Data storage and data managing method, the equipment of distributed memory system
WO2021036909A1 (en) Picture write-in method and apparatus
CN113741822B (en) Data storage method, data reading method and related device
EP3633519A1 (en) Method for storing objects, and object store gateway
WO2024082857A1 (en) Data migration method and system, and related apparatus
CN109032753A (en) A kind of isomery virtual hard disk trustship method, system, storage medium and Nova platform

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: 20859202

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: 20859202

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 25.05.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 20859202

Country of ref document: EP

Kind code of ref document: A1