irqbalance 服务

来源:互联网 发布:直布罗陀 知乎 编辑:程序博客网 时间:2024/04/28 01:58

以前从没有留意过irqbalance 服务,最近公司线上服务的一台机器因性能低找大牛排查,原因是irqbalance没有启动。

一起认识一下irqbalance

irqbalance用于优化中断分配,它会自动收集系统数据以分析使用模式,并依据系统负载状况将工作状态置于 Performance mode 或 Power-save mode。处于Performance mode 时,irqbalance 会将中断尽可能均匀地分发给各个 CPU core,以充分利用 CPU 多核,提升性能,在机器需要高并发时,建议开始该服务。

处于Power-save mode 时,irqbalance 会将中断集中分配给第一个 CPU,以保证其它空闲 CPU 的睡眠时间,降低能耗。至于深层次的irqbalance实现原理,请参考 http://blog.yufeng.info/archives/2422

查看一下irqbalance运行状态

[root@localhost ~]# /etc/init.d/irqbalance status 
irqbalance (pid  1787) is running...

判断irqbalance是否生效,可以用以下命令

[root@localhost]# cat cat /proc/interrupts 
cat: cat: No such file or directory
            CPU0       CPU1       CPU2       CPU3       CPU4       CPU5       CPU6       CPU7       CPU8       CPU9       CPU10      CPU11      
   0:        211          0          0          0          0          0          0          0          0          0          0          0  IR-IO-APIC-edge      timer
   3:          1          0          0          0          0          0          0          0          0          0          0          0  IR-IO-APIC-edge    
   4:          1          0          0          0          0          0          0          0          0          0          0          0  IR-IO-APIC-edge    
   8:          1          0          0          0          0          0          0          0          0          0          0          0  IR-IO-APIC-edge      rtc0
   9:          3          0          0          0          0          0          0          0          0          0          0          0  IR-IO-APIC-fasteoi   acpi
  10:        248          0          0          0          0          0          0          0          0          0          0          0  IR-IO-APIC-edge      ipmi_si
  18:        112          0        633          0          0          0          0          0          0          0          0          0  IR-IO-APIC-fasteoi   ehci_hcd:usb1, ehci_hcd:usb2
  48:          0          0          0          0          0          0          0          0          0          0          0          0  DMAR_MSI-edge      dmar0
  49:       1443          0          0          0          0          0          0          0          0          0          0          0  IR-HPET_MSI-edge      hpet2
  50:          0          0          0          0          0          0          0          0          0          0          0          0  IR-HPET_MSI-edge      hpet3
  51:          0          0          0          0          0          0          0          0          0          0          0          0  IR-HPET_MSI-edge      hpet4
  52:          0          0          0          0          0          0          0          0          0          0          0          0  IR-HPET_MSI-edge      hpet5
  53:          0          0          0          0          0          0          0          0          0          0          0          0  IR-HPET_MSI-edge      hpet6
  62:    2164739     287046     341766     520296     631345     547198      78806      67931      64963      50359      41064      65290  IR-PCI-MSI-edge      megasas
  63:     310044    2384532     334562     521140     649374     621926      75442      85369      72508      58892      43872      71036  IR-PCI-MSI-edge      megasas
  64:     331203     306898    3083188     524434     729879     597887      82353      81654      77220      63684      50793      71249  IR-PCI-MSI-edge      megasas
  65:     447831     411694     490895    5478417     756402     723152      83675     105521      85670      65901      39693      89462  IR-PCI-MSI-edge      megasas
  66:     567200     590322     627254     717741    5276856     915276     122564     126045      84580      78879      61643     112951  IR-PCI-MSI-edge      megasas
  67:     518883     571342     557542     683070     837204    6908423     115857     137247      94730      80940      47487     127435  IR-PCI-MSI-edge      megasas
  68:     124334     127578     122416     144390     168710     186357     200412      28137      22988      18430      13294      33746  IR-PCI-MSI-edge      megasas
  69:     103581     105094     123585     154722     190685     188526      29473     208469      22829      20009       9686      26498  IR-PCI-MSI-edge      megasas
  70:     107831     111320     110774     127070     119667     139084      24999      23178     122266      22088       9540      22520  IR-PCI-MSI-edge      megasas
  71:     120684     103585     103365     130849     147881     165708      24876      25082      24327      96468      13836      25281  IR-PCI-MSI-edge      megasas
  72:     114054     101613      93753     117778     127602     128749      19903      25550      12017      19958      78561      24235  IR-PCI-MSI-edge      megasas
  73:     159596     150824     114802     156081     181308     222553      35156      31307      20933      22169      16917     249806  IR-PCI-MSI-edge      megasas
  74:          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      ahci
  75:        130          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      ahci
  76:   13090242    2832482    4582279    4389567    3906836    3634437     332047    1599541     869210     628925    1810958     561262  IR-PCI-MSI-edge      p5p1-TxRx-0
  77:    2456516   21011195    2968968    2819445    5214820    3808425     359339    1425478     252540     304461      49040     405942  IR-PCI-MSI-edge      p5p1-TxRx-1
  78:    3940619    2419926   21200694    3411696    3179349    3531682    2426754    3721368     249815    1235896      71757     274056  IR-PCI-MSI-edge      p5p1-TxRx-2
  79:    3654341    2090160    2861326   26417587    3781993    3863507    1861969     130759    1101015     135813     108163    1635481  IR-PCI-MSI-edge      p5p1-TxRx-3
  80:    2644246    4906571    2986907    2646986   27685277    2236788     609112      70792    2428115    3006798    1058015    2612052  IR-PCI-MSI-edge      p5p1-TxRx-4
  81:    2826437    3584745    3417408    5329454    1580332   29506269     194961      54401    1500858      70348    1027698    1261865  IR-PCI-MSI-edge      p5p1-TxRx-5
  82:     286894     507726    2559274    1832318     779730     492580   75652964     448559      82037      61960    1972745     109941  IR-PCI-MSI-edge      p5p1-TxRx-6
  83:    1652807    1498467    4426839     231711     311507      57095     393680   72134006      58723       3660      19011     994562  IR-PCI-MSI-edge      p5p1-TxRx-7
  84:    1249311     242129     181794     277727    2256356    2763101     510544      11759   74978930      14685      13288      18446  IR-PCI-MSI-edge      p5p1-TxRx-8
  85:      43260      99611    1248124      84304    2650572     114571       2311       3721       1193   77893313     124559    2882205  IR-PCI-MSI-edge      p5p1-TxRx-9
  86:    2332908      48374     500506      43626     116237    1575913    1041777       3367       2290    1082895   80821860       1972  IR-PCI-MSI-edge      p5p1-TxRx-10
  87:     947249     385341     223487    1748506    6200408     252164      24018    1038241       4990     296566       6590   78040930  IR-PCI-MSI-edge      p5p1-TxRx-11
  88:        168        211        189        281        300        228         35         30         22         36         14         40  IR-PCI-MSI-edge      p5p1
  89:   13834680    2765913    4056543    4644936    4520166    3866613    1020155     421062    1575093     756134    1393789     945571  IR-PCI-MSI-edge      p5p2-TxRx-0
  90:    3092496   20195486    2651564    4035221    4699869    3290318     772652    1319497     552624     605535    1004250     679126  IR-PCI-MSI-edge      p5p2-TxRx-1
  91:    5028572    3784675   19103310    3934109    4284522    3813716     483013    1372187     645463    1604387     437875     483576  IR-PCI-MSI-edge      p5p2-TxRx-2
  92:    4372412    3592175    4630341   21469207    5696961    3732931    1543666     874171     215317     932388     937188    2064136  IR-PCI-MSI-edge      p5p2-TxRx-3
  93:    4067332    3373152    4708481    6325344   24031780    4511541     601329     986220     759079    1577174     578195    1354068  IR-PCI-MSI-edge      p5p2-TxRx-4
  94:    3204312    3894124    3082254    4147356    3270630   28267081     805867    3049339     672590     215053     431538     807513  IR-PCI-MSI-edge      p5p2-TxRx-5
  95:    1632567     932649    1034225    2146447    1988742    2178216   63550435    1145698    4465906    2251341       8424    6006585  IR-PCI-MSI-edge      p5p2-TxRx-6
  96:    1010062    1430759     589545    1486117    1157117    3514454    1672882   70249865      27658      28574      24505      82665  IR-PCI-MSI-edge      p5p2-TxRx-7
  97:    1711022     655591     729711     457895      84781     935641    3038992      22513   72495638      97497    2689585      76112  IR-PCI-MSI-edge      p5p2-TxRx-8
  98:    1142658     726052    2405341    1159807     664809     233339    3037413      69782     158050   75404673        852      36441  IR-PCI-MSI-edge      p5p2-TxRx-9
  99:    1688277    1347922     864447     997181    1162208     682408    2875740      79565      43821      21306   77426273      67201  IR-PCI-MSI-edge      p5p2-TxRx-10
 100:     869139    1631443     479084    2011486    2477800     939439    5834226      38613      20296      48399      50888   75031281  IR-PCI-MSI-edge      p5p2-TxRx-11
 101:        210        238        117        234        203        344         36         36         25         48         17         45  IR-PCI-MSI-edge      p5p2
 NMI:      65134      24961      14098      11294      11313      11564      51971      74036      74101      32546      29849      35589   Non-maskable interrupts
 LOC:  254398054  220190103  137764939   65468364   48916310   48036237  216638600  210403057  219736972  197349981  195938147  200863283   Local timer interrupts
 SPU:          0          0          0          0          0          0          0          0          0          0          0          0   Spurious interrupts
 PMI:      65134      24961      14098      11294      11313      11564      51971      74036      74101      32546      29849      35589   Performance monitoring interrupts
 IWI:          0          0          0          0          0          0          0          0          0          0          0          0   IRQ work interrupts
 RES:     277455     467208    2159800    6744061    7891240    7147463     587962     447468     356649     472986     468408     429036   Rescheduling interrupts
 CAL:         51        224        222        221        224        222        209        222        212        221        213        222   Function call interrupts
 TLB:    2859051    8083119   10671875    7041008    4518420    4098622   38085038   56033113   43551382   40678132   40237906   21410551   TLB shootdowns
 TRM:          0          0          0          0          0          0          0          0          0          0          0          0   Thermal event interrupts
 THR:          0          0          0          0          0          0          0          0          0          0          0          0   Threshold APIC interrupts
 MCE:          0          0          0          0          0          0          0          0          0          0          0          0   Machine check exceptions
 MCP:       1445       1445       1445       1445       1445       1445       1445       1445       1445       1445       1445       1445   Machine check polls
 ERR:          0
 MIS:          0

0 0