随笔分类 -  工具-介绍

1
摘要:iptable的各种target iptables的结构: iptables由上而下,由Tables,Chains,Rules组成。 一、iptables的表tables与链chains iptables有Filter, NAT, Mangle, Raw四种内建表: 1. Filter表 Filte 阅读全文
posted @ 2023-09-20 11:15 codestacklinuxer 阅读(256) 评论(0) 推荐(0)
摘要:1、目前线上问题出现内存泄露, 怎样使用shell脚本 执行gdbattach 后 break bt quit等快速执行呢? 2、多进程 多线程一般会用到那些命令? 对于第一个问题: 以前文章有:gdb快速打印线程堆栈 目前可以参考脚本: ############################## 阅读全文
posted @ 2022-11-19 14:49 codestacklinuxer 阅读(203) 评论(0) 推荐(0)
摘要:转载:How long does it take to make a context switch That's a interesting question I'm willing to spend some of my time on. Someone at StumbleUpon emitte 阅读全文
posted @ 2022-11-08 13:11 codestacklinuxer 阅读(36) 评论(0) 推荐(0)
摘要:以前分析了netlink的原理,可以知道:内核和用户态相互消息传递,最好的方法就是使用 netlink,比较可以双向传递消息,不像 proc sys 只能单向; 但是netlink有个缺点就是使用tcpdump抓不到!! 目前为了解决他,采取了以前dpdk抓包的方法,直接copy&&mirror到虚 阅读全文
posted @ 2022-06-25 17:41 codestacklinuxer 阅读(89) 评论(0) 推荐(0)
摘要:平均负载高有可能是CPU密集型进程导致的 平均负载高不一定是cpu使用率高,有可能是io更繁忙了 发现负载高,使用mpstat、pidstat工具进行分析 CPU上下文切换:把前一个CPU上下文(cpu寄存器及程序计数器)保存起来,然后加载新的任务的上下文到这些寄存器及程序计数器,然后跳转到寄存器及 阅读全文
posted @ 2022-06-22 10:38 codestacklinuxer 阅读(24) 评论(0) 推荐(0)
摘要:根据指标找工具 根据工具查指标 使用长连接取代短连接,可以显著降低 TCP 建立连接的成本。在每秒请求次数较多时,这样做的效果非常明显。 使用内存等方式,来缓存不常变化的数据,可以降低网络 I/O 次数,同时加快应用程序的响应速度。 使用 Protocol Buffer 等序列化的方式,压缩网络 I 阅读全文
posted @ 2021-04-28 14:56 codestacklinuxer 阅读(133) 评论(0) 推荐(0)
摘要:1、 进程状态一共有如下5种 R(运行):进程正在运行或在运行队列中等待。 T(停止):进程收到停止信号后停止运行。 Z(僵死):进程已经终止,但进程描述符依然存在, 直到父进程调用wait4()系统函数后将进程释放。 S(中断):进程处于休眠中,当某个条件形成后或者接收到信号时,则脱离该状态。 D 阅读全文
posted @ 2021-04-26 09:52 codestacklinuxer 阅读(84) 评论(0) 推荐(0)
摘要:主要从网卡 网卡驱动 协议栈方面查看 网卡驱动 协议栈: arp: 路由以及接口配置引发: IPtables: 防火墙 tcp相关丢包: 阅读全文
posted @ 2021-04-13 22:18 codestacklinuxer 阅读(53) 评论(0) 推荐(0)
摘要:#!/bin/bash DPATH="/sys/kernel/debug/tracing" ## shell pid PID=$$ [ `id -u` -ne 0 ] && { echo "needs to be root" ; exit 1; } [ -z $1 ] && { echo "need 阅读全文
posted @ 2021-02-26 17:23 codestacklinuxer 阅读(202) 评论(0) 推荐(0)
摘要:valgrind的DRD和Helgrind 处理一个bug时,使用strace 发现线程死锁。 但是发生死锁的位置上下文怎样快速知道呢? 使用gdb 调试 打出调用栈,只能知道运行到此处发生死锁。但是是哪里开始出现死锁呢?? google搜索发现valgrind 的Helgrind可以解决 这个时候 阅读全文
posted @ 2020-10-28 18:13 codestacklinuxer 阅读(205) 评论(0) 推荐(0)
摘要:https://linux.cn/article-9273-1.html https://lwn.net/Articles/365835/ Documentation/trace/events.txt trace/ftrace-design.txt 什么是 ftrace? ftrace 是一个 Li 阅读全文
posted @ 2020-10-16 14:54 codestacklinuxer 阅读(160) 评论(0) 推荐(1)
摘要:vim 的insert data 阅读全文
posted @ 2020-10-10 22:27 codestacklinuxer 阅读(215) 评论(0) 推荐(0)
摘要:线上问题 ./pidstat -w Linux 3.6.5-Broadcom Linux ((none)) 03/21/20 _armv7l_ (1 CPU) 15:04:17 UID PID cswch/s nvcswch/s Command 15:04:17 0 1 0.03 0.00 busy 阅读全文
posted @ 2020-03-26 20:41 codestacklinuxer 阅读(270) 评论(0) 推荐(0)
摘要:top , pidstat(sysstat) pid -p PID -t 1 10 vmstat 1 CPU上下文切换、运行队列、利用率 ps Hh -eo tid pcpu 查看具体线程的CPU消耗 ps -eLo pid,lwp,pcpu | grep 9140命令查看进程号为9140的进程中各 阅读全文
posted @ 2020-03-25 21:54 codestacklinuxer 阅读(192) 评论(0) 推荐(0)
摘要:1.目前valgrind 、 memleak 、free 、top 、ps 中vsz Rss 、 buddy、 slab 这些用的比较多,一般用于处理内存紧张问题 共享内存是通过 tmpfs 实现的,所以它的大小也就是 tmpfs 使用的内存大小。tmpfs 其实也是一种特殊的缓存。 可用内存是新进 阅读全文
posted @ 2020-03-25 21:44 codestacklinuxer 阅读(212) 评论(0) 推荐(0)
摘要:I/O:某网上问题通过top iotop pidstat vmstat 工具定位出io高原因,内存不够。 iotop iostat -d 1 -x iostat 的两部分核心输出: CPU 使用率 (avg-cpu) %user: 用户空间程序占用的 CPU 百分比。 %system: 内核空间占用 阅读全文
posted @ 2020-03-23 23:27 codestacklinuxer 阅读(228) 评论(0) 推荐(0)
摘要:strace -c 统计每一系统调用的所执行的时间,次数和出错的次数等. -C: 跟 -c 类似,只是增加了会输出详细的追踪信息 -c 只是统计数据, -C 输出结果后紧跟 统计结果 -d 输出strace关于标准错误的调试信息. -f 跟踪由fork调用所产生的子进程. -ff 如果提供-o fi 阅读全文
posted @ 2020-01-15 10:11 codestacklinuxer 阅读(210) 评论(0) 推荐(0)
摘要:要启用kmemleak,前提是内核编译时在“Kernel hacking”中开启了 CONFIG_DEBUG_KMEMLEAK 选项。怎样知道一个运行系统的内核是否支持kmemleak呢?可以查看 /boot/config-$(uname -r) 配置文件中 CONFIG_DEBUG_KMEMLEA 阅读全文
posted @ 2020-01-06 22:20 codestacklinuxer 阅读(687) 评论(0) 推荐(0)
摘要:http://brendangregg.com/index.html http://brendangregg.com/linuxperf.html 性能&&排查工具大师 阅读全文
posted @ 2019-11-23 22:58 codestacklinuxer 阅读(134) 评论(0) 推荐(0)
摘要:valgrind 阅读全文
posted @ 2019-05-13 11:26 codestacklinuxer 阅读(724) 评论(0) 推荐(0)

1