• Stars
    star
    726
  • Rank 62,418 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A suite of utilities simplilfying linux networking stack performance troubleshooting and tuning.

netutils-linux

pypi license pyversions codeclimate issues

Project is frozen

It's in licensing and intellectual property gray zone - previous employeer and me talked about it, but didn't fixed anything "on paper". I will not upgrade project, receive any patches, etc. Feel free to fork for own usage, drop py2 support, etc.

It's a useful utils to simplify Linux network troubleshooting and performance tuning, developed in order to help Carbon Reductor techsupport and automate the whole linux performance tuning process out of box (ok, except the best RSS layout detection with multiple network devices). These utils may be useful for datacenters and internet service providers with heavy network workload (you probably wouldn't see an effect at your desktop computer). It's now in production usage with 2000+ deployment and save us a lot of time with hardware and software settings debugging. Inspired by packagecloud's blog post.

Installation

You'll need pip.

pip install netutils-linux

Usage

Check this guide about usage.

Utils

Monitoring

All these top-like utils don't require root priveledges or sudo usage. So you can install and use them as non-priveledged user if you care about security.

pip install --user netutils-linux

Brief explanation about highlighting colors for CPU and device groups: green and red are for NUMA-nodes, blue and yellow for CPU sockets. Screenshots are taken from different hosts with different hardware.

network-top

Most useful util in this repo that includes almost all linux network stack performance metrics and allow to monitor interrupts, soft interrupts, network processing statistic for devices and CPUs. Based on following files:

  • /proc/interrupts (vectors with small amount of irqs/second are hidden by default)
  • /proc/net/softnet_stat - packet distribution and errors/squeeze rate between CPUs.
  • /proc/softirqs (only NET_RX and NET_TX values).
  • /sys/class/net/<NET_DEVICE>/statistic/<METRIC> files (you can specify units, mbits are default)

https://cloud.githubusercontent.com/assets/3813830/26570951/acacf18c-452c-11e7-8fe7-5d0952f39d8b.gif

There are also separate utils if you want to look at only specific metrics: irqtop, softirq-top, softnet-stat-top, link-rate.

snmptop

Basic /proc/net/smmp file watcher.

https://user-images.githubusercontent.com/3813830/28242466-b51f27dc-69c5-11e7-8076-52819b9b7450.gif

Tuning

rss-ladder

Automatically set smp_affinity_list for IRQ of NIC rx/tx queues that usually work on CPU0 out of the box).

Based on lscpu's output.

It also supports double/quad ladder in case of multiprocessor systems (but you better explicitly specify queue count == core per socket as NIC's driver's param). Example output:

# rss-ladder eth1 0
- distributing interrupts of eth1 (-TxRx-) on socket 0
  - eth1: irq 67 eth1-TxRx-0 -> 0
  - eth1: irq 68 eth1-TxRx-1 -> 1
  - eth1: irq 69 eth1-TxRx-2 -> 2
  - eth1: irq 70 eth1-TxRx-3 -> 3
  - eth1: irq 71 eth1-TxRx-4 -> 8
  - eth1: irq 72 eth1-TxRx-5 -> 9
  - eth1: irq 73 eth1-TxRx-6 -> 10
  - eth1: irq 74 eth1-TxRx-7 -> 11

autorps

Enables RPS on all available CPUs of NUMA node local for the NIC for all NIC's rx queues. It may be good for small servers with cheap network cards. You also can explicitely pass --cpus or --cpu-mask. Example output:

# autorps eth0
Using mask 'fc0' for eth0-rx-0.

maximize-cpu-freq

Sets every CPU scaling governor mode to performance and set max scaling value for min scaling value. So you will be able to use all power of your processor (useful for latency sensible systems).

rx-buffers-increase

rx-buffers-increase utils, that finds and sets compromise-value between avoiding dropped/missing pkts and keeping a latency low.

Example output:

# ethtool -g eth1

Ring parameters for eth1:
Pre-set maximums:
RX:           4096
...
Current hardware settings:
RX:           256

# rx-buffers-increase eth1

run: ethtool -G eth1 rx 2048

# rx-buffers-increase eth1

eth1's rx ring buffer already has fine size.

# ethtool -g eth1

