Blog

  • 使用iostat分析问题

    文章来源: How I Use Iostat and Vmstat for Performance Analysis

    考虑到svctm在iostat是不保证准确的. 分析io await相关问题需要和blktrace结合起来分析.

    1. Is the I/O heavy?

    • Check the sum of w/s and r/s. The larger, the heavier I/O.
    • Also check %util, the more, the heavier.

      • If it is close to 100, then the I/O is definitely significant. It should be noted that during writing,
      • if the disk is the bottleneck (%util is 100% for a long time), but the applications keep writing, as long as the dirty pages exceeds 30% of memory, the system will block all the write system call, no matter sync or async, and focuses on writing to the disk. Once this occurs, the entire system is slow as hell.
      • check wa in vmstat log.
        (more…)
  • PYTHONPATH作用

    尝试使用命令行执行自己的一个小项目,抛出了异常

    (venv) [root@node2 hui-cache-test]# python system-info-data/src/main.py
    Traceback (most recent call last):
      File "system-info-data/src/main.py", line 1, in <module>
        from src.iostat.collect_op import *
    ModuleNotFoundError: No module named 'src'
    

    Google一番原来是需要配置$PYTHONPATH

    export PYTHONPATH=path-to-project-directory:$PYTHONPATH
    
    #export PYTHONPATH=/root/hui-cache-test/system-info-data:$PYTHONPATH
    
  • n2n内穿透

    之前一直使用frp.然后看到frp 有个xtcp.试了一下,家里和公司完全穿透不起来.网上一查,n2n的效果很一些.这里是软件地址ntop n2n

    mac os

    1. 需要先安装tuntap
    brew update && brew upgrade brew-cask && brew cleanup && brew cask cleanup
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    brew cask install  tuntap
    
    1. 编译安装.由于新版本mac os系统限制.我把Makefile里安装帮助文档和工具部分注释掉了.
    install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz
        echo "MANDIR=$(MANDIR)"
        $(MKDIR) $(SBINDIR) $(MAN1DIR) $(MAN7DIR) $(MAN8DIR)
        $(INSTALL_PROG) supernode $(SBINDIR)/
        $(INSTALL_PROG) edge $(SBINDIR)/
        #$(INSTALL_DOC) edge.8.gz $(MAN8DIR)/
        #$(INSTALL_DOC) supernode.1.gz $(MAN1DIR)/
        #$(INSTALL_DOC) n2n.7.gz $(MAN7DIR)/
        #$(MAKE) -C tools install
    
    ./autogen.sh
    ./configure
    make
    
    # optionally install
    make install
    
    1. 启动
    sudo /usr/local/sbin/edge  proxy/config/edge.conf -f
    

    window

    1. 需要安装Visual Studio.我装的最新的Visual Studio 2019社区版.把C++和Windows SDK都安装上了.
    2. OpenSSL win32
    3. 在Visual Studio调整了编译为winX86.

    centos

    1. 最方便.直接看教程安装就行了.安装相关的库之后,执行:
    yum erase zeromq3 (Do this once to make sure zeromq3 is not installed)
    yum clean all
    yum update
    yum install pfring-dkms n2disk nprobe ntopng cento
    
    1. 作为服务启动.
     systemctl start supernode
     systemctl start edge
    
  • 环境变量all_proxy

    下载软件的时候,由于墙,经常很慢.以前是通过开代理,然后用polipo转http,然后在各个软件工具里面配置代理.
    最近发现原来,一般yum curl git wget 等工具都支持环境变量all_proxy.赶紧mark一下.
    

      alias huiproxy='export all_proxy=socks5h://127.0.0.1:1080 && curl ip.sb'
      alias huiproxyno='unset all_proxy && curl ip.sb'
    

    因为用了ssr,我这里用了socks5h.socks5和socks5h的区别可以看这里Differentiate socks5h from socks5 and socks4a from socks4 when handling proxy string
    1. In a proxy string, socks5h:// and socks4a:// mean that the hostname isresolved by the SOCKS server.
    2. socks5:// and socks4:// mean that the hostname is resolved locally.
    3. socks4a:// means to use SOCKS4a, which is an extension of SOCKS4. Let’s make urllib3 honor it.

  • 建立文章列表页面

    建了个文章目录页面.展示文章的标题.因为发现自己经常要回来找命令.这里记录一下免得升级被覆盖了.

    将下面文件放入wp-content/themes/twentytwenty/templates/目录下面.新建页面的时候,可以选择的模板就会多一个Article Archive Template.

    (more…)