Resource access method and device for distributed storage system, equipment and medium

By creating multiple task queues and threads in a distributed storage system and assigning tasks according to task type and stage, the problem of low multitasking performance of iSCSI client is solved, high concurrency and asynchronous processing are achieved, and read and write performance is improved.

CN119127438APending Publication Date: 2024-12-13JINAN INSPUR DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411237611.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-04
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

In distributed block storage systems, single-threaded single-task processing of iSCSI client and TGT platform causes poor read and write operation performance when multiple clients access simultaneously, and when one task takes too long or blocks, other tasks Waiting is required, resulting in slow IO processing.

Method used

After the server establishes a connection with the client, create multiple task queues and corresponding threads, add tasks to the corresponding task queue according to the message type and task stage, and process them through the threads of the task queue to achieve high concurrency and asynchronous processing, reducing the number of tasks and data. Competitive resources between threads.

Benefits of technology

Through multi-task queue processing, read and write performance is improved, high concurrency and asynchronous processing is achieved, resource competition among threads is reduced, and overall system performance is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127438A_ABST
    Figure CN119127438A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a resource access method of a distributed storage system, the distributed storage system comprises a server and a client, and after the server establishes connection with the client, a plurality of task queues and corresponding threads are created; receiving a plurality of messages sent by the client in the process of accessing the target resource of the server; generating corresponding tasks according to the plurality of messages; task information of the tasks is determined, and the tasks are added to corresponding task queues according to the task information; and processing the task in the task queue through a thread corresponding to the task queue so as to complete the access of the client to the target resource of the server. By dividing the tasks according to types and distributing the tasks to different threads for processing, mutual interference among the tasks can be reduced to the maximum extent, and the overall performance of the system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of distributed storage technology, and in particular to a resource access method of a distributed storage system, a resource access device of a distributed storage system, an electronic device and a computer-readable storage medium. Background Art

[0002] iSCSI (Internet Small Computer System Interface, also known as IP-SAN, is a storage technology protocol based on the Internet and SCSI-3 protocol) is a set of standard protocols. By using the TCP / IP (Transmission Control Protocol / Internet Protocol) communication protocol, it realizes the interaction of SCSI (Small Computer System Interface) commands between two computers, allowing computers to simulate SAN (Storage Area Network) as a local storage device through high-speed LAN hubs.

[0003] In the distributed block storage system, librbd (Ceph RADOS Block Device, i.e., the client library of RBD) can provide block-related services to the outside world. TGT (Linux SCSI target framework, a user-mode integrated SCSI target framework) is the target software of the iSCSI protocol. Through command configuration, it connects to the distributed storage system and provides iSCSI block services to the outside world. The iSCSI client can log in to the target to enable the local computer to access the remote volume, so that the remote volume can be treated as a local block device for read and write operations.

[0004] When the iSCSI client connects to the TGT platform, the current TGT open source software implements single-threaded single-task processing of iSCSI connections. When multiple iSCSI clients log in to TGT at the same time, due to single-task processing and the use of synchronous task processing, multiple clients simultaneously issue read and write operations. When a task takes too long or is blocked, other tasks can only wait, which results in slow processing of IO (Input / Output) and other operations and poor read and write performance. Summary of the invention

[0005] In view of the above problems, embodiments of the present invention are proposed to provide a resource access method for a distributed storage system, a resource access device for a distributed storage system, an electronic device and a corresponding computer-readable storage medium that overcome the above problems or at least partially solve the above problems.

[0006] In order to solve the above problem, a first aspect of an embodiment of the present invention discloses a resource access method of a distributed storage system, wherein the distributed storage system includes a server and a client, and the method includes:

[0007] After establishing a connection with the client, the server creates a plurality of task queues and threads corresponding to the plurality of task queues;

[0008] receiving a plurality of messages sent by the client in the process of accessing a target resource of the server;

[0009] Generate corresponding tasks for the multiple messages respectively, and add the tasks to the corresponding task queues;

[0010] The tasks in the task queue are processed through the thread corresponding to the task queue to complete the client's access to the target resource of the server.

[0011] Optionally, generating corresponding tasks for the multiple messages respectively, and adding the tasks to corresponding task queues, includes:

[0012] determining a task type for the task;

[0013] The task is added to a task queue corresponding to the task type of the task.

[0014] Optionally, generating corresponding tasks for the multiple messages respectively, and adding the tasks to corresponding task queues, includes:

[0015] When the task includes multiple task stages, determining a current task stage of the task;

[0016] The task is added to a task queue corresponding to the current task stage of the task.