Ring parameters for eth1:
Pre-set maximums:
RX:           4096
...
Current hardware settings:
RX:           2048

Hardware and its configuration rating. server-info

Much alike lshw but designed for network processing role of server.

Information about server

➜  vscale-vm git:(folding) ✗ server-info --show
cpu:
  info:
    Architecture: x86_64
    BogoMIPS: 4399
    Byte Order: Little Endian
    CPU MHz: 2199
    CPU family: 6
    CPU op-mode(s): 32-bit, 64-bit
    CPU(s): 1
    Core(s) per socket: 1
    Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36
      clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon
      rep_good nopl eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic
      movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm
      abm 3dnowprefetch tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust
      bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat
    Hypervisor vendor: KVM
    L1d cache: 32K
    L1i cache: 32K
    L2 cache: 256K
    L3 cache: 25600K
    Model: 79
    Model name: Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
    NUMA node(s): 1
    NUMA node0 CPU(s): 0
    On-line CPU(s) list: 0
    Socket(s): 1
    Stepping: 1
    Thread(s) per core: 1
    Vendor ID: GenuineIntel
    Virtualization: VT-x
    Virtualization type: full
  layout:
    '0': '0'
disk:
  vda:
    model: null
    size: 21474836480
    type: HDD
memory:
  devices:
    '0x1100':
      size: '512'
      speed: 0
      type: RAM
  size:
    MemFree: 78272
    MemTotal: 500196
    SwapFree: 0
    SwapTotal: 0
net:
  eth0:
    buffers:
      cur: 256
      max: 256
    conf:
      ip: ''
      vlan: false
    driver:
      driver: virtio_net
      version: 1.0.0
    queues:
      own: []
      rx: []
      rxtx: []
      shared: []
      tx: []
      unknown: []

Overall server rating

➜  vscale-vm git:(folding) ✗ server-info --rate --server
server: 1.7666666666666664

Subsystems rating

➜  vscale-vm git:(folding) ✗ server-info --rate --subsystem
cpu: 4.5
disk: 1.0
memory: 1.0
net: 1.3333333333333333
system: 1.0

Devices rating

➜  vscale-vm git:(folding) ✗ server-info --rate --device
cpu:
  BogoMIPS: 2
  CPU MHz: 2
  CPU(s): 1
  Core(s) per socket: 1
  L3 cache: 9
  Socket(s): 1
  Thread(s) per core: 10
  Vendor ID: 10
disk:
  vda: 1.0
memory:
  devices:
    '0x1100': 1.0
  size: 1.0
net:
  eth0: 1.3333333333333333
system:
  Hypervisor vendor: 1
  Virtualization type: 1

Device's detailed rating

➜  vscale-vm git:(folding) ✗ server-info --rate
cpu:
  BogoMIPS: 2
  CPU MHz: 2
  CPU(s): 1
  Core(s) per socket: 1
  L3 cache: 9
  Socket(s): 1
  Thread(s) per core: 10
  Vendor ID: 10
disk:
  vda:
    size: 1
    type: 1
memory:
  devices:
    '0x1100':
      size: 1
      speed: 1
      type: 1
  size:
    MemTotal: 1
    SwapTotal: 1
net:
  eth0:
    buffers:
      cur: 1
      max: 1
    driver: 2
    queues: 1
system:
  Hypervisor vendor: 1
  Virtualization type: 1

FAQ

Q: I see that workload is distributed fine, but there is a lot of workload. How to go deeper, how to understand what my system doing right now?

A: Try

perf top

How to contribute?

Close issues

Any help is welcome. Just comment an issue with "I want to help, how can I solve this issue?" to start.

More Repositories

1

uber-cli

Beeps when surge is gone
Python
28
star
2

tshark-tcp-stream-splitter

Lua script for split big PCAP file in few little PCAP's by tcp stream id.
Lua
22
star
3

bandcamp-player

Utility for streaming random music from bandcamp by specified tag via mplayer
Python
18
star
4

twitterbot_utils

Набор функций, общих для нескольких моих ботов, вынесенных сюда для унификации и упрощения
Python
16
star
5

zaebot

