Performance Optimization aims to improve performance and reduce the impact of resource consumption and applications on the system. If it is implemented prematurely or without performance evaluation, performance optimization may or must lead to the opposite effect. However, if the system is implemented, performance optimization can be a science and an art. First, we can find out what is & ldquo; normal & rdquo. Find potential performance problems, adjust performance parameters to fix problems, and monitor system performance after adjustment to determine whether to retain changes or roll back. Conclusion: Enabling and optimizing the collection of data establishment baselines,
Performance Optimization aims to improve performance and reduce the impact of resource consumption and applications on the system. If it is implemented prematurely or without performance evaluation, performance optimization may or must lead to the opposite effect.
However, if the system is implemented, performance optimization can be a science and an art.
Method
First, find out what is "normal.
Find potential performance problems, adjust performance parameters to fix problems, and monitor system performance after adjustment to determine whether to retain changes or roll back.
Summary:
- Collect data to establish a baseline
- Enable optimization and select appropriate default values
- Check the chart. Is our optimization correct? Submit or roll back
- Identify potential performance problems
- Adjust optimization parameters
- Back to 3
Indicators before and after a benchmark is established before and before the start
For Specific metrics, by using the stress testing program, you can quickly establish a baseline to measure previous and subsequent changes. See the example of the early sysadvent calendar test in Stress testing with Apache JMeter.
Historical Indicators
You already have historical metrics. You can use charts to monitor historical resources. Even in the age of automated analysis, the old Mk1 Eyeballis still very useful. What you need is a chart, not a screen number.
(You can also show your boss a beautiful chart. If your boss goes to work, what are you doing .)
You should view the service usage and response time in a graphical manner. For web servers, the metric should be the number of requests, the time each request responds, and the size of each response message.
For apache and nginx, see daily logging in apache and nginx. This article describes how to record necessary quantitative indicator data logs.
You should describe the resource usage, queue, and response time in a graphical manner. This often means a resource map for disk and network I/O. Graphically describe the number of requests per second, as well as the request-response latency.
Tools for graphical display
I personally like to use Munin. This tool can be found in the EPEL repository. This tool is definitely an old-fashioned tool, but it is very easy to use, and it also has a wealth of plug-ins for use. When you install and use Munin, many graphical tools are installed by default. If you need more graphical plug-ins, you can find them on the contrib repository.
For some more advanced monitoring tools, Elasticsearch, Logstash, and Kibana are more popular in log analysis and visualization. Set ELK to load the data to be monitored, use Topbeat as the resource usage measurement standard, use Filebeat as the real-time Log File Analysis, and use Packetbeat to analyze online network data.
There are many optional tools, such as what you know, what you like, or what you want to learn. The most important thing you need to remember is to make sure that you know your benchmark data before you start the modification operation.
Performance Tuning Tool
Tuna
Tuna can be used to control processes and their scheduling relationships.
For example, a healthy system has poor network performance, and several processing cores are in idle state. Check the NIC and find that the multi-Job Scheduling queue function is enabled, and they are distributed across all available processing cores.
Assume that these NICs are named "enp1s0f0" and "enp1s0f1":
[Root @ linuxidc ~] # Tuna -- irq 'enp1s0f * '-- socket 0 -- spread -- show_irqs
# Users affinity
69 enp1s0f0 0 igb
70 enp1s0f0-rx-0 1 igb
71 enp1s0f0-rx-1 2 igb
72 enp1s0f0-rx-2 3 igb
73 enp1s0f0-rx-3 4 igb
74 enp1s0f0-tx-0 5 igb
75 enp1s0f0-tx-1 6 igb
76 enp1s0f0-tx-2 7 igb
77 enp1s0f0-tx-3 0 igb
79 enp1s0f1 1 igb
80 enp1s0f1-rx-0 2 igb
81 enp1s0f1-rx-1 3 igb
82 enp1s0f1-rx-2 4 igb
83 enp1s0f1-rx-3 5 igb
84 enp1s0f1-tx-0 6 igb
85 enp1s0f1-tx-1 7 igb
86 enp1s0f1-tx-2 0 igb
87 enp1s0f1-tx-3 1 igb
For systems with multiple interfaces, you can move your favorite processes to a specific interface and move network management to another interface.
Tuned
The Tuned tool is available in multiple Red Hat releases.
Tuned comes with a variety of tuning preset configurations; it is used for reasonable default configurations of various general-purpose servers. Used for "virtual user" configuration, for "virtual host" configuration, and for "high throughput" or "low latency" preset configuration. They should provide initial configuration for further applications. For example
[Root @ linuxidc ~] # Tuned-adm list
-Balanced
-Desktop
-Latency-performance
-Network-latency
-Network-throughput
-Powersave
-Throughput-performance
-Virtual-guest
-Virtual-host
Current active profile: throughput-performance
Different default configurations have sound documentation, and if you want to customize them, there are initial configuration files available for use.
The default configuration on the physical machine is "throughput-performance" or "balanced", and the default configuration on the virtual machine is "virtual-guest".
The default configuration of tuned is in the/usr/lib/tuned directory.
[Root @ linuxidc ~] # Tree/usr/lib/tuned
/Usr/lib/tuned
| -- Balanced
| '-- Tuned. conf
| -- Desktop
| '-- Tuned. conf
| -- Functions
| -- Latency-performance
| '-- Tuned. conf
| -- Network-latency
| '-- Tuned. conf
| -- Network-throughput
| '-- Tuned. conf
| -- Powersave
| -- Script. sh
| '-- Tuned. conf
| -- Recommend. conf
| -- Throughput-performance
| '-- Tuned. conf
| -- Virtual-guest
| '-- Tuned. conf
'-- Virtual-host
'-- Tuned. conf
Each configuration includes a tuned. conf file with the INI file semantic format and an optional script interpreter.
If you want to generate a custom configuration file, you can copy one of these directories to the/etc/tuned directory, make necessary modifications, and activate and use them.
[Root @ linuxidc ~] # Cp-a/usr/lib/tuned/throughput-performance/etc/tuned/wonderprofile
[Root @ linuxidc ~] # Vim/etc/tuned/wonderprofile/tuned. conf
[Root @ linuxidc ~] # Tuned-adm profile wonderprofile
For example, in the/etc/tuned/wonderprofile/tuned. conf file, make a few adjustments to it.
[Main]
Include = throughput-performance
[Sysctl]
Net. ipv4.tcp _ rmem = "4096 87380 16777216"
Net. ipv4.tcp _ wmem = "4096 16384 16777216"
Net. ipv4.udp _ mem = "3145728 4194304 16777216"
Also adjust/etc/tuned/wonderprofile/script. sh.
#! /Bin/sh
# Lots of functions in here to use
./Usr/lib/tuned/functions
Start (){
["$ USB_AUTOSUSPEND" = 1] & enable_usb_autosuspend
Enable_wifi_powersave
Return 0
}
Stop (){
["$ USB_AUTOSUSPEND" = 1] & disable_usb_autosuspend
Disable_wifi_powersave
Return 0
}
Process $ @
Additional reading
I just mentioned a few System Administrator tools. Red Hat has a wide range of documents showing how to tune and measure (or in other ways), using more tools than I have mentioned.
For Power Management, for example, your laptop can be used during working hours even if you forget to recharge your laptop at home, see Red Hat Enterprise Linux 7 Power Management Guide.
For Performance Tuning, to make your expensive server more dynamic, see Red Hat Enterprise Linux 7 Performance Tuning Guide.
RedHat Performance Tuning
For more information about RedHat, see RedHat topic page http://www.linuxidc.com/topicnews.aspx? Tid = 10
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-12/126864.htm