[0017] Optionally, generating corresponding tasks for the multiple messages respectively, and adding the tasks to corresponding task queues, includes:

[0018] Identify the target resources for the task;

[0019] Add the task to the task queue corresponding to the target resource.

[0020] Optionally, generating corresponding tasks for the multiple messages respectively, and adding the tasks to corresponding task queues, includes:

[0021] When receiving the discovery message sent by the client, generating a discovery task and adding the discovery task to the corresponding task queue; the discovery task is used to obtain the resource directory of the server;

[0022] When receiving a login message sent by the client, a login task is generated and the login task is added to the corresponding task queue; the login message is sent by the client after selecting a target resource from the resource directory; the login task is used to request that the client be allowed to access the target resource;

[0023] When receiving an access message for the target resource sent by the client, generating an access task and adding the access task to a corresponding task queue; the access task is used to access the target resource;

[0024] The processing of the tasks in the task queue by the thread corresponding to the task queue includes: processing the discovery task by the thread corresponding to the task queue where the discovery task is located to send a resource directory to the client;

[0025] Processing the login task through a thread corresponding to the task queue where the login task is located to allow the client to access the target resource;

[0026] The access task is processed by a thread corresponding to the task queue where the access task is located to access the target resource.

[0027] Optionally, it also includes:

[0028] When the thread corresponding to the task queue obtains a task from the task queue, the task is removed from the task queue, or the task is added to the completion queue, and after the thread completes processing the task, the task is removed from the completion queue.

[0029] Optionally, it also includes:

[0030] After receiving the connection message sent by the client, a connection is established with the client.

[0031] A second aspect of an embodiment of the present invention discloses a resource access device for a distributed storage system, wherein the distributed storage system includes a server and a client, and the device includes:

[0032] A thread creation module, used for the server to create multiple task queues and threads corresponding to the multiple task queues after establishing a connection with the client;

[0033] A message receiving module, used for receiving a plurality of messages sent by the client in the process of accessing the target resource of the server;

[0034] A task adding module, used for generating corresponding tasks for the plurality of messages respectively, and adding the tasks to the corresponding task queue;

[0035] The task processing module is used to process the tasks in the task queue through the thread corresponding to the task queue to complete the client's access to the target resource of the server.

[0036] Optionally, the task adding module includes:

[0037] A task type determination submodule, used to determine the task type of the task;

[0038] The first task adding submodule is used to add the task to a task queue corresponding to the task type of the task.

[0039] Optionally, the task adding module includes:

[0040] A task phase determination submodule, used for determining a current task phase of the task when the task includes multiple task phases;

[0041] The second task adding submodule is used to add the task to the task queue corresponding to the current task stage of the task.

[0042] Optionally, the task adding module includes:

[0043] A target resource determination submodule, used to determine the target resource targeted by the task according to the task information of the task;

[0044] The third task adding submodule is used to add the task to the task queue corresponding to the target resource.

[0045] Optionally, the task adding module includes:

[0046] A discovery task adding submodule is used to generate a discovery task when receiving a discovery message sent by the client, and add the discovery task to a corresponding task queue; the discovery task is used to obtain a resource directory of the server;

[0047] A login task generation submodule is used to generate a login task when receiving a login message sent by the client, and add the login task to a corresponding task queue; the login message is sent by the client after selecting a target resource from the resource directory; the login task is used to request permission for the client to access the target resource;

[0048] An access task generation submodule, for generating an access task upon receiving an access message sent by the client for the target resource, and adding the access task to a corresponding task queue; the access task is used to access the target resource;

[0049] The task processing module comprises:

[0050] A discovery task processing submodule, used for processing the discovery task through a thread corresponding to the task queue where the discovery task is located to send a resource directory to the client;

[0051] A login task processing submodule, used for processing the login task through a thread corresponding to the task queue where the login task is located to allow the client to access the target resource;

[0052] The access task processing submodule is used to process the access task to access the target resource through the thread corresponding to the task queue where the access task is located.

[0053] Optionally, it also includes:

[0054] The task removal or addition submodule is used to remove the task from the task queue or add the task to the completion queue after the thread corresponding to the task queue obtains the task from the task queue, and remove the task from the completion queue after the thread completes the task.

[0055] Optionally, it also includes:

[0056] The connection establishment submodule is used to establish a connection with the client after receiving a connection message sent by the client.

[0057] According to a third aspect of an embodiment of the present invention, an electronic device is disclosed, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the resource access method of the distributed storage system as described above are implemented.

