Linux Server-hardware (1)

Source: Internet
Author: User

BKJIA exclusive Article] This article is the first in the series of "your Linux Server clearly. The purpose of this article is because I often want to engage in related system work in customers' data centers or hosted IDCs, with a dozen or more machines and hundreds of machines. Through the following content, you should be clear about the status and performance of your current Linux server.

I. How to view the server's CPU

Today, nine Linux servers are installed, and the models are completely different from those of DELL, HP, and IBM servers.) I am too lazy to check the list. How can I calculate the number of CPUs and cores in Linux? In addition, the nginx cpu working mode also needs to know exactly how many logical CPUs are available on the linux server, but now the server is quite tough, simply go to worker_processes 8.

Judgment basis:

1. The cpu with the same core id is hyper-threading of the same core. Physical id and core id are not necessarily consecutive but they are unique. Any cpu with the same core id are hyperthreads in the same core .)

2. A cpu with the same physical id is a thread or cores encapsulated by the same cpu. Any cpu with the same physical id are threads or cores in the same physical socket .)

Take your own HP dlw.g6 as an example:

① Number of physical CPUs:

[root@localhost ~]# cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l

② Number of cores in each physical cpu (I .e. number of cores)

[root@localhost ~]# cat /proc/cpuinfo | grep "cpu cores" | uniqcpu cores : 4

In this way, the logic CPU of your server can be calculated as the number of physical cores *. If your server is server2003, you can view the number of logical CPUs graphically in your resource manager.

Ii. view the server memory

Sometimes, you run many large processes, for example, you have enabled 300 fast-cgi. When you feel the system is slow, you need to check the memory of the server:

[root@server ~]# free -mtotal used free shared buffers cachedMem: 249 163 86 0 10 94-/+ buffers/cache: 58 191Swap: 511 0 511

Parameter description:

Total memory used memory free idle memory shared by multiple processes total Cache buffers Buffer Cache and cached Page cache disk Cache size-buffers/Cache (used) memory size: used-buffers-cached + buffers/cache (available) memory size: free + buffers + cached available memory = free memory + buffers + cached

The above value is a DELL PE2850 server with 2 GB memory for PHP developers in our company's intranet. Its memory usage is 217 + 515 + 826. Remember, the memory usage management mechanism in Linux is used as much as possible (especially after files are frequently accessed), that is, the Linux memory is used instead of available.

Recommended for editing: Linux memory monitoring full explanation: free command

Iii. server disk usage

The following command can be used to view the disk usage sometimes when the hard disk is slow or you need to view the partition where the log is located:

① View Hard Disk Partitions

fdisk –l

② View the current hard disk usage

df –h

③ View hard disk Performance

# iostat -x 1 10Linux 2.6.18-92.el5xen 03/01/2010avg-cpu:   %user %nice %system %iowait   %steal %idle          1.10 0.00 4.82 39.54 0.07 54.46Device:       rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await   svctm   %utilsda          0.00     3.50   0.40   2.50     5.60     48.00   18.48     0.00 0.97 0.97 0.28sdb          0.00     0.00   0.00   0.00     0.00     0.00     0.00     0.00 0.00 0.00 0.00sdc          0.00     0.00   0.00   0.00     0.00     0.00     0.00     0.00 0.00 0.00 0.00sdd          0.00     0.00   0.00   0.00     0.00     0.00     0.00     0.00 0.00 0.00 0.00sde          0.00     0.10   0.30   0.20     2.40     2.40     9.60     0.00 1.60 1.60 0.08sdf          17.40     0.50 102.00   0.20 12095.20    5.60   118.40     0.70 6.81 2.09  21.36sdg          232.40    1.90 379.70   0.50 76451.20   19.20   201.13     4.94 13.78 2.45 93.16

Developers like our company account for the majority. Sometimes, in order to save costs, you will also purchase some second-hand servers with relatively high cost performance. In this case, you generally set the hardware working mode of the server to RAID1, at the same time, write the same file to several types of servers, and then perform iostat-d for comparative testing. In this way, the server's hard disk performance is superior and inferior, and can be compared at once.

Illustration:

Tps (I/O requests per second)

The Blk_read/s table calculates the number of data blocks read from the device per second.

Blk_wrth/s indicates the number of data blocks written from the device per second

Recommended for editing: disk I/O for Linux System Monitoring


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.