Периодически читает ленту одного пользователя (по 3 твита), дёргает оттуда существительные и относительно удачно склоняет подставляемое к ним слово "заебали". Прародитель twitterbot-utils.
Python
16
star
6

twitter_digital_suicide

Удаляем все свои твиты, чтобы не так сильно беспокоиться о сканировании соцсетей
Python
11
star
7

harry_potter_and_twitter_bots

Гарри Поттер и Полуночный Быдлокод
Python
8
star
8

twitterbot_farm

Twitterbot farm to run multiple twitter-bots at once using one source of tweets and with learning support.
Python
8
star
9

twitterbot_example

Everyword bot for twitter based on twitterbot-utils
Python
7
star
10

alfabank_currency

Курсы валют alfabank.ru и rocketbank.ru. Утилиты/либы.
Python
7
star
11

shell-retry

Wrapper for call any utilities with retries until they succeed
Python
5
star
12

go-twitterbot-replacer

Robot assisted autoreplace-twitting with web-UI
Go
4
star
13

shell-scripting-guide

Shell scripting guide. My own expirience mostly and some rules of Carbon Soft in bonus.
4
star
14

mikrotwitter

It's a really MIKRO-client for twitter
Python
4
star
15

strizhechenko.github.io

CV, blog, etc
HTML
4
star
16

markov-cli

You can mix Plato and Goldratt for example.
Python
3
star
17

tgbot-make-it-lists

Бот, который превращает длинные сообщения в список "задач"
Python
3
star
18

backup_scheme

Давно хотел сделать такую схему бэкапов, чтобы были доступны почти за любой срок давности, но их не становилось очень много
Shell
3
star
19

addiction-controller

Application that helps you to control and limit your addiction.
JavaScript
2
star
20

clion-goto-bug

C
2
star
21

uwo-xdotool

Bash + Xdotool + RDP + Uncharted Waters Online: automate selling trade goods in small batches to grind Trade Fame, Royal Fleet Points and (or) Commercial Battle Merits
Shell
2
star
22

cidr-diff

CLI tool for excluding IP from one IP/subnet list from second list.
Go
2
star
23

goodreads-streak

Streak like in github
Python
2
star
24

binary-pairs

Shell util - binary pairwise sets generator.
Python
2
star
25

votes_and_laws_data

2
star
26

mgrep

Сравнение набора слов и шаблона, описывающего эти слова с помощью граммем
Python
2
star
27

zabbix-simple-theme

Simple black-grey-white theme for zabbix web-interface
CSS
2
star
28

epythets

С помощью pymorphy извлекаем, нормализуем из текста множество эпитетов, сохраняя их в sqlite.
Python
1
star
29

good-enough-planning

1
star
30

dotfiles

Vim Script
1
star
31

list-of-all-variable-types

Just a joke
1
star
32

distribution-calculate

What if I add random sleep in range from X to Y, how may it distribute Z events in this interval?
Python
1
star
33

drhouse

yet another diagnostic framework
Shell
1
star
34

sudoku

Я джва года уже хочу решатель судоку и его валидатор написать
Python
1
star
35

covid

Stat tracker for who.int global stat, rosminzdrav stat for Russia and Sverdlovskaya Oblast
Python
1
star
36

autopoilka

Автопоилка: заказ двух 19л. бутылок воды на утро следующего дня с выставлением счёта на оплату в альфабанк.
Python
1
star
37

gv2map

Converter from graphviz to PNG/SVG map. Wrapper of neato, gvmap and sfdp.
Shell
1
star
38

twitter-avatar-rotator

Twitter "bot" that changes your avatar every 20 hours.
Python
1
star
39

lastfm-api-snippets

Пара забавных скриптов, использующих API last.fm
Python
1
star
40

osx-config

Fast and easy os x preferences/keychain transfer.
Shell
1
star
41

requests-filecache

Saves fetched HTML into files in current directory.
Python
1
star
42

checklister

Микроприложулька, которая рисует вложенные одноразовые (не запоминает состояние) чеклисты из YAML-файла.
JavaScript
1
star
43

arkham-horror

Hints about what to do while you play this game. You may think that it's automatic game master.
Python
1
star
44

named_fakezone_generator

Генератор зон для named/bind9 для списка доменов, которые необходимо перекидывать на заглушку
Shell
1
star