[0058] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is disclosed, on which a computer program is stored. When the computer program is executed by a processor, the steps of the resource access method of the distributed storage system as described above are implemented.

[0059] The embodiments of the present invention include the following advantages:

[0060] The present invention introduces a resource access method for a distributed storage system. The distributed storage system includes a server and a client. After the server establishes a connection with the client, it creates multiple task queues and corresponding threads; receives multiple messages sent by the client in the process of accessing the target resources of the server; generates corresponding tasks for the multiple messages respectively; determines the task information of the task, and adds the task to the corresponding task queue according to the task information; processes the tasks in the task queue through the thread corresponding to the task queue to complete the client's access to the target resources of the server. By creating multiple task queues, the task queues are assigned to different threads for processing according to the different stages of the tasks, thereby achieving the effect of high concurrency and asynchronous processing. At the same time, different task threads are divided according to the different stages of the tasks, and the client connecting to the same task is assigned to the same thread for processing, thereby reducing resource competition between threads, achieving lock-free processing, and improving read and write performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 It is a flow chart of the steps of a resource access method of a distributed storage system provided by an embodiment of the present invention;

[0062] Figure 2 It is a client and server communication model diagram of a resource access method of a distributed storage system provided by an embodiment of the present invention;

[0063] Figure 3 It is a multi-task queue processing flow chart of another resource access method of a distributed storage system provided by an embodiment of the present invention;

[0064] Figure 4 It is a structural block diagram of a resource access device of a distributed storage system provided by an embodiment of the present invention;

[0065] Figure 5 is a structural block diagram of an electronic device provided by an embodiment of the present invention;

[0066] Figure 6 It is a structural block diagram of a computer-readable storage medium provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0067] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0068] One of the core concepts of the embodiment of the present invention is that the present invention provides a resource access method for a distributed storage system, wherein the distributed storage system includes a server and a client. After the server establishes a connection with the client, it creates multiple task queues and corresponding threads; receives multiple messages sent by the client in the process of accessing the target resources of the server; generates corresponding tasks for the multiple messages respectively; determines the task information of the task, and adds the task to the corresponding task queue according to the task information; processes the tasks in the task queue through the thread corresponding to the task queue to complete the client's access to the target resources of the server. By dividing the tasks according to type and assigning them to different threads for processing, mutual interference between tasks can be minimized and the overall performance of the system can be improved.

[0069] Reference Figure 1 , shows a flow chart of the steps of a resource access method of a distributed storage system provided by an embodiment of the present invention, and the method may specifically include the following steps:

[0070] Step 101, after establishing a connection with the client, the server creates a plurality of task queues and threads corresponding to the plurality of task queues;

[0071] Distributed storage is the aggregation of storage space in multiple storage devices into a storage system that can provide a unified access interface and management interface to the application server. In this embodiment, the server can refer to the TGT platform. iSCSI allows remote access to storage devices through the Internet or a local area network, similar to a local connection. In the context of iSCSI, "TGT" usually refers to iSCSI Target, which is a server or device that provides storage resources. iSCSI Target can provide storage resources through the Internet, allowing users to access these resources remotely, just as if they were locally connected. The client is the Initiator, the client software / hardware that requests data access.

[0072] Task queues and task threads are common concepts in concurrent programming. They are widely used in multi-threaded and multi-tasking environments to manage and schedule the execution of tasks. A task queue is a data structure containing tasks to be executed, usually a first-in-first-out (FIFO) queue. In a multi-threaded or multi-process environment, task queues can help manage the execution order of concurrent tasks and avoid problems such as resource competition and deadlock. A task thread is a thread dedicated to executing tasks in a task queue. These threads are usually allocated from a thread pool, and they continuously obtain tasks from the task queue and execute them until the queue is empty or the thread pool is closed.

[0073] In one embodiment, step 101 may include the following sub-steps:

[0074] Sub-step S11, after receiving the connection message sent by the client, establishing a connection with the client.

[0075] The interaction between the iSCSI client (Initiator) and the iSCSI Target mainly includes four stages: discovery, login, data transmission, and exit. These interactions are implemented through sessions and connections, where sessions are logical connections and connections are actual TCP connections. Connections are established on the TCP / IP layer and represent a bidirectional data channel between two endpoints. Connections are part of a session and are used to transmit data. Connections can use different IP addresses and ports. After the connection is established, the client and server perform subsequent session establishment and task instruction transmission and execution.

[0076] Step 102, receiving a plurality of messages sent by the client in the process of accessing the target resource of the server;

[0077] After the server and client are connected, a session is established. The client sends different messages according to the Target resource directory sent by the server to complete access and subsequent operation instructions. The message may include iSCSI task messages and SCSI task messages. iSCSI tasks refer to SCSI tasks sent and processed through the iSCSI protocol in the iSCSI environment. These tasks are sent by the iSCSI Initiator to the iSCSI Target and transmitted through the TCP / IP network; SCSI tasks refer to commands issued by the SCSI controller for specific SCSI devices. These commands may include operations such as reading, writing, and formatting. In the iSCSI environment, SCSI tasks are generated by the iSCSI Initiator and sent to the iSCSI Target through the iSCSI protocol.

[0078] Step 103, generating corresponding tasks for the multiple messages respectively, and adding the tasks to the corresponding task queue;

[0079] Under multi-tasking, TGT creates multiple task queues and corresponding processing threads. These task queues and threads are differentiated by task type, including a configuration management queue, an iSCSI login queue, multiple iSCSI target task queues and multiple SCSI task queues. According to different iSCSI task types, tasks are assigned to different threads for processing. By sharing task queues between threads, tasks are processed by different threads at different stages, realizing asynchronous processing of multiple tasks and improving processing performance.

[0080] In one embodiment, step 103 may include the following sub-steps:

[0081] Sub-step S21, determining the task type of the task;

[0082] According to the type of task, it is assigned to the corresponding type of task queue. For example, iSCSI login request will be placed in iSCSI login queue, and SCSI read and write operations will be placed in SCSI task queue. Each different stage has a fixed corresponding task queue and corresponding thread processing, and tasks in different stages are processed by different queues.

[0083] Sub-step S22: adding the task to a task queue corresponding to the task type of the task.

[0084] For example, the configuration management queue is used to store tasks related to configuration management, such as updating configuration files, loading configurations, etc. To ensure that user operations do not affect the processing of other tasks such as reading and writing, a separate thread is used to handle management commands.

[0085] In the embodiment of the present invention, corresponding tasks are generated for multiple messages respectively, and the tasks are added to the corresponding task queues, including: determining the task type of the task; adding the task to the task queue corresponding to the task type of the task. By dividing the tasks according to the type and assigning them to different threads for processing, the mutual interference between tasks can be minimized and the overall performance of the system can be improved; tasks can be processed asynchronously, and other tasks can be processed without waiting for a certain task to be completed; because tasks and threads are separated according to their functions, the entire system is more modular and easy to maintain and expand.

[0086] In one embodiment, step 103 may further include the following sub-steps:

[0087] Sub-step S31, when the task includes multiple task stages, determining the current task stage of the task;

[0088] The interaction process between the iSCSI client (Initiator) and the iSCSI Target (TGT) mainly includes several key stages: discovery stage, login stage, SCSI command exchange stage, data transmission stage and logout stage. The simplified process of the entire interaction process from discovery to closure is roughly as follows: discovery, iSCSI Initiator sends a Discovery message; login, iSCSI Initiator sends a Login message to the selected iSCSI Target; negotiation, iSCSI Initiator and Target negotiate session parameters; command, iSCSI Initiator sends SCSI commands to iSCSI Target; data, iSCSI Target executes commands and sends data to Initiator; status, iSCSI Target sends status information to Initiator; logout, iSCSI Initiator or Target sends a Logout message; closure, the TCP connection between iSCSI Initiator and TGT is closed.

[0089] Sub-step S32, adding the task to a task queue corresponding to the current task stage of the task.

[0090] In one embodiment, step 103 may further include the following sub-steps:

[0091] Sub-step S41, determining the target resource for the task;

[0092] Sub-step S42: adding the task to the task queue corresponding to the target resource.

[0093] In the embodiment of the present invention, in an iSCSI connection, when an Initiator logs in to a TGT, it is actually establishing a communication session, which allows the Initiator to access the storage resource target provided by the TGT. A server can simultaneously connect to multiple clients to allow them to access the target resource target and query, read, write, and perform other operations. The target resource targeted by each client's instruction task is not necessarily the same. Each TGT has a unique IQN to identify the TGT. The TGT will be assigned a target ID, which is a unique identifier within a session to distinguish different targets. This ID is usually generated by the Initiator when the session is established. Therefore, it can be allocated according to the target ID logged in by each iSCSI connection, and resource competition between threads can be reduced by distinguishing targets.

[0094] In one embodiment, step 103 may further include the following sub-steps:

[0095] Sub-step S51, when receiving the discovery message sent by the client, generating a discovery task and adding the discovery task to the corresponding task queue; the discovery task is used to obtain the resource directory of the server;

[0096] This phase is the discovery phase. The Discovery process allows the iSCSI Initiator to discover and enumerate the iSCSI Target on the network. This process is usually completed through broadcast or unicast, depending on the network configuration. After the iSCSI Initiator sends the Discovery message, it can receive a portal list from the iSCSI Target. The portal list contains the IP address and port number information of the TGT. The iSCSI Initiator saves the received portal list and can use it for subsequent session establishment.

[0097] Sub-step S52, when receiving the login message sent by the client, generating a login task and adding the login task to the corresponding task queue; the login message is sent by the client after selecting the target resource from the resource directory; the login task is used to request that the client be allowed to access the target resource;

[0098] In the login phase (Login), once the Initiator finds the TGT through the discovery process, it will try to establish a session with it. This process includes: the Initiator sends an Open Session request to the TGT to establish a new session; CHAP (Challenge Handshake Authentication Protocol), if CHAP authentication is configured, the Target will send a challenge to the Initiator, and the Initiator needs to encrypt the response to the challenge with a pre-shared key; Session parameter negotiation: the two parties negotiate session parameters, such as the maximum data segment length (MaxDataSegmentLength), session period, etc.; Session Establishment, after successfully completing the above steps, the session establishment is completed, and the two parties can start iSCSI communication.

[0099] Sub-step S53, when receiving an access message for the target resource sent by the client, generating an access task and adding the access task to a corresponding task queue; the access task is used to access the target resource;

[0100] After the Login phase is completed, the iSCSI session has been established. The Initiator can interact with the TGT through the TCP / IP network for SCSI commands. In this phase, the Initiator sends SCSI commands (such as read, write) to the TGT; SCSI command encapsulation, SCSI commands are encapsulated into iSCSI PDU (Protocol Data Unit) format for transmission through the TCP / IP network. If the SCSI command involves data transmission, data exchange is performed in this step. The data transmission process includes: data segment transmission, if the command involves data transmission, the data is divided into multiple data segments, and each data segment is transmitted through a separate iSCSI PDU; data confirmation, after receiving the data segment, the Target will send a confirmation message to confirm the correct receipt of the data.

[0101] Step 104: Process the tasks in the task queue through the thread corresponding to the task queue to complete the client's access to the target resource of the server.

[0102] Threads communicate with each other through a shared task queue. For example, after the iSCSI login thread processes the login request, it may put the task related to the target into the corresponding iSCSI target task queue so that the subsequent processing thread can continue to process it.

[0103] In one embodiment, step 104 may include the following sub-steps:

[0104] Step S61, processing the discovery task through the thread corresponding to the task queue where the discovery task is located to send a resource directory to the client;

[0105] The iSCSI client host (initiator) establishes a connection with TGT through the TCP protocol and implements storage-related operations through the iSCSI protocol. The first is the discovery phase, in which the client host (iSCSI Initiator) discovers available servers or devices (iSCSI Targets) that provide storage resources. The client queries the target directory created by TGT. These tasks are completed by the thread corresponding to the discovery task queue.

[0106] Sub-step S62, processing the login task through the thread corresponding to the task queue where the login task is located to allow the client to access the target resource;

[0107] The iSCSI login queue is used to store tasks related to iSCSI login, such as processing login requests, authentication, etc. The thread corresponding to the login queue performs tasks, such as monitoring the iSCSI TCP port, receiving login messages from the client, including iSCSI discovery messages and iSCSI login messages, and after the login is completed, transferring the iSCSI connection task to the iSCSI target task queue for processing. Since there are multiple iSCSI target threads, they are allocated according to the target id of each iSCSI connection login. By distinguishing targets, resource competition between threads can be reduced.

[0108] Sub-step S63, processing the access task to access the target resource through the thread corresponding to the task queue where the access task is located.

[0109] For example, iSCSI Target task queue creates a task queue for each iSCSI Target to store tasks related to the Target, such as processing iSCSI commands, data transmission, etc. The corresponding task thread is mainly responsible for the subsequent task message processing after iSCSI login, including iSCSI logout message, heartbeat message, SCSI message, etc. When the message type is SCSI message, the SCSI task is assigned to the SCSI task queue. When the SCSI thread completes the task processing, the SCSI task is moved from the queue to the task completion queue, and then processed by the iSCSI target thread, and the processing result is returned to the client.

