Nginx Download Service Production server tuning

Source: Internet
Author: User

First, memory tuning

The kernel's options for memory are in the/PROC/SYS/VM directory.

1.pdflush, used to write back the dirty data in memory to the hard disk. Can be adjusted by/proc/sys/vm/vm.dirty_background_ratio.

The first view of this value should be 10 by default.

[Root@esf ~]# Cat/proc/sys/vm/dirty_background_ratio

10

This value is a threshold indicating that if the dirty data in memory reaches 10% of the total memory of the system, then the Pdflush process starts, and the dirty data in memory is written back to the hard disk. This value can be adjusted to the correct height. Faster write speeds are available.

2.swappiness Options

[Root@esf ~]# cat/proc/sys/vm/swappiness

60

Swappiness represents the use of the swap partition, and the appropriate adjustment of the swappiness=0 means that the physical memory swap space can be used as much as possible. SWAPPINESS=100 actively uses swap.

3.dirty_ratio

[Root@esf ~]# Cat/proc/sys/vm/dirty_ratio

40

The value of the dirty_ratio is the threshold that data is written into memory, 40% means that when the system memory has already cached 40% of the data, it is no longer cached in memory.

Two, disk I/O tuning

Linux disk I/O tuning

i), overview

1. Disk Tuning directory:/sys/block

2. Disk tuning is the tuning kernel parameters, the requirement to install Kernel-doc package,

3. The amount of pre-read request (default is 128KB)

# Blockdev--GETRA/DEV/SDA

# Blockdev--setra 512/DEV/SDA

actually modify the/sys/block/sda/queue/read_ahead_kb=256kb; If you read more, turn this argument up a little bit, such as write request read, turn this argument down

4. Disk Queue: Queue Length processing fast, increase the throughput of the hard drive, but will consume more memory

Queue length:/sys/block/sda/queue/nr_requests

# cat/sys/block/sda/queue/nr_requests

512

#默认128, no units

Two, 4 kinds of scheduling algorithms for disk I/O

1. CFQ (fully fair queuing I/O scheduler) (ELEVATOR=CFQ)

Characteristics:

This is the default algorithm, which is usually the best choice for a general-purpose server. It attempts to evenly distribute access to I/O bandwidth. is a compromise between the deadline and the anticipatory scheduler.

CFQ is the best choice for multimedia applications (Video,audio) and desktop systems.

CFQ gives I/O requests a priority, and I/O priority requests are independent of the process priority, and the read-write of high-priority processes does not automatically inherit high I/O priorities.

CFQ a queue based on a 64-bit queue request, using a polling method.

Tuning Parameters:

#/sys/block/sda/queue/iosched/queued: Maximum number of requests per process at poll

#/sys/block/sda/queue/iosched/quantum: Poll every number of requests

CFQ Tuning Tool Ionice

Ionice can change the type and priority of a task, but only the CFQ scheduler can use Ionice.

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.