Method, device and medium for optimizing CIFS (common information File System) network bandwidth

文档序号:1589721 发布日期:2020-01-03 浏览:14次 中文

阅读说明:本技术 一种cifs网络带宽的优化方法、装置和介质 (Method, device and medium for optimizing CIFS (common information File System) network bandwidth ) 是由 戚勇 吕玉彬 李佩 于 2019-09-05 设计创作,主要内容包括:本发明公开了一种CIFS网络带宽的优化方法、装置和介质,其中,该方法包括:当客户端与服务端连接时,启动通道链路并建立多个通道;为每个通道建立对应通道线程以用于处理通道的网络IO请求;通过通道和对应通道线程进行数据传输。本发明通过建立多个通道的方式提高了数据从客户端到服务端的smbd服务进程的传输效率,通过为每个通道建立对应的通道线程,提高了各通道处理网络IO请求的效率,把从客户端到服务端的smbd服务进程的数据传输过程由单通道单进程变成了多通道多进程,提升了文件传输的性能和效率。(The invention discloses a method, a device and a medium for optimizing CIFS network bandwidth, wherein the method comprises the following steps: when the client is connected with the server, starting a channel link and establishing a plurality of channels; establishing a corresponding channel thread for each channel for processing a network IO request of the channel; and carrying out data transmission through the channel and the corresponding channel thread. The invention improves the transmission efficiency of the smbd service process from the client to the server by establishing a plurality of channels, improves the efficiency of each channel for processing the network IO request by establishing a corresponding channel thread for each channel, changes the data transmission process of the smbd service process from the client to the server from a single channel to a multi-channel multi-process, and improves the performance and efficiency of file transmission.)

1. A method for optimizing CIFS network bandwidth is characterized by comprising the following steps:

when the client is connected with the server, starting a channel link and establishing a plurality of channels;

establishing a corresponding channel thread for each channel for processing the network IO request of the channel;

and carrying out data transmission through the channel and the corresponding channel thread.

2. The method for optimizing CIFS network bandwidth as claimed in claim 1, further comprising:

and when the channel thread receives a non-network IO request, forwarding the non-network IO request to a main thread.

3. The method for optimizing CIFS network bandwidth as claimed in claim 1, further comprising:

and when the data transmission is abnormal, destroying the corresponding channel thread.

4. The method for optimizing the bandwidth of the CIFS network according to claim 1, wherein the data transmission through the channel and the corresponding channel thread specifically comprises:

transmitting the numbered data through the channel and the corresponding channel thread.

5. The method for optimizing CIFS network bandwidth as claimed in claim 1, further comprising:

and after each channel thread receives the data, numbering the data in sequence in a mode with the channel information and applying for a corresponding memory father node.

6. The method for optimizing CIFS network bandwidth as claimed in claim 1, further comprising:

and controlling the channel thread to access the TDB database according to a mutually exclusive mode.

7. The method for optimizing CIFS network bandwidth as claimed in claim 1, further comprising:

when the channel thread operates the log, controlling a log function to execute locking operation;

and when the channel thread finishes the operation on the log, controlling the log function to execute a lock releasing operation.

8. An apparatus for optimizing CIFS network bandwidth, comprising:

the starting module is used for starting a channel link and establishing a plurality of channels when the client is connected with the server;

the thread establishing module is used for establishing a corresponding channel thread for each channel so as to process the network IO request of the channel;

and the transmission module is used for transmitting data through the channel and the corresponding channel thread.

9. An apparatus for optimizing CIFS network bandwidth, comprising a memory for storing a computer program;

processor for implementing the steps of the method for optimizing a CIFS network bandwidth according to any of claims 1 to 7 when executing said computer program.

10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the method for optimizing the bandwidth of a CIFS network according to any of the claims 1 to 7.

Technical Field

The invention relates to the field of computers, in particular to a method, a device and a medium for optimizing CIFS (common information File System) network bandwidth.

Background