[0110] The SCSI task queue is used to store tasks related to SCSI operations, such as reading and writing. It mainly includes SCSI query, SCSI read and write message processing. The task thread mainly traverses the SCSI task queue, processes various SCSI messages, and returns the processed results and tasks to the iSCSI target thread for processing.

[0111] In one embodiment, step 104 may further include the following sub-steps:

[0112] Sub-step S71, after the thread corresponding to the task queue obtains the task from the task queue, removes the task from the task queue, or adds the task to the completion queue, and after the thread completes processing the task, removes the task from the completion queue.

[0113] In one embodiment of the present invention, after the task thread corresponding to the task queue has processed the task instruction, it can be removed from the task queue or added to the completion queue. For example, for non-read and write tasks in iSCSI message tasks or SCSI message tasks, the corresponding thread can directly remove them from the task queue after processing is completed, and the processing result is sent to the client. For tasks such as read and write tasks in SCSI message tasks that need to wait for the distributed system to complete processing, it is necessary to move the task to the finish completion queue. After the processing is completed, the finish queue is traversed, the task results of the completed read and write tasks are sent to the client, and the task is removed from the finish queue to release resources.

[0114] The embodiment of the present invention provides a resource access method of a distributed storage system, wherein the distributed storage system includes a server and a client. After the server establishes a connection with the client, it creates multiple task queues and corresponding threads; receives multiple messages sent by the client in the process of accessing the target resources of the server; generates corresponding tasks for each of the multiple messages; determines the task information of the task, and adds the task to the corresponding task queue according to the task information; processes the tasks in the task queue through the thread corresponding to the task queue to complete the client's access to the target resources of the server. When a small number of clients access the server, the performance is improved, and when there are a large number of clients accessing, the performance is significantly improved; as the number of client accesses increases, there is no additional system overhead for server task processing, and read and write tasks can be processed with high concurrency, and the performance is relatively stable; the technology of the present invention can be integrated into the existing TGT system and is compatible with distributed storage systems.

[0115] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0116] Based on the existing TGT, the present invention improves the business processing performance by realizing multi-task processing according to iSCSI login status and message type. In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments.

[0117] Reference Figure 2 , shows a client and server communication model diagram of a resource access method of a distributed storage system provided by an embodiment of the invention.

[0118] The iSCSI client initiator establishes a connection with the TGT server through the TCP protocol and implements storage-related operations through the iSCSI protocol. The specific operations can be divided into three stages: in the discovery stage, the client queries the target directory created by TGT; in the login stage, the client specifies the target to log in to the TGT server. The client receives the target directory. If it wants to access a certain target, it must first log in and send an iSCSI login message to the TGT server; the TGT server sends a login response to the client, indicating that the login is successful and it will respond; in the SCSI stage, the client sends SCSI instructions to the TGT server, the TGT server processes the SCSI instructions, and returns the processing results to the client.

[0119] Multi-task initialization, when the TGT server is started, creates configuration management, iSCSI login and other task queues and corresponding threads, when the user creates a target through the command line, creates an iSCSI target task queue and a SCSI task queue for the target. The present invention optimizes and improves TGT task processing on the existing basis to improve IO performance.

[0120] Reference Figure 3 , shows a schematic diagram of a multi-task queue processing flow of a resource access method of a distributed storage system provided by an embodiment of the invention.

[0121] In the first step, the server discovers TGT (server), sends a connection message to the server to establish a connection, and the iSCSI (Internet Small Computer System Interface) thread starts processing. The server responds to the connection and starts iSCSI (Internet Small Computer System Interface) communication. The server sends the target (target resource) directory created by TGT to the client. After receiving the target directory, the client sends a login message to the server, specifies the target task and logs in to the TGT service.

[0122] In the second step, the iSCSI target (target resource Internet Small Computer System Interface) thread is mainly used for itask (login task queue) queue processing. Tasks are processed according to the message type. If the task involves SCSI message processing, the task needs to be removed from the itask queue after the iSCSI processing is completed, and the SCSI message task is added to the task queue (SCSI small computer system interface task queue). If the task does not involve SCSI message processing, the processing result can be sent directly to the client after processing is completed. There is no need to put it in the finish (finish task) queue. The task is removed from the itask queue and the resources are released.

[0123] In the third step, the SCSI (Small Computer System Interface) thread is used to traverse the task queue. It is in a dormant state when idle. When there is a task in the task queue, it wakes up and processes the SCSI task. The SCSI task includes operations such as querying, reading and writing resources. The query task and other tasks that do not require reading and writing are directly processed. After completion, the task is removed from the task queue and the result is sent to the client to release the task resources. For tasks involving reading and writing, since they need to wait for the distributed system to complete the processing, the task needs to be moved to the finish queue. After the processing is completed, the SCSI thread is woken up, the finish queue is traversed, and the results of the completed reading and writing tasks are sent to the client. The task is removed from the finish queue to release resources.

[0124] In the fourth step, when the iSCSI thread receives a client logout or connection interruption, it traverses the itask queue and task queue tasks, removes pending tasks to release resources, and repeats the above second step when the client logs in again and reconnects.

[0125] The embodiment of the present invention provides a TGT-based iSCSI high-performance processing method and device, which improves the iSCSI access speed by implementing TGT multi-task processing and solves the problems of slow TGT single task processing and long task waiting time.

[0126] Reference Figure 4 , shows a structural block diagram of a resource access device of a distributed storage system provided by an embodiment of the present invention, the device comprising:

[0127] A thread creation module 401 is used for the server to create multiple task queues and threads corresponding to the multiple task queues after establishing a connection with the client;

[0128] The message receiving module 402 is used to receive a plurality of messages sent by the client in the process of accessing the target resource of the server;

[0129] The task adding module 403 is used to generate corresponding tasks for the multiple messages respectively, and add the tasks to the corresponding task queue;

[0130] The task processing module 404 is used to process the tasks in the task queue through the thread corresponding to the task queue to complete the client's access to the target resource of the server.

[0131] The embodiment of the present invention provides a resource access method of a distributed storage system, wherein the distributed storage system includes a server and a client. After the server establishes a connection with the client, it creates multiple task queues and corresponding threads; receives multiple messages sent by the client in the process of accessing the target resources of the server; generates corresponding tasks for the multiple messages respectively; determines the task information of the task, and adds the task to the corresponding task queue according to the task information; processes the tasks in the task queue through the thread corresponding to the task queue to complete the client's access to the target resources of the server. By dividing the tasks according to the type and assigning them to different threads for processing, the mutual interference between tasks can be minimized and the overall performance of the system can be improved.

[0132] In one embodiment of the present invention, the task adding module includes:

[0133] A task type determination submodule, used to determine the task type of the task;

[0134] The first task adding submodule is used to add the task to a task queue corresponding to the task type of the task.

[0135] In one embodiment of the present invention, the task adding module further includes:

[0136] A task phase determination submodule, used for determining a current task phase of the task when the task includes multiple task phases;

[0137] The second task adding submodule is used to add the task to the task queue corresponding to the current task stage of the task.

[0138] In one embodiment of the present invention, the task adding module further includes:

[0139] A target resource determination submodule, used to determine the target resource targeted by the task according to the task information of the task;

[0140] The third task adding submodule is used to add the task to the task queue corresponding to the target resource.

[0141] In one embodiment of the present invention, the task adding module further includes:

[0142] A discovery task adding submodule is used to generate a discovery task when receiving a discovery message sent by the client, and add the discovery task to a corresponding task queue; the discovery task is used to obtain a resource directory of the server;

[0143] A login task generation submodule is used to generate a login task when receiving a login message sent by the client, and add the login task to a corresponding task queue; the login message is sent by the client after selecting a target resource from the resource directory; the login task is used to request permission for the client to access the target resource;

[0144] An access task generation submodule, for generating an access task upon receiving an access message sent by the client for the target resource, and adding the access task to a corresponding task queue; the access task is used to access the target resource;

[0145] The task processing module comprises:

[0146] A discovery task processing submodule, used for processing the discovery task through a thread corresponding to the task queue where the discovery task is located to send a resource directory to the client;

[0147] A login task processing submodule, used for processing the login task through a thread corresponding to the task queue where the login task is located to allow the client to access the target resource;

[0148] The access task processing submodule is used to process the access task to access the target resource through the thread corresponding to the task queue where the access task is located.

[0149] In one embodiment of the present invention, the device further comprises:

[0150] The task removal or addition submodule is used to remove the task from the task queue or add the task to the completion queue after the thread corresponding to the task queue obtains the task from the task queue, and remove the task from the completion queue after the thread completes the task.

[0151] In one embodiment of the present invention, the device further comprises:

[0152] The connection establishment submodule is used to establish a connection with the client after receiving a connection message sent by the client.

[0153] The present invention introduces a resource access method for a distributed storage system. The distributed storage system includes a server and a client. After the server establishes a connection with the client, it creates multiple task queues and corresponding threads; receives multiple messages sent by the client in the process of accessing the target resources of the server; generates corresponding tasks for the multiple messages respectively; determines the task information of the task, and adds the task to the corresponding task queue according to the task information; processes the tasks in the task queue through the thread corresponding to the task queue to complete the client's access to the target resources of the server. By creating multiple task queues, the task queues are assigned to different threads for processing according to the different stages of the tasks, thereby achieving the effect of high concurrency and asynchronous processing. At the same time, different task threads are divided according to the different stages of the tasks, and the client connecting to the same task is assigned to the same thread for processing, thereby reducing resource competition between threads, achieving lock-free processing, and improving read and write performance.

[0154] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0155] like Figure 5 , showing a structural block diagram of an electronic device 50 provided in an embodiment of the present invention, including:

[0156] A processor 501, a memory 502, and a computer program 5021 stored in the memory 502 and capable of running on the processor 501. When the computer program 5021 is executed by the processor 501, each process of the resource access method of the above-mentioned distributed storage system is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0157] like Figure 6 , showing a structural block diagram of a computer-readable storage medium 60 provided in an embodiment of the present invention, a computer program 601 is stored on the computer-readable storage medium 60, and when the computer program 601 is executed by the processor, each process of the resource access method embodiment of the above-mentioned distributed storage system is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0158] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0159] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0160] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0161] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0162] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0163] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0164] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0165] The resource access method, device, equipment and storage medium of a distributed storage system provided by the present invention are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A resource access method for a distributed storage system, characterized in that: The distributed storage system includes a server and a client, and the method includes: After establishing a connection with the client, the server creates a plurality of task queues and threads corresponding to the plurality of task queues; receiving a plurality of messages sent by the client in the process of accessing a target resource of the server; Generate corresponding tasks for the multiple messages respectively, and add the tasks to the corresponding task queue; process the tasks in the task queue through the thread corresponding to the task queue to complete the client's access to the target resource of the server.

2. The method according to claim 1, characterized in that: The generating corresponding tasks for the plurality of messages respectively and adding the tasks to the corresponding task queues includes: determining a task type for the task; The task is added to a task queue corresponding to the task type of the task.

3. The method according to claim 1, characterized in that The generating corresponding tasks for the plurality of messages respectively and adding the tasks to the corresponding task queues includes: When the task includes multiple task stages, determining a current task stage of the task; The task is added to a task queue corresponding to the current task stage of the task.

4. The method according to claim 1, characterized in that The generating corresponding tasks for the plurality of messages respectively and adding the tasks to the corresponding task queues includes: Identify the target resources for the task; Add the task to the task queue corresponding to the target resource.

5. The method according to claim 1, characterized in that The generating corresponding tasks for the plurality of messages respectively and adding the tasks to the corresponding task queues includes: When receiving the discovery message sent by the client, generating a discovery task and adding the discovery task to the corresponding task queue; the discovery task is used to obtain the resource directory of the server; When receiving a login message sent by the client, a login task is generated and the login task is added to the corresponding task queue; the login message is sent by the client after selecting a target resource from the resource directory; the login task is used to request that the client be allowed to access the target resource; When receiving an access message for the target resource sent by the client, generating an access task and adding the access task to a corresponding task queue; the access task is used to access the target resource; The processing of the tasks in the task queue by the thread corresponding to the task queue includes: processing the discovery task by the thread corresponding to the task queue where the discovery task is located to send a resource directory to the client; Processing the login task through a thread corresponding to the task queue where the login task is located to allow the client to access the target resource; The access task is processed by a thread corresponding to the task queue where the access task is located to access the target resource.

6. The method according to claim 1, characterized in that Also includes: When the thread corresponding to the task queue obtains a task from the task queue, the task is removed from the task queue, or the task is added to the completion queue, and after the thread completes processing the task, the task is removed from the completion queue.

7. The method according to claim 1, characterized in that Also includes: After receiving the connection message sent by the client, a connection is established with the client.

8. A resource access device for a distributed storage system, characterized in that: The distributed storage system includes a server and a client, and the device includes: A thread creation module, used for the server to create multiple task queues and threads corresponding to the multiple task queues after establishing a connection with the client; A message receiving module, used for receiving a plurality of messages sent by the client in the process of accessing the target resource of the server; A task adding module, used for generating corresponding tasks for the plurality of messages respectively, and adding the tasks to the corresponding task queue; The task processing module is used to process the tasks in the task queue through the thread corresponding to the task queue to complete the client's access to the target resource of the server.

9. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the resource access method of the distributed storage system as described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the resource access method of the distributed storage system according to any one of claims 1 to 7 are implemented.