A picture processing method and apparatus
By using a load balancer to select suitable nodes in the object storage system for image processing and utilizing node caches for local processing, the problems of high latency and network overhead in traditional storage systems are solved, thereby improving the system's response speed and reliability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DAWNING INT INFORMATION IND CO LTD
- Filing Date
- 2024-12-30
- Publication Date
- 2026-06-30
AI Technical Summary
Traditional object storage systems suffer from high latency, high network overhead, and slow resource scheduling when processing real-time images.
The load balancer determines the node score based on the node status, address, and pre-allocated processing resources, selects the target node for image processing, and completes the processing in the node's cache to avoid network transmission.
It reduces image data access latency, decreases data transmission overhead and leakage risk, and improves the response speed and reliability of the storage system.
Smart Images

Figure CN122309781A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of real-time image processing technology, and in particular to an image processing method and apparatus. Background Technology
[0002] With the rapid growth of digital image and video data, image processing technology plays an increasingly important role in various applications. Object storage systems, due to their high scalability and flexibility, are gradually becoming the preferred solution for processing and storing large-scale image data. Traditional object storage systems primarily optimize for high scalability and persistence in data storage and retrieval, rather than real-time processing performance. Therefore, when real-time processing of a large number of stored images is required, these systems often face high latency issues. Furthermore, current object storage systems typically rely on external computing resources for actual image processing, which introduces additional network transmission and processing overhead. Moreover, the selection of storage nodes often depends on their processing resource capabilities, which may lead to problems such as slow resource scheduling. Summary of the Invention
[0003] This application provides an image processing method and apparatus to solve the problems of high latency, large network overhead, and slow resource scheduling that occur during image processing.
[0004] In a first aspect, embodiments of this application provide an image processing method applied to a load balancer, the method comprising:
[0005] The system receives a first image processing request sent by the client. The first image processing request includes the source address of the first image, the processing resource size occupied by the first image, and the first processing parameters. The first processing parameters are determined based on the processing operations performed on the first image before storing the first image.
[0006] For any node in the storage system, a node score is determined based on the node status of the node, the node address of the node, the source address of the first image, and the pre-occupied processing resource size of the first image; the node score represents the probability that the node processes the first image.
[0007] A target node is determined based on the node scores of each node, and an image processing request is sent to the target node so that the target node processes and stores the first image in the cache according to the first processing parameters in the image processing request.
[0008] The storage address of the first image sent by the target node is received and returned to the client.
[0009] Based on the above scheme, when selecting nodes for image processing, a node score is determined according to the node's status, node address, image source address, and pre-allocated processing resource size. Nodes selected based on these scores satisfy resource processing requirements while improving transmission efficiency. Furthermore, high-speed caches are embedded in each node of the storage system. Processing images within these caches reduces image data access latency. Additionally, image processing is performed within the nodes, eliminating the need for network transmission, thus reducing data transmission overhead and the risk of data leakage during transmission.
[0010] In one possible implementation, determining the node score of each node in the storage system based on the node status and node address of each node in the storage system, the source address of the first image, and the pre-occupied processing resource size includes:
[0011] For each node, perform the following operations:
[0012] The memory score of the node is determined based on the node status and the pre-occupied processing resource size of the first image, and the address score of the node is determined based on the node address and the source address of the first image.
[0013] The weighted sum of the memory score and the address score is used as the node score of the node.
[0014] Based on the above scheme, when determining the node score, the probability that a node can process images is comprehensively evaluated based on the node's processing resources and node address, thereby making the selected nodes have stronger overall processing capabilities.
[0015] In one possible implementation, the node state of each node is determined in the following way:
[0016] For each node, perform the following operations:
[0017] The processing resource information of the node is obtained at set time intervals, and the processing resource information includes the node's processor utilization rate and / or memory utilization rate.
[0018] Based on the processing resource information of the node, the remaining processing resource information of the node is determined, and the remaining processing resource information is used as the node state of the node.
[0019] Based on the above scheme, by obtaining the processing resource information of the node, and then by obtaining the remaining processing resource information of the node, the status information of the node can be determined.
[0020] In one possible implementation, the method further includes:
[0021] If the processing resource information of the target node is not obtained within a set time period after the image processing request is sent to the target node, it is determined that the target node has failed.
[0022] Each node other than the target node is designated as a node to be transferred, and the current node status of each node to be transferred is determined based on the current processing resource information of each node to be transferred.
[0023] The node score of each node to be transferred is determined based on the current node status and node address of the node to be transferred, the source address of the first image, and the pre-occupied processing resource size.
[0024] A new target node is determined based on the node scores corresponding to each node to be transferred, and the image processing request is sent to the new target node so that the new target node processes the first image according to the image processing request.
[0025] Based on the above scheme, when the node processing images fails, image processing requests can be handled by other nodes, thereby improving the fault tolerance of the storage system and enhancing the system's reliability and stability.
[0026] In one possible implementation, the method further includes:
[0027] The target node is determined based on the second image processing request sent by the client; wherein, the second image processing request includes the client address, the storage address of the first image, and the second processing parameters, the second processing parameters being determined based on the processing operations performed on the first image before sending the first image, and the storage address of the first image being located at the target node;
[0028] An image read request is sent to the target node. The image read request includes a client address and a second processing parameter, so that the target node processes the first image in the cache according to the second processing parameter and then sends the processed first image based on the client address.
[0029] Based on the above scheme, when reading images from nodes, the images can be processed in the node's cache, and then the processed images can be sent to the client. No network transmission is required when processing images, reducing data overhead and the risk of leakage during transmission.
[0030] Secondly, embodiments of this application provide an image processing method applied to a target node in a storage system, the method comprising:
[0031] The system receives an image processing request sent by a load balancer. The image processing request includes a first processing parameter. After receiving the first image processing request from the client, the load balancer determines the node score of any node in the storage system based on the node status, node address, source address of the first image, and the pre-allocated processing resource size of the first image. Based on the node scores of each node, a target node is determined and the request is sent to that target node. The node score represents the probability that the node will process the first image. The first processing parameter is determined based on the processing operations performed on the first image before storing it.
[0032] The first image is processed and stored in a high-speed cache according to the first processing parameters;
[0033] The storage address of the first image is sent to the load balancer so that the load balancer returns the storage address to the client.
[0034] In one possible implementation, the method further includes:
[0035] The load balancer sends processing resource information, including the processor utilization and / or memory utilization of the node, at set time intervals, so that the load balancer can determine the remaining processing resources of the node based on the processing resource information of the node and use the remaining processing resources as the node status of the node.
[0036] In one possible implementation, the method further includes:
[0037] The system receives an image read request sent by the load balancer. The image read request includes a client address, the storage address of a first image, and a second processing parameter, which is determined based on the processing operation performed on the first image before sending the first image.
[0038] The first image is processed in the cache according to the second processing parameters;
[0039] The processed first image is sent based on the client address.
[0040] Thirdly, embodiments of this application provide an image processing apparatus, including:
[0041] The receiving unit is used to receive a first image processing request sent by the client. The first image processing request includes the source address of the first image, the pre-occupied processing resource size of the first image, and the first processing parameters. The first processing parameters are determined based on the processing operations performed on the first image before storing the first image.
[0042] The processing unit is configured to determine a node score for any given node in the storage system based on the node status of the given node, the node address of the given node, the source address of the first image, and the pre-occupied processing resource size of the first image; the node score represents the probability that the node processes the first image.
[0043] The sending unit is configured to determine a target node based on the node scores of each of the nodes, and send an image processing request to the target node so that the target node processes and stores the first image in the cache according to the first processing parameters in the image processing request;
[0044] The receiving unit is further configured to receive the storage address of the first image sent by the target node and return the storage address to the client.
[0045] In one possible implementation, when determining the node score of each node in the storage system based on the node status and node address of each node in the storage system, the source address of the first image, and the pre-occupied processing resource size, the processing unit is specifically used for:
[0046] For each node, perform the following operations:
[0047] The memory score of the node is determined based on the node status and the pre-occupied processing resource size of the first image, and the address score of the node is determined based on the node address and the source address of the first image.
[0048] The weighted sum of the memory score and the address score is used as the node score of the node.
[0049] In one possible implementation, the processing unit is further configured to:
[0050] The node status of each node is determined in the following ways:
[0051] For each node, perform the following operations:
[0052] The processing resource information of the node is obtained at set time intervals, and the processing resource information includes the node's processor utilization rate and / or memory utilization rate.
[0053] Based on the processing resource information of the node, the remaining processing resource information of the node is determined, and the remaining processing resource information is used as the node state of the node.
[0054] In one possible implementation, the processing unit is further configured to:
[0055] If the processing resource information of the target node is not obtained within a set time period after the image processing request is sent to the target node, it is determined that the target node has failed.
[0056] Each node other than the target node is designated as a node to be transferred, and the current node status of each node to be transferred is determined based on the current processing resource information of each node to be transferred.
[0057] The node score of each node to be transferred is determined based on the current node status and node address of the node to be transferred, the source address of the first image, and the pre-occupied processing resource size.
[0058] A new target node is determined based on the node scores corresponding to each node to be transferred, and the image processing request is sent to the new target node so that the new target node processes the first image according to the image processing request.
[0059] In one possible implementation, the processing unit is further configured to: determine a target node based on a second image processing request sent by the client; wherein the second image processing request includes a client address, a storage address of a first image, and second processing parameters, the second processing parameters being determined based on processing operations performed on the first image before sending the first image, and the storage address of the first image being located at the target node;
[0060] The sending unit is further configured to send an image reading request to the target node. The image reading request includes a client address and a second processing parameter, so that the target node processes the first image in the cache according to the second processing parameter and then sends the processed first image based on the client address.
[0061] Fourthly, embodiments of this application provide an image processing apparatus, including:
[0062] A receiving unit is configured to receive an image processing request sent by a load balancer. The image processing request includes a first processing parameter. The image processing request is generated by the load balancer after receiving the first image processing request from the client. For any node in the storage system, the load balancer determines a node score based on the node status, node address, source address of the first image, and the pre-allocated processing resource size of the first image. Based on the node scores of each node, a target node is determined and the request is sent to the target node. The node score represents the probability that the node will process the first image. The first processing parameter is determined based on the processing operations performed on the first image before storing it.
[0063] The processing unit is configured to process and store the first image in a cache according to the first processing parameters.
[0064] The sending unit is used to send the storage address of the first image to the load balancer, so that the load balancer returns the storage address to the client.
[0065] In one possible implementation, the sending unit is further configured to:
[0066] The load balancer sends processing resource information, including the processor utilization and / or memory utilization of the node, at set time intervals, so that the load balancer can determine the remaining processing resources of the node based on the processing resource information of the node and use the remaining processing resources as the node status of the node.
[0067] In one possible implementation, the receiving unit is further configured to receive an image reading request sent by the load balancer, the image reading request including a client address, a storage address of a first image, and a second processing parameter, the second processing parameter being determined based on the processing operation performed on the first image before sending the first image;
[0068] The processing unit is further configured to process the first image in a cache according to the second processing parameters;
[0069] The sending unit is also used to send the processed first image based on the client address.
[0070] Fifthly, embodiments of this application provide an execution device, including:
[0071] Memory, used to store program instructions;
[0072] A processor is configured to acquire program instructions from memory and execute the methods described in the first aspect and in different implementations of the first aspect according to the acquired program instructions.
[0073] Sixthly, embodiments of this application provide an execution device, including:
[0074] Memory, used to store program instructions;
[0075] A processor is configured to acquire program instructions from memory and execute the methods described in the second aspect and in different implementations of the second aspect according to the acquired program instructions.
[0076] In a seventh aspect, embodiments of this application provide a computer-readable storage medium including computer program code, which, when executed by a computer, implements the methods described in the first aspect, the second aspect, different implementations of the first aspect, and different implementations of the second aspect.
[0077] Furthermore, the technical effects of any of the implementation methods in aspects two through seven can be found in aspect one and the technical effects of different implementation methods of aspect one, which will not be repeated here. Attached Figure Description
[0078] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0079] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of this application;
[0080] Figure 2 A flowchart illustrating an image processing method based on a load weighing instrument, provided in this application embodiment;
[0081] Figure 3 A flowchart illustrating an image processing method based on a target node, provided in an embodiment of this application;
[0082] Figure 4 A flowchart of an image processing method provided in this application embodiment;
[0083] Figure 5 A flowchart of another image processing method provided in this application embodiment;
[0084] Figure 6 This is a schematic diagram of an image processing device provided in an embodiment of this application;
[0085] Figure 7 A schematic diagram of another image processing apparatus provided in an embodiment of this application;
[0086] Figure 8 This is a schematic diagram of an execution device provided in an embodiment of this application. Detailed Implementation
[0087] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can be arranged and designed in various different configurations.
[0088] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0089] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0090] With the rapid growth of digital image and video data, image processing technology plays an increasingly important role in various applications. Object storage systems, due to their high scalability and flexibility, are gradually becoming the preferred solution for processing and storing large-scale image data. However, traditional object storage systems primarily focus on persistent data storage and high availability, but still have several limitations in high-performance real-time image processing, such as limited support for real-time image processing, especially given the increasing performance demands when processing high-resolution images and real-time streaming media.
[0091] First, traditional object storage systems primarily optimize for high scalability and persistence in data storage and retrieval, rather than real-time processing performance. Therefore, when real-time processing of large amounts of stored images is required, these systems often face high latency issues. This is because object storage systems are often designed with data integrity and redundancy in mind, rather than optimization for high-frequency, low-latency image processing tasks. Second, current object storage systems typically rely on external computing resources for actual image processing, introducing additional network transmission and processing overhead. For example, processing requests may require transferring data from the object storage system to the compute node, a process that results in additional latency, especially with large data volumes or poor network conditions. Furthermore, existing systems may have bottlenecks in concurrent data access and processing capabilities, making it difficult to effectively support high-concurrency real-time processing demands. Additionally, the selection of storage nodes often relies on their processing resource capabilities, which can lead to slow resource processing and scheduling.
[0092] To address the aforementioned issues, this application provides an image processing method and apparatus. A load balancer receives image processing requests from clients and selects a target node to process the request based on the processing resource size occupied by the image, its source address, and the node status and addresses of each node in the storage system. This comprehensive evaluation of image processing capabilities considers multiple factors to ensure the selected target node has strong overall processing capabilities, avoiding slow node resource processing and scheduling. Furthermore, after the load balancer sends the image processing request to the target node, the target node deploys an image processing service. This service can process the image in a cache before storing or sending it. In this application, image processing is performed locally on the node, avoiding frequent transmission of image data over the network, reducing data transmission time and latency, and improving the response speed of the storage system. Additionally, this application processes image data in a cache within the node, reducing frequent readings of image data from the storage area, minimizing data read overhead, and accelerating data access response speed.
[0093] The following is a brief introduction to the application scenarios to which the technical solutions of the embodiments of this application are applicable. It should be noted that the application scenarios described below are only for illustrating the embodiments of this application and are not intended to limit the scope. In specific implementation, the technical solutions provided by the embodiments of this application can be flexibly applied according to actual needs.
[0094] like Figure 1 As shown, Figure 1An exemplary application scenario of the image processing method provided in this application is illustrated, including a client, a load balancer 100, and a storage system 200. For example, assuming there are N clients, denoted as client 1, client 2...client N, the storage system 200 includes M nodes, denoted as node 1, node 2...node M. In some embodiments, nodes can be implemented using servers. Servers can be implemented using physical servers or virtual servers. Servers can be implemented using a single server or a server cluster consisting of multiple servers, each of which includes multiple storage disks. In some embodiments, each of nodes 1-M is equipped with an image processing service and a cache, so that each node has image processing capabilities.
[0095] In some embodiments, the load balancer 100 receives an image processing request sent by a client, and then determines the target node in the storage system 200 based on the source address of the image in the image processing request, the amount of processing resources occupied, and the node address and node status of each node. The load balancer 100 then sends the image processing request to the target node, and the target node processes and stores the image in the cache according to the processing parameters in the image processing request.
[0096] In some embodiments, the load balancer 100 performs the following operations for each node: determining the node's memory score based on the node's state and the pre-allocated processing resource size of the image, and determining the node's address score based on the node address and source address; then, the weighted sum of the memory score and address score is used as the node's node score. Next, a target node is determined based on the node scores of each node, and the image processing request is sent to the target node.
[0097] In some embodiments, the load balancer 100 performs the following operations for each node: It acquires the node's processing resource information at set time intervals. This processing resource information includes the node's processor utilization and / or memory utilization. Further, based on the node's processing resource information, it determines the node's remaining processing resources and uses this remaining processing resource information as the node's state.
[0098] In some embodiments, if the load balancer 100 fails to obtain the processing resource information of the target node within a set time period after sending the first image processing request to the target node, it is determined that the target node has failed. Next, all nodes other than the target node can be designated as nodes to be transferred, and the current node state of each node to be transferred is determined based on the obtained current processing resource information of each node to be transferred. Then, a node score is determined for each node to be transferred based on its current node state and node address, the source address of the first image, and the pre-allocated processing resource size. A new target node is determined based on the node score corresponding to each node to be transferred, and the image processing request is sent to the new target node so that the new target node processes the image according to the image processing request.
[0099] The image processing method in this application will be explained below, taking the image processing request sent by client 1 as an example.
[0100] In some embodiments, client 1 sends a first image processing request to load balancer 100, wherein the first image processing request includes the source address of the first image, the processing resource size occupied by the first image, and first processing parameters. The first processing parameters are determined based on the processing operations performed on the first image before storing the first image.
[0101] In some embodiments, after receiving the first image processing request, the load balancer 100 calculates the node score for each node based on its node status, node address, source address of the first image, and the amount of processing resources it occupies. This yields the node scores for nodes 1 through M. Further, the target node is determined based on the node scores of the M nodes. Assuming the target node is node 2, the load balancer 100 sends an image processing request to node 2, enabling node 2 to process the first image according to the request.
[0102] In some embodiments, after receiving an image processing request, node 2 can process the first image in the cache according to the first processing parameters in the image processing request and store it in the storage area. Specifically, the image processing request includes the source address of the first image. Node 2 can obtain the first image data according to the source address, and then perform the processing operation corresponding to the first processing parameters on the first image in the cache, and store the processed first image in the storage area.
[0103] Furthermore, node 2 sends the storage address of the first image to load balancer 100, and load balancer 100 sends the storage address of the first image to client 1. In other embodiments, node 2 can also establish a communication connection with client 1, and after storing the first image, node 2 can send the storage address of the first image to client 1 through the established communication connection.
[0104] See Figure 2 As shown, this is an image processing method provided in an embodiment of this application. This method can... Figure 1 The load balancer 100 in the process executes as follows:
[0105] Step S201: Receive the first image processing request sent by the client.
[0106] In some scenarios, the first image processing request includes the source address of the first image, the pre-allocated processing resource size of the first image, and the first processing parameters. The first processing parameters are determined based on the processing operations performed on the first image before storing it. Image processing parameters include image rotation, scaling, watermarking, cropping, quality conversion, format conversion, etc. The first processing parameters may include at least one of the above processing parameters, and this application does not specifically limit them.
[0107] In some scenarios, the source address of the first image can be located on the client or on other servers; this application does not impose specific limitations on this.
[0108] Step S202: For any node in the storage system, determine the node score of any node based on the node status of any node, the node address of any node, the source address of the first image, and the pre-occupied processing resource size of the first image.
[0109] The node score represents the probability that a node processes the first image.
[0110] In some scenarios, the node status of each node can be determined in the following way: For each node, perform the following operations: Obtain the node's processing resource information at set time intervals, including the node's processor utilization and / or memory utilization. Further, determine the node's remaining processing resources based on the node's processing resource information, and use this remaining processing resource information as the node's status. The set time interval can be one day, three days, or one week, or other durations; this application does not specifically limit this.
[0111] In some scenarios, for each node, the following operations are performed: the memory score of the node is determined based on the node state and the pre-occupied processing resource size of the first image, and the address score of the node is determined based on the node address and the source address of the first image; the weighted sum of the memory score and the address score is used as the node score.
[0112] In other scenarios, K nodes that meet the processing requirements of the first image can be determined based on the node status and the pre-occupied processing resource size of the first image. Then, for each node, the similarity between the source address of the first image and the node address of the node can be determined, and the node score of the node can be determined based on the similarity.
[0113] In some other scenarios, the first image processing request also includes the client's client address. When determining the node score, the following operations can be performed for each node: For each node, the following operations are performed: Determine the node's memory score based on the node's node status and the pre-occupied processing resource size of the first image, and determine the node's address score based on the node address, the source address of the first image, and the client address; The weighted sum of the memory score and the address score is used as the node score.
[0114] In some scenarios, the load balancer can also store the source address and number of times each node processes an image processing request. When a new first image processing request is received, it first identifies P nodes that meet the pre-allocated processing resources for the first image. Then, it compares the target source address of the image in the new first image processing request with the source addresses processed by the P nodes to obtain the node scores of the P nodes. For example, if a node has processed the target source address, its node score is higher than that of nodes that have not processed the target source address. In other scenarios, if S nodes have all processed the target source address, the node score can be determined for each of the S nodes based on the number of times it has processed the target source address. For example, the more times a node has processed the target source address, the higher its node score.
[0115] Step S203: Determine the target node based on the node scores of each node, and send an image processing request to the target node so that the target node processes and stores the first image in the cache according to the first processing parameters in the image processing request.
[0116] In some embodiments, since the image processing request sent by the load balancer to the target node is used to request the target node to process and store the image, the image processing request can also be called an image storage request.
[0117] Step S204: Receive the storage address of the first image sent by the target node and return the storage address to the client.
[0118] In some scenarios, if the target node's processing resource information is not obtained within a set time after an image processing request is sent, the target node is considered to have failed. Further, all nodes other than the target node can be designated as nodes to be transferred. The current node state of each node to be transferred is determined based on its current processing resource information. Then, a node score is determined for each node to be transferred based on its current node state and address, the source address of the first image, and the pre-allocated processing resource size. Finally, a new target node is determined based on the node scores of each node to be transferred, and the image processing request is sent to the new target node so that it can process the image according to the request.
[0119] As an example, if the storage system includes nodes 1-M and the target node is node 2, if the load balancer fails to obtain the processing resource information of node 2 within a set time period after sending the first image processing request to node 2, then node 2 is determined to have failed. Further, nodes 1 and 3-M are designated as nodes to be transferred, and the current processing resource information of nodes 1 and 3-M is obtained respectively. Based on the current processing resource information, the current node status of nodes 1 and 3-M is determined respectively.
[0120] Furthermore, for each node from node 1 to node M, a node score is determined based on the current node status and address, the source address of the first image, and the pre-allocated processing resource size. A new target node is then determined based on the node scores of nodes 1, 3, and M. Assuming node 3 has the highest node score, it is determined as the new target node, and an image processing request is sent to node 3 so that node 3 can process and store the first image based on the request.
[0121] Based on the above scheme, since each node is equipped with an image processing service, when the node processing images fails, the load balancer can determine a new target node so that the new target node can handle the image processing requests, thereby improving the fault tolerance of the storage system and enhancing the reliability and stability of the system.
[0122] In some embodiments, the target node is determined based on a second image processing request sent by the client. This second image processing request includes the client address, the storage address of the first image, and second processing parameters. The second processing parameters are determined based on the processing operations performed on the first image before sending it. The storage address of the first image is located on the target node. An image read request, including the client address and the second processing parameters, is sent to the target node. This allows the target node to process the first image in its cache according to the second processing parameters and then send the processed first image based on the client address.
[0123] See Figure 3 As shown, this is an image processing method provided in an embodiment of this application. This method can... Figure 1 The execution process is as follows, taking place on a node within storage system 200:
[0124] Step S301: Receive the image processing request sent by the load balancer.
[0125] The image processing request includes a first processing parameter. After receiving the first image processing request from the client, the load balancer determines the node score of any node in the storage system based on the node status, node address, source address of the first image, and the pre-allocated processing resource size of the first image. The target node is then determined based on the node scores of each node, and the request is sent to that target node. The node score represents the probability that a node will process the first image. The first processing parameter is determined based on the processing operations performed on the first image before it was stored.
[0126] Step S302: Process and store the first image in the cache according to the first processing parameters.
[0127] Specifically, the target node is equipped with an image processing service and a high-speed cache. When a first image processing request is received, the image data of the first image is obtained according to the source address of the first image. Then, the first image is processed in the high-speed cache according to the first processing parameters and stored in the storage area.
[0128] Step S303: Send the storage address of the first image to the load balancer so that the load balancer returns the storage address to the client.
[0129] In some scenarios, image processing requests can also include the client address. After the target node stores the processed first image, it can directly send the storage address of the first image to the client corresponding to the client address.
[0130] In some embodiments, the target node sends processing resource information to the load balancer at set time intervals. The processing resource information includes the node's processor utilization and / or memory utilization, so that the load balancer can determine the node's remaining processing resources based on the node's processing resource information and use the remaining processing resources as the node's node status.
[0131] In some embodiments, an image read request sent by a load balancer is received. The image read request includes a client address, the storage address of a first image, and second processing parameters. The second processing parameters are determined based on the processing operations performed on the first image before sending the first image. Further, the first image is processed in a cache according to the second processing parameters, and the processed first image is sent based on the client address.
[0132] Specifically, when the target node receives an image read request, it reads the first image into the cache according to the storage address of the first image, performs the processing operation corresponding to the second processing parameter in the cache, and then sends the processed first image to the client corresponding to the client address.
[0133] In some embodiments, nodes can clean up data in the cache and storage areas at set cleanup intervals to avoid performance degradation caused by cache overfilling. The set cleanup interval can be one day, three days, or one week, or other durations; this application does not specifically limit this.
[0134] Based on the above scheme, since each node has an image processing service deployed, image processing operations are completed locally on the node. When multiple processing operations are required for an image, because the processing is done locally on the node, frequent transmission of image data over the network is avoided, reducing data transmission time and latency, and improving the response speed of the storage system.
[0135] Furthermore, multiple nodes can process multiple image requests simultaneously, thereby improving the system's throughput and concurrent processing capabilities. Multi-node parallel processing significantly enhances the system's processing capacity and efficiency under high load conditions. If one node fails, other nodes can still continue processing requests, improving the system's fault tolerance and availability, reducing the impact of single points of failure, and ensuring service continuity.
[0136] In some embodiments, the specific processing flow of the image processing method provided in this application is as follows: Figure 4 As shown:
[0137] S401, the load balancer obtains the processing resource information of each node in the storage system and determines the node status of each node.
[0138] In some embodiments, assuming the storage system includes M nodes, the load balancer obtains processing resource information corresponding to each of the M nodes at set time intervals. The processing resource information includes at least one of processor utilization, response time, and memory utilization.
[0139] Furthermore, the load balancer determines the remaining processing resources based on the processing resource information of each node, and uses the remaining processing resources information as the node status.
[0140] S402, the first client sends the first image processing request to the load balancer.
[0141] The first image processing request instructs the storage of an image in the storage system. This request includes the image's source address, the pre-allocated processing resource size, and first processing parameters. These first processing parameters correspond to operations such as image rotation, scaling, watermarking, cropping, quality conversion, and format conversion, and represent the processing operations to be performed on the image before storage.
[0142] S403, the load balancer determines the node score corresponding to each node based on the first image request and the node status and node address of each node.
[0143] In some embodiments, for each node, the load balancer can determine the node score based on the source address of the image in the first image processing request, the pre-occupied processing resource size of the image, the node status, and the node address. The specific method is described in step S203, and will not be repeated here.
[0144] S404, the load balancer determines the target node based on the node score corresponding to each node, and sends an image storage request to the target node.
[0145] In some embodiments, the image storage request includes a first processing parameter and the source address of the image. The image storage request can be a first image processing request, meaning the load balancer directly sends the received first image processing request as an image storage request to the target node, or the image storage request can be a new request generated by the load balancer based on the first image processing request.
[0146] S405, the target node processes and stores the image in the cache according to the image storage request.
[0147] Specifically, the target node obtains the image data based on the source address in the image storage request, performs the image processing operation corresponding to the first processing parameter in the cache, and stores the processed image in the storage area.
[0148] S406, The target node sends the image storage address to the load balancer.
[0149] S407, the load balancer sends the storage address to the first client.
[0150] In some scenarios, when the first client needs to read an image, the following steps are also included:
[0151] S408, the first client sends a second image processing request to the load balancer.
[0152] The second image processing request instructs the node to read image data from the initial node. This request includes the client address, the image's storage address, and second processing parameters. These parameters are determined based on the image processing operations performed before sending the image; that is, the image processing operations the node must perform before sending the image to the client.
[0153] S409, the load balancer determines the target node based on the storage address in the second image read request.
[0154] In some embodiments, the load balancer can compare the storage address of an image with various nodes in the storage system to select the node containing the storage address as the target node.
[0155] S410, the load balancer sends an image read request to the target node.
[0156] In some embodiments, the image read request includes the client address, the image storage address, and a second processing parameter. The image processing request can be a second image processing request, meaning the load balancer directly sends the received second image processing request as an image read request to the target node, or the image read request can be a new request generated by the load balancer based on the second image processing request.
[0157] S411, the target node processes the image in the cache according to the second processing parameters.
[0158] Specifically, the target node reads the image into the cache according to its storage address and performs corresponding processing operations on the image based on the second processing parameters. The image at the storage address is the image after processing based on the first processing parameters.
[0159] S412 sends the processed image to the first client based on the client address.
[0160] In other embodiments, the specific processing flow of the image processing method provided in this application is as follows: Figure 5 As shown:
[0161] Steps S501-S505 are the same as steps S401-S405, and will not be repeated here. The first image processing request and the image storage request also include the client address of the first client.
[0162] S506, the target node establishes a communication connection with the first client based on the client address.
[0163] S507, the target node sends the storage address of the image to the first client based on the established communication connection.
[0164] In some scenarios, when the first client needs to read an image, the following steps are also included:
[0165] S508, the first client sends an image read request to the target node.
[0166] In some embodiments, the image read request includes the image's storage address and a second processing parameter. The first client sends the image read request to the target node based on the previously established communication connection.
[0167] S509, the target node processes the image in the cache according to the second processing parameters.
[0168] Specifically, the target node reads the image into the cache according to its storage address and performs corresponding processing operations on the image based on the second processing parameters. The image at the storage address is the image after processing based on the first processing parameters.
[0169] S510 sends the processed image to the first client.
[0170] Based on the above scheme, when the load balancer sends an image storage request to the target node, it can send the client's address to the target node. A communication connection is then established between the target node and the client, allowing the target node to directly send the storage address to the client without the load balancer forwarding the storage address, thus saving transmission overhead. Furthermore, once the communication connection between the target node and the client is established, the client can directly initiate a read request to the target node through the previously established communication connection when reading an image, without the load balancer's involvement, further improving image reading efficiency and saving data transmission overhead.
[0171] Based on the same technical concept, see [link / reference] Figure 6 As shown, an image processing apparatus 600 is provided in an embodiment of this application. This apparatus 600 can perform the above-described... Figure 2 To avoid repetition, any step in the image processing method will not be described again here. The apparatus 600 includes a receiving unit 601, a processing unit 602, and a transmitting unit 603.
[0172] The receiving unit 601 is used to receive a first image processing request sent by the client. The first image processing request includes the source address of the first image, the pre-occupied processing resource size of the first image, and the first processing parameters. The first processing parameters are determined based on the processing operations performed on the first image before storing the first image.
[0173] Processing unit 602 is configured to determine a node score for any node in the storage system based on the node status of the node, the node address of the node, the source address of the first image, and the pre-occupied processing resource size of the first image; the node score represents the probability that the node processes the first image.
[0174] The sending unit 603 is used to determine a target node based on the node scores of each of the nodes, and send an image processing request to the target node so that the target node processes and stores the first image in the cache according to the first processing parameters in the image processing request;
[0175] The receiving unit 601 is further configured to receive the storage address of the first image sent by the target node and return the storage address to the client.
[0176] In one possible implementation, when the processing unit 602 determines the node score of each node in the storage system based on the node status and node address of each node in the storage system, the source address of the first image, and the pre-occupied processing resource size, it is specifically used for:
[0177] For each node, perform the following operations:
[0178] The memory score of the node is determined based on the node status and the pre-occupied processing resource size of the first image, and the address score of the node is determined based on the node address and the source address of the first image.
[0179] The weighted sum of the memory score and the address score is used as the node score of the node.
[0180] In one possible implementation, the processing unit 602 is further configured to:
[0181] The node status of each node is determined in the following ways:
[0182] For each node, perform the following operations:
[0183] The processing resource information of the node is obtained at set time intervals, and the processing resource information includes the node's processor utilization rate and / or memory utilization rate.
[0184] Based on the processing resource information of the node, the remaining processing resource information of the node is determined, and the remaining processing resource information is used as the node state of the node.
[0185] In one possible implementation, the processing unit 602 is further configured to:
[0186] If the processing resource information of the target node is not obtained within a set time period after the first image processing request is sent to the target node, it is determined that the target node has failed.
[0187] Each node other than the target node is designated as a node to be transferred, and the current node status of each node to be transferred is determined based on the current processing resource information of each node to be transferred.
[0188] The node score of each node to be transferred is determined based on the current node status and node address of the node to be transferred, the source address of the first image, and the pre-occupied processing resource size.
[0189] A new target node is determined based on the node scores corresponding to each node to be transferred, and the image processing request is sent to the new target node so that the new target node processes the first image according to the image processing request.
[0190] In one possible implementation, the processing unit 602 is further configured to: determine a target node based on a second image processing request sent by the client; wherein the second image processing request includes a client address, a storage address of a first image, and second processing parameters, the second processing parameters being determined based on processing operations performed on the first image before sending the first image, and the storage address of the first image being located at the target node;
[0191] The sending unit 603 is further configured to send an image reading request to the target node. The image reading request includes a client address and a second processing parameter, so that the target node processes the first image in the cache according to the second processing parameter and then sends the processed first image based on the client address.
[0192] Based on the same technical concept, see [link / reference] Figure 7 As shown, an image processing apparatus 700 is provided in an embodiment of this application. This apparatus 700 can perform the above-described... Figure 3 To avoid repetition, any step in the image processing method will not be described again here. The apparatus 700 includes a receiving unit 701, a processing unit 702, and a transmitting unit 703.
[0193] The receiving unit 701 is configured to receive an image processing request sent by a load balancer. The image processing request includes a first processing parameter. The image processing request is generated by the load balancer after receiving the first image processing request from the client. For any node in the storage system, the load balancer determines a node score based on the node status, node address, source address of the first image, and the pre-allocated processing resource size of the first image. Based on the node scores of each node, a target node is determined and the request is sent to the target node. The node score represents the probability that the node will process the first image. The first processing parameter is determined based on the processing operations performed on the first image before storing it.
[0194] The processing unit 702 is used to process and store the first image in a cache according to the first processing parameters;
[0195] The sending unit 703 is used to send the storage address of the first image to the load balancer so that the load balancer returns the storage address to the client.
[0196] In one possible implementation, the sending unit 7033 is further configured to:
[0197] The load balancer sends processing resource information, including the processor utilization and / or memory utilization of the node, at set time intervals, so that the load balancer can determine the remaining processing resources of the node based on the processing resource information of the node and use the remaining processing resources as the node status of the node.
[0198] In one possible implementation, the receiving unit 701 is further configured to receive an image reading request sent by the load balancer. The image reading request includes a client address, a storage address of a first image, and a second processing parameter, which is determined based on the processing operation performed on the first image before sending the first image.
[0199] The processing unit 702 is further configured to process the first image in a cache according to the second processing parameters;
[0200] The sending unit 703 is also used to send the processed first image based on the client address.
[0201] Based on the same technical concept, embodiments of this application provide an execution device 800, which can implement any step of the image processing method described above. Please refer to... Figure 8 The device includes a memory 801 and a processor 802.
[0202] The memory 801 is used to store program instructions;
[0203] The processor 802 is used to call the program instructions stored in the memory and execute the above image processing method according to the obtained program.
[0204] In the embodiments of this application, the processor 802 may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field-programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, capable of implementing or executing the various methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or being executed by a combination of hardware and software modules in the processor.
[0205] Memory 801, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 801 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 801 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, memory 801 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.
[0206] Based on the same technical concept, embodiments of this application provide a computer-readable storage medium including computer program instructions. When the computer program instructions are executed on a computer, the computer causes the computer to perform the image processing method as described above. Since the principle by which the above-described computer-readable storage medium solves the problem is similar to that of the image processing method, the implementation of the above-described computer-readable storage medium can be referred to the implementation of the method, and repeated details will not be repeated.
[0207] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0208] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0209] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0210] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0211] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. An image processing method, characterized in that, Applied to load balancers, the method includes: The system receives a first image processing request sent by the client. The first image processing request includes the source address of the first image, the pre-occupied processing resource size of the first image, and the first processing parameters. The first processing parameters are determined based on the processing operations performed on the first image before storing the first image. For any node in the storage system, a node score is determined based on the node status of the node, the node address of the node, the source address of the first image, and the pre-occupied processing resource size of the first image; the node score represents the probability that the node processes the first image. A target node is determined based on the node scores of each node, and an image processing request is sent to the target node so that the target node processes and stores the first image in the cache according to the first processing parameters in the image processing request. The storage address of the first image sent by the target node is received and returned to the client.
2. The method as described in claim 1, characterized in that, The step of determining the node score of each node in the storage system based on the node status and node address of each node in the storage system, the source address of the first image, and the pre-occupied processing resources of the first image includes: For each node, perform the following operations: The memory score of the node is determined based on the node status and the pre-occupied processing resource size of the first image, and the address score of the node is determined based on the node address and the source address of the first image. The weighted sum of the memory score and the address score is used as the node score of the node.
3. The method as described in claim 1 or 2, characterized in that, The node status of each node is determined in the following ways: For each node, perform the following operations: The processing resource information of the node is obtained at set time intervals, and the processing resource information includes the node's processor utilization rate and / or memory utilization rate. Based on the processing resource information of the node, the remaining processing resource information of the node is determined, and the remaining processing resource information is used as the node state of the node.
4. The method as described in claim 3, characterized in that, The method further includes: If the processing resource information of the target node is not obtained within a set time period after the image processing request is sent to the target node, it is determined that the target node has failed. Each node other than the target node is designated as a node to be transferred, and the current node status of each node to be transferred is determined based on the current processing resource information of each node to be transferred. The node score of each node to be transferred is determined based on the current node status and node address of the node to be transferred, the source address of the first image, and the pre-occupied processing resource size. A new target node is determined based on the node scores corresponding to each node to be transferred, and the image processing request is sent to the new target node so that the new target node processes the first image according to the image processing request.
5. The method as described in claim 1, characterized in that, The method further includes: The target node is determined based on the second image processing request sent by the client; wherein, the second image processing request includes the client address, the storage address of the first image, and the second processing parameters, the second processing parameters being determined based on the processing operations performed on the first image before sending the first image, and the storage address of the first image being located at the target node; An image read request is sent to the target node. The image read request includes a client address and a second processing parameter, so that the target node processes the first image in the cache according to the second processing parameter and then sends the processed first image based on the client address.
6. An image processing method, characterized in that, The method, applied to a target node in a storage system, includes: The system receives an image processing request sent by a load balancer. The image processing request includes a first processing parameter. After receiving the first image processing request from the client, the load balancer determines the node score of any node in the storage system based on the node status, node address, source address of the first image, and the pre-allocated processing resource size of the first image. Based on the node scores of each node, a target node is determined and the request is sent to that target node. The node score represents the probability that the node will process the first image. The first processing parameter is determined based on the processing operations performed on the first image before storing it. The first image is processed and stored in a high-speed cache according to the first processing parameters; The storage address of the first image is sent to the load balancer so that the load balancer returns the storage address to the client.
7. The method as described in claim 6, characterized in that, The method further includes: The load balancer sends processing resource information, including the processor utilization and / or memory utilization of the node, at set time intervals, so that the load balancer can determine the remaining processing resources of the node based on the processing resource information of the node and use the remaining processing resources as the node status of the node.
8. The method as described in claim 6 or 7, characterized in that, The method further includes: The system receives an image read request sent by the load balancer. The image read request includes a client address, the storage address of a first image, and a second processing parameter, which is determined based on the processing operation performed on the first image before sending the first image. The first image is processed in the cache according to the second processing parameters; The processed first image is sent based on the client address.
9. An image processing apparatus, characterized in that, include: The receiving unit is used to receive a first image processing request sent by the client. The first image processing request includes the source address of the first image, the pre-occupied processing resource size of the first image, and the first processing parameters. The first processing parameters are determined based on the processing operations performed on the first image before storing the first image. The processing unit is configured to determine a node score for any given node in the storage system based on the node status of the given node, the node address of the given node, the source address of the first image, and the pre-occupied processing resource size of the first image; the node score represents the probability that the node processes the first image. The sending unit is configured to determine a target node based on the node scores of each of the nodes, and send an image processing request to the target node so that the target node processes and stores the first image in the cache according to the first processing parameters in the image processing request; The receiving unit is further configured to receive the storage address of the first image sent by the target node and return the storage address to the client.
10. An image processing apparatus, characterized in that, include: A receiving unit is configured to receive an image processing request sent by a load balancer. The image processing request includes a first processing parameter. The image processing request is generated by the load balancer after receiving the first image processing request from the client. For any node in the storage system, the load balancer determines a node score based on the node status, node address, source address of the first image, and the pre-allocated processing resource size of the first image. Based on the node scores of each node, a target node is determined and the request is sent to the target node. The node score represents the probability that the node will process the first image. The first processing parameter is determined based on the processing operations performed on the first image before storing it. The processing unit is configured to process and store the first image in a cache according to the first processing parameters. The sending unit is used to send the storage address of the first image to the load balancer, so that the load balancer returns the storage address to the client.