With the development of networks, the application of the common Internet file system (CIFS protocol) to transfer data is increasingly applied to wide area networks by enterprises.

The working mode of the existing CIFS transmission protocol is shown in FIG. 1, data interaction is realized between a client and an smbd service process of a server through a single channel and a single process, and a multi-process mode is adopted from the smbd service process to the falling of a file system. The performance and efficiency of file transmission are limited by adopting a single-channel single-process mode to carry out data transmission from the client to the smbd service process of the server.

Disclosure of Invention

The invention aims to provide a method, a device and a medium for optimizing CIFS (common information File System) network bandwidth, which are used for realizing data transmission by establishing a plurality of channels and channel threads corresponding to the channels when a client is connected with a server, so that the performance and the efficiency of file transmission are improved.

In order to achieve the above object, the present invention provides a method for optimizing a CIFS network bandwidth, comprising:

when the client is connected with the server, starting a channel link and establishing a plurality of channels;

establishing a corresponding channel thread for each channel for processing the network IO request of the channel;

and carrying out data transmission through the channel and the corresponding channel thread.

Preferably, the method further comprises the following steps:

and when the channel thread receives a non-network IO request, forwarding the non-network IO request to a main thread.

Preferably, the method further comprises the following steps:

and when the data transmission is abnormal, destroying the corresponding channel thread.

Preferably, the data transmission through the channel and the corresponding channel thread specifically includes:

transmitting the numbered data through the channel and the corresponding channel thread.

Preferably, the method further comprises the following steps:

and after each channel thread receives the data, numbering the data in sequence in a mode with the channel information and applying for a corresponding memory father node.

Preferably, the method further comprises the following steps:

and controlling the channel thread to access the TDB database according to a mutually exclusive mode.

Preferably, the method further comprises the following steps:

when the channel thread operates the log, controlling a log function to execute locking operation;

and when the channel thread finishes the operation on the log, controlling the log function to execute a lock releasing operation.

In order to achieve the above object, the present invention further provides an apparatus for optimizing a CIFS network bandwidth, including:

the starting module is used for starting a channel link and establishing a plurality of channels when the client is connected with the server;

the thread establishing module is used for establishing a corresponding channel thread for each channel so as to process the network IO request of the channel;

and the transmission module is used for transmitting data through the channel and the corresponding channel thread.

In order to achieve the above object, the present invention further provides an apparatus for optimizing a CIFS network bandwidth, including:

a memory for storing a computer program;

a processor, configured to implement the steps of the CIFS network bandwidth optimization method according to any one of the above embodiments when executing the computer program.

To achieve the above object, the present invention further provides a computer-readable storage medium, having a computer program stored thereon, where the computer program is executed by a processor to implement the steps of the method for optimizing a CIFS network bandwidth according to any one of the above aspects.

The method for optimizing the CIFS network bandwidth provided by the invention comprises the following steps: when the client is connected with the server, the server starts a channel link and establishes a plurality of channels, and a corresponding channel thread is established for each channel to process the network IO request of the channel. And carrying out data transmission through the channel and the corresponding channel thread. The invention improves the transmission efficiency of the smbd service process from the client to the server by establishing a plurality of channels. By establishing the corresponding channel thread for each channel, the efficiency of processing the network IO request by each channel is improved, the data transmission process from the client to the smbd service process of the server is changed from a single channel and a single process into a multi-channel and multi-process, and the performance and the efficiency of file transmission are improved.

The device and the medium for optimizing the CIFS network bandwidth, provided by the invention, also have the same beneficial effects as the method for optimizing the CIFS network bandwidth, and are not described herein again.

Drawings

In order to illustrate the embodiments of the present invention more clearly, the drawings that are needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings can be obtained by those skilled in the art without inventive effort.

Fig. 1 is a schematic diagram of CIFS transmission data according to an embodiment of the present invention;

fig. 2 is a flowchart of a method for optimizing a CIFS network bandwidth according to an embodiment of the present invention;

