Skip to content

Instantly share code, notes, and snippets.

@mahendrapaipuri
Last active September 15, 2024 15:40
Show Gist options
  • Select an option

  • Save mahendrapaipuri/ee75b28a77705b859327efb6877f6632 to your computer and use it in GitHub Desktop.

Select an option

Save mahendrapaipuri/ee75b28a77705b859327efb6877f6632 to your computer and use it in GitHub Desktop.
Useful linux commands
#!/bin/bash
# Command to check top consumers of open files in linux
lsof | awk '{ print $2; }' | sort -rn | uniq -c | sort -rn | head
# List of processes id with the number of inotify instances they are consuming,
# sorted by the number of inotify instances being consumed
for inot in /proc/*/fd/*; do readlink -f $inot; done | grep inotify | sort | uniq -c | sort -nr
# Increase inotify watches and instances
echo "fs.inotify.max_user_watches=524288" >> /etc/sysctl.conf
echo "fs.inotify.max_user_instances=512" >> /etc/sysctl.conf
# To detect cgroups mode
# Ref: https://unix.stackexchange.com/questions/480747/how-to-find-out-if-systemd-uses-legacy-hybrid-or-unified-mode-cgroupsv1-vs-cgr
# Ref: https://lists.freedesktop.org/archives/systemd-devel/2018-November/041644.html
[ $(stat -fc %T /sys/fs/cgroup/) = "cgroup2fs" ] && echo "unified" || ( [ -e /sys/fs/cgroup/unified/ ] && echo "hybrid" || echo "legacy")
# Generate network traffic
# Start server in UDP mode
# Ensure to set -B for UDP mode for correct behaviour
iperf -s -u
# Start client to send traffic at a rate of 10Mb/s for 30s
iperf -c <ip> -u -b 10m -t 30
# RDMA tests
# Number of qp can be configured by using -q on both server and client
# Server side
ib_write_bw -d mlx5_0 --report_gbits
# Client side for running test for 600 seconds
ib_write_bw -d mlx5_0 --report_gbits -F <ip> -D 600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment