Architecture and optimization of NFS servers

Source: Internet
Author: User
Tags nfsd

When constructing the NFS service, we know that creating an NFS server requires a client and a server, and then the two can be connected for communication. Here we will take a look at the client and server settings, and then explain the optimization.

Specific operations and settings of the CLIENT and SERVER

Before talking about the operation of nfs server, let's look at some things related to nfs server:

RPCRemote Procedure Call)

NFS itself does not provide information transmission protocols and functions, but NFS allows us to share data over the network, because NFS uses some other transmission protocols. these Transport Protocol warriors use this RPC function. NFS itself is a program that uses RPC. or NFS is also an rpc server. therefore, you only need to start the RPC service wherever NFS is used, whether it is nfs server or nfs client. in this way, the SERVER and CLIENT can implement the corresponding program port through RPC. we can understand the relationship between RPC and NFS in this way: NFS is a file system, while RPC is responsible for information transmission.

DAEMONS to be started on the NFS server

Pc. nfsd: Mainly used for complex login permission detection.

Rpc. mountd: Responsible for the NFS file system. When the CLIENT logs on to the SERVER through rpc. nfsd, it manages the files accessed by clinet.

Nfs server requires two packages on the redhat linux platform: nfs-utils and PORTMAP.

Nfs-utils: provides two nfs daemons suites: rpc. nfsd and rpc. mountd.

Portmap: NFS can be regarded as an rpc server program. to start an rpc server program, you must do the corresponding work of the PORT, and such a task is completed by PORTMAP. in general, PortMap is used for PORT mapping.

NFS server Optimization

Optimization steps:

1. Measure the execution efficiency of the current network, server, and each client.

2. analyze collected data and draw charts to find out special situations, such as high disk and CPU usage and high disk usage time.

3. Adjust the server

4. Repeat steps 1 to 3 until you reach the desired performance.

There are many problems related to NFS performance. You can usually consider the following options:

The WSIZE and RSIZE parameters are used to optimize the NFS execution efficiency.

WSIZE and RSIZE have a great impact on NFS performance.

Wsize and rsize set the size of the data blocks between the SERVER and the CLIENT. The reasonable settings of these two parameters are related to many aspects, in addition to software, there are also hardware factors that will affect the setting of these two parameters, such as linux kernel, Nic, and switch ).

The following command can test the NFS execution efficiency. The read and write performance can be tested separately to find the appropriate parameters. you can write scripts to test the reading and writing of a large amount of scattered data. during each test, it is best to execute MOUNT and unmount again.

Time dd if =/dev/zero of =/mnt/home/testfile bs = 16 k count = 16384

The WSIZE used for testing. RSIZE is preferably a multiple of 1024. For NFS V2, 8192 is the maximum value of RSIZE and WSIZE. If NFS V3 is used, the maximum value you can try is 32768.

If the value is set to a large value, it is best to enter the directory on the mount on the CLIENT and perform some common operations such as LS and VI) to see if there is any error message. when LS is used, files cannot be fully listed or error messages may occur. different operating systems have different optimal values, therefore, different operating systems must be tested.

Set the maximum number of NFSD copies.

The number of NFSD copies in linux is in/etc/rc. d/init. d/nfs is set in the startup file. The default value is 8 NFSD. The setting of this parameter is generally based on the number of possible clients, similar to WSIZE and RSIZE, we also need to test the latest value.

UDP and TCP

You can set it manually or automatically.

Mount-t nfs-o sync, tcp, noatime, rsize = 1024, wsize = 1024 EXPORT_MACHINE:/EXPORTED_DIR/DIR

UDP provides fast transmission speed and non-connection transmission convenience. However, UDP is not stable over TCP during transmission, when the network is unstable or hackers intrude into the network, it is easy to greatly reduce the Performance of the NFS server or even paralyze the network. therefore, you must select the transmission protocol for networks in different situations. nfs over tcp is relatively stable, and nfs over udp is faster. when there are few machines with good network conditions, using UDP protocol can bring better performance. When there are many machines and the network conditions are complex, we recommend that you use TCP protocol V2 to only support UDP protocol ). it is better to use UDP protocol in the LAN because the LAN has stable network guarantee and UDP can provide better performance. We recommend that you use TCP protocol in the wide area network, TCP enables NFS to maintain optimal transmission stability in complex network environments. can refer to this article: http://www.hp.com.tw/ssn/unix/0212/unix021204.asp;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.