Skip to content

Instantly share code, notes, and snippets.

Avatar
🤣
I may be slow to respond.

chinaxing ChinaXing

🤣
I may be slow to respond.
View GitHub Profile
View btrace-java-agent.sh
# -------------- trace script Java source ---------------- #
import com.sun.btrace.annotations.*;
import static com.sun.btrace.BTraceUtils.*;
import com.sun.btrace.AnyType;
@BTrace // (trusted=true)
public class Test {
@OnMethod(
clazz="java.net.ServerSocket",
method="bind"
View fix-nic-teamd.sh
yum erase ais-vnic -y # 卸载ali-vnic
yum install teamd -y
systemctl daemon-reload # systemctl 更新配置
modprobe bonding # teamd依赖
modprobe team # teamd依赖的驱动
ip link del bond0 # 删除bond 驱动新增的网卡
systemctl restart network # 启动网络,teamd 后台进程会启动 ps auxf | grep teamd 查看确认
View MAT.sql
-- 分析 unreachable对象 https://wiki.eclipse.org/MemoryAnalyzer/FAQ#How_to_analyse_unreachable_objects
-consoleLog -application org.eclipse.mat.api.parse -keep_unreachable_objects <heapDump.bin>
-- 查询 非unreachable的对象,GCRootInfo null 表名此对象非GcRoot,MAT keepunreachable 对象时,unreachable对象的gcroot是自身
SELECT * FROM byte[] s WHERE ((s.@length >= 2000000) and (s.@GCRootInfo = null))
View ps-tools.md

show pid namespace all threads of process 21503

ps axH -opid,ppid,pidns -p 21503

list namespace of process 21503

lsns -p 21503

list namespace inode of process 21503

ls -iL /proc/21503/ns/pid

@ChinaXing
ChinaXing / jstat config
Created Jan 24, 2018
start jstatd all policy
View jstat config
grant codebase "file:${java.home}/../lib/tools.jar" {
permission java.security.AllPermission;
};
jstatd -J-Djava.security.policy=jstatd.all.policy
@ChinaXing
ChinaXing / packet-loose.sh
Created Oct 24, 2016
packet loose mock use tc
View packet-loose.sh
#!/bin/env bash
# --------------------------------------------
#
# 网络丢包模拟工具
#
# --------------------------------------------
block(){
interface=$1
View gist:302e053d03d8e53dfde2610e000b22d3
import com.sun.btrace.annotations.*;
import com.sun.btrace.AnyType;
import static com.sun.btrace.BTraceUtils.*;
@BTrace
public class Q{
@OnMethod(
clazz="java.nio.Buffer",
method="/.*/",
location=@Location(value=Kind.FIELD_SET, clazz="java.nio.Buffer", field="po
View gist:0b7153f311b570bb319a998879a25bd5
import com.sun.btrace.annotations.*;
import com.sun.btrace.AnyType;
import static com.sun.btrace.BTraceUtils.*;
@BTrace
public class Q{
@OnMethod(
clazz="java.nio.Buffer",
method="/.*/",
location=@Location(value=Kind.FIELD_SET, clazz="java.nio.Buffer", field="po
View gist:a5579fb1768b2184acc0c6c28cae116a
import com.sun.btrace.annotations.*;
import com.sun.btrace.AnyType;
import static com.sun.btrace.BTraceUtils.*;
@BTrace
public class Q{
@OnMethod(
clazz="java.nio.Buffer",
method="/.*/",
location=@Location(value=Kind.FIELD_SET, clazz="java.nio.Buffer", field="po
View probe-net.stp
stap -e 'probe kernel.function("tcp_recvmsg") {sp = @cast($sk, "inet_sock")->num; dp = @cast($sk, "inet_sock")->sport; if(sp == 9091){ printf("hell,world, %d, %x\n", sp, dp);}}'