[Linux] server performance tuning (CPU binding)

Source: Internet
Author: User
We all know that single process and asynchronous IO should be able to achieve optimal communication performance. But in reality, we often find that this model often fails to achieve the expected results. This may be because the NIC is competing for CPU with your application. Cat/proc/interrupts check the number of interruptions to your network card, where the CP is...

 

We all know that single process and asynchronous IO should be able to achieve optimal communication performance. But in reality, we often find that this model often fails to achieve the expected results.

 

This may be because the NIC is competing for CPU with your application.

 

 

 

Cat/proc/interrupts check the number of interruptions to your Nic. which CPU does it work on? Generally, your Nic should work on CPU0. (If not, bind it to CPU0)

 

Cat/proc/cpuinfo check how many CPUs you have and how many cores are there. Assume that it is a dual-CPU * quad-core.

 

Ps x | grep your_app to check the pid of your program. Assume that pid is 5678.

 

 

 

OK. try the following Magic:

 

Taskset-p 10 5678

 

 

 

If your program is single-thread asynchronous io, you may find that your program's processing capability has increased by more than 30%. In addition, the performance data of the program will not float any more and will always be stable at the optimal value.

 

 

 

Why? Because we distribute the NIC and application load to different physical CPUs. If you do not switch between regions, there is no operation cost.

 

 

 

Ps: redis, memcached, and nginx are popular on the Earth recently. they are all asynchronous io. you can try this optimization method.

 

Author 21 aspnet

Related Article

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.