fig. 3 is a structural diagram of an apparatus for optimizing a CIFS network bandwidth according to an embodiment of the present invention;

fig. 4 is a structural diagram of another apparatus for optimizing a CIFS network bandwidth according to an embodiment of the present invention.

Detailed Description

The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without any creative work belong to the protection scope of the present invention.

The core of the invention is to provide a method, a device and a medium for optimizing CIFS network bandwidth, when a client is connected with a server, data transmission is realized by establishing a plurality of channels and channel threads corresponding to the channels, so that the performance and the efficiency of file transmission are improved.

In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments.

Fig. 2 is a flowchart of a method for optimizing a CIFS network bandwidth according to an embodiment of the present invention, and as shown in fig. 2, the method for optimizing the CIFS network bandwidth includes:

s10: when the client is connected with the server, a channel link is started and a plurality of channels are established.

S20: and establishing a corresponding channel thread for each channel for processing the network IO request of the channel.

S30: and carrying out data transmission through the channel and the corresponding channel thread.

It should be noted that the execution subject of the present embodiment is a controller of the server. For step S10, the server initializes the channels, monitors the ports, waits for the connection of the client, and when the client connects to the server, the server starts a channel link and establishes multiple channels according to the actual requirements of the user for transmitting data from the client to the server. It should be noted that the data transmitted by the multiple channels are combined together to be the same as the data transmitted by the original channel.

For step S20, the server establishes a corresponding channel thread for each channel for processing the network IO request of the channel. It should be noted that the network IO request specifically refers to a read/write request. The code to establish the channel thread is as follows:

smbXsrv_client_connection_pass_loop

pthread_create(xx,smbd_channel_thread,xx)。

for step S30, after the channel and the corresponding channel thread are established, data can be transmitted for the client and the server. The specific implementation scenario is that a server initializes a channel, monitors a port, waits for connection of a client, starts a channel link and establishes 3 channels according to actual bandwidth requirements of a user and the size of data to be sent by the client when the client is connected with the server, the server establishes a corresponding channel thread for each channel, the data to be sent by the client is divided into 3 blocks and sent to the corresponding channels, the channel threads process network IO of the corresponding channels, and the server receives the data sent by the client.

The method for optimizing the CIFS network bandwidth provided by the invention comprises the following steps: when the client is connected with the server, the server starts a channel link and establishes a plurality of channels, and a corresponding channel thread is established for each channel to process the network IO request of the channel. And carrying out data transmission through the channel and the corresponding channel thread. The invention improves the transmission efficiency of the smbd service process from the client to the server by establishing a plurality of channels. By establishing the corresponding channel thread for each channel, the efficiency of processing the network IO request by each channel is improved, the data transmission process from the client to the smbd service process of the server is changed from a single channel and a single process into a multi-channel and multi-process, and the performance and the efficiency of file transmission are improved.

On the basis of the above embodiment, in another embodiment, when the channel thread receives the non-network IO request, the non-network IO request is forwarded to the main thread.

When the channel thread receives the non-network IO request, the non-network IO request is forwarded to the main thread, and it can be understood that the main thread processes the non-network IO request, returns a processing result to the channel thread, and sends the processing result to the corresponding client.

It should be noted that, when the client initializes the channel, the server establishes a main thread for processing a non-network IO request received by the channel thread, in addition to establishing a corresponding channel thread for each channel to process the network IO request of the channel. The non-network IO request of the present invention refers to a request other than a network IO request.

The method for forwarding the non-network IO request to the main thread provided by the embodiment reduces the modification of the single-threaded code in the prior art, and increases the stability of the system.

On the basis of the above embodiment, in another embodiment, when data transmission is abnormal, the corresponding channel thread is destroyed.

In the specific implementation, if the data transmission is abnormal for the individual channel, the resources of the channel with the abnormality are destroyed, that is, the resources such as the memory occupied by the abnormal channel are deleted, other channels can still work normally, and if the data transmission is abnormal for the main thread, the resources of all the channels are destroyed. The invention does not specifically define the data transmission exception, and the data transmission exception may be a data processing exception or other exception conditions such as channel disconnection.

The solution provided by the embodiment when the data transmission is abnormal enhances the robustness of the system, and avoids adverse consequences such as system lock-up caused by data abnormality.

Based on the above embodiment, in another embodiment, the numbered data is transferred through the channel and the corresponding channel thread.

It should be noted that the data with the number is that the client or the server divides the large block of data into small blocks of data and transmits the small blocks of data through each channel, and in order to facilitate the client or the server to restore the data, the client numbers the data transmitted by each channel and the corresponding channel thread. As a preferred embodiment, the number information is stored in the header of the small block data. For example, a client is connected with a server, 3 channels are established according to the bandwidth requirement of a user and the size of data transmitted by the client, corresponding channel threads are established for the 3 channels, the client divides the transmitted data into 3 data blocks, numbers the 3 data blocks, transmits the 3 numbered data blocks to the corresponding channels, the channel threads process the network IO requests of the channels, and the server restores the data according to the numbers of the data blocks.

The data transmitted with the number in the embodiment is beneficial to restoring the received data.

On the basis of the previous embodiment, in another embodiment, after each channel thread receives data, the data is sequentially numbered in a mode with channel information and a corresponding memory parent node is applied.

It should be noted that the application of the corresponding memory parent node is to apply for different memory parent nodes for different channel threads, so as to avoid simultaneous multi-thread updating of the same memory node. And after the server receives all the data transmitted by the client at this time, restoring the information transmitted by the client according to the sequence number of the channel information carried by the memory father node, and releasing the father node applied at this time.

In specific implementation, after receiving data, each channel thread sequentially numbers the data in a mode with channel information and applies for a memory parent node for the data according to the number so as to facilitate storage of the data.

In the embodiment, data are numbered in sequence in a way of carrying channel information and corresponding memory father nodes are applied, so that multithreading is avoided, the same memory node is updated at the same time, and the memory is safely accessed in a multithreading way.

On the basis of the previous embodiment, in another embodiment, the channel threads are controlled to access the TDB database in a mutually exclusive mode, that is, when one channel thread accesses the TDB database, other threads can only wait in a queue, and only after the thread accessing the TDB database leaves, the next channel thread is allowed to access the TDB database, so that only one channel thread accesses the TDB database at the same time, and thus, an access error caused by simultaneous access of multiple threads to the TDB database is avoided.

On the basis of the previous embodiment, in another embodiment, when the channel thread operates the log, the log function is controlled to perform locking operation, and when the channel thread finishes operating the log, the log function is controlled to perform unlocking operation, so that only one channel thread operates the log at the same time, and the problem that the log is operated by multiple threads at the same time and an error occurs is avoided. For example, when the channel thread a controls the log to print, the log function executes the locking operation, and makes other channel threads which want to operate the log wait until the channel thread a finishes the printing operation, the log function executes the unlocking operation, one of the other channel threads which want to operate the log executes the operation which wants to operate the log, and the log function executes the locking operation, and sequentially accesses the log according to the rule.

On the basis of the above detailed description of the embodiments corresponding to the CIFS network bandwidth optimization method, the present invention also discloses an apparatus for optimizing the CIFS network bandwidth corresponding to the above method.

Fig. 3 is a structural diagram of an apparatus for optimizing a CIFS network bandwidth according to an embodiment of the present invention, and as shown in fig. 3, the apparatus for optimizing a CIFS network bandwidth specifically includes:

a starting module 10, configured to start a channel link and establish multiple channels when a client initializes a channel;

a thread establishing module 20, configured to establish a corresponding channel thread for each channel to process a network IO request of the channel;

and the transmission module 30 is configured to perform data transmission through the channel and the corresponding channel thread.

Since the embodiment of the apparatus for optimizing a CIFS network bandwidth corresponds to the embodiment of the method, please refer to the description of the embodiment of the method, which is not repeated herein.

The device for optimizing the bandwidth of the CIFS network provided by the invention comprises the following components: when the client is connected with the server, the server starts a channel link and establishes a plurality of channels, and a corresponding channel thread is established for each channel to process the network IO request of the channel. And carrying out data transmission through the channel and the corresponding channel thread. The invention improves the transmission efficiency of the smbd service process from the client to the server by establishing a plurality of channels. By establishing the corresponding channel thread for each channel, the efficiency of processing the network IO request by each channel is improved, the data transmission process from the client to the smbd service process of the server is changed from a single channel and a single process into a multi-channel and multi-process, and the performance and the efficiency of file transmission are improved.

As a preferred embodiment, the method further comprises the following steps:

and the forwarding module is used for forwarding the non-network IO request to the main thread when the channel thread receives the non-network IO request.

As a preferred embodiment, the method further comprises the following steps:

and the destroying module is used for destroying the corresponding channel thread when the data transmission is abnormal.

As a preferred embodiment, the method further comprises the following steps:

and the application father node module is used for numbering the data in sequence in a way with channel information and applying for a corresponding memory father node after each channel thread receives the data.

As a preferred embodiment, the method further comprises the following steps:

and the mutual exclusion module is used for controlling the channel thread to access the TDB database according to a mutual exclusion mode.

As a preferred embodiment, the method further comprises the following steps:

the control module is used for controlling a log function to execute locking operation when the channel thread operates the log;

and when the channel thread finishes the operation on the log, controlling the log function to execute the lock releasing operation.

The invention also provides a device for optimizing the CIFS network bandwidth. Fig. 4 is a structural diagram of another apparatus for optimizing a CIFS network bandwidth according to an embodiment of the present invention, as shown in fig. 4, the apparatus includes:

a memory 40 for storing a computer program;

a processor 41, configured to execute the computer program to implement the steps of the method for optimizing a CIFS network bandwidth according to any of the above embodiments.

Processor 41 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so forth. The processor 41 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 41 may also include a main processor and a coprocessor, the main processor is a processor for processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 41 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, processor 41 may further include an AI (Artificial Intelligence) processor for processing computational operations related to machine learning.

Memory 40 may include one or more computer-readable storage media, which may be non-transitory. Memory 40 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 40 is at least used for storing a computer program 401, wherein after being loaded and executed by the processor 41, the computer program can implement relevant steps in the method for optimizing the bandwidth of a CIFS network disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 40 may also include an operating system 402, data 403, and the like, and the storage manner may be a transient storage or a permanent storage. Operating system 402 may be Windows, among others. The data 403 may include, but is not limited to, data involved in the above-described methods.

In some embodiments, the device for optimizing the bandwidth of the CIFS network may further include a display 42, an input/output interface 43, a communication interface 44, a power supply 45, and a communication bus 46.

Those skilled in the art will appreciate that the configuration shown in fig. 4 does not constitute a limitation of the means for optimizing the CIFS network bandwidth and may include more or fewer components than those shown.

The device for optimizing the CIFS network bandwidth provided by the embodiment of the application comprises a memory and a processor, and when the processor executes a program stored in the memory, the method for optimizing the CIFS network bandwidth can be realized, and the effect is the same as that of the method for optimizing the CIFS network bandwidth.

The present invention further provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the method for optimizing a CIFS network bandwidth according to any of the above embodiments.

It is to be understood that if the method in the above embodiments is implemented in the form of software functional units and sold or used as a stand-alone product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and performs all or part of the steps of the methods according to the embodiments of the present invention, or all or part of the technical solution. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.

The computer program contained in the computer-readable storage medium provided in this embodiment can implement the steps of the above-described CIFS network bandwidth optimization method when executed by a processor, and the effect is the same.

The above describes a method, an apparatus, and a medium for optimizing a CIFS network bandwidth provided by the present invention in detail. The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.

It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

10页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种资源匹配方法、装置、服务器及介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!