常用脚本

 

TCP加速

锐速安装

#萌咖版
bash <(wget --no-check-certificate -qO- https://github.com/MoeClub/lotServer/raw/master/Install.sh) install
#91yun版
wget -N --no-check-certificate https://github.com/91yun/serverspeeder/raw/master/serverspeeder.sh && bash serverspeeder.sh

 

BBR安装

#秋水版
wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && ./bbr.sh
#萌咖版
wget --no-check-certificate -qO 'BBR_POWERED.sh' 'https://moeclub.org/attachment/LinuxShell/BBR_POWERED.sh' && chmod a+x BBR_POWERED.sh && bash BBR_POWERED.sh

 

 

代理安装

酸酸

#秋水go版
wget --no-check-certificate https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-go.sh
chmod +x shadowsocks-go.sh
./shadowsocks-go.sh 2>&1 | tee shadowsocks-go.log
#Ubuntu 16.10 及以上 或 Debian 8 及以上
sudo apt update
sudo apt install shadowsocks-libev

#编写config.json文件,内容如下(按需求自行修改):
{
    "server":"127.0.0.1",
    "server_port":8389,
    "local_port":1081,
    "password":"salsa20_password",
    "timeout":60,
    "method":"chacha20-ietf-poly1305",
    "local":"127.0.0.1",
    "fast_open":false
}

#启动ss-server,代码如下:
ss-server -c config.json

#后台运行
nohup ss-server -c config.json &

 

 

酸酸乳

 

跑分脚本

wget -qO- 86.re/bench.sh | bash

 

性能测试

wget --no-check-certificate https://github.com/teddysun/across/raw/master/unixbench.sh
chmod +x unixbench.sh
./unixbench.sh

 

物理CPU

# 总核数 = 物理CPU个数 X 每颗物理CPU的核数 
# 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数

# 查看物理CPU个数
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l

# 查看每个物理CPU中core的个数(即核数)
cat /proc/cpuinfo| grep "cpu cores"| uniq

# 查看逻辑CPU的个数
cat /proc/cpuinfo| grep "processor"| wc -l

 

 

AB测试

yum -y install httpd-tools
ab -n 1000 -c 1000 http://test.com/

 

 

虚拟类型

yum install virt-what

virt-what

 

4K测试

https://www.youtube.com/watch?v=RK1K2bCg4J8

 

 

Nginx安装

wget -c http://mirrors.linuxeye.com/oneinstack-full.tar.gz && tar xzf oneinstack-full.tar.gz && ./oneinstack/install.sh --nginx_option 1 --db_option 2 --dbinstallmethod 1 --dbrootpwd oneinstack --reboot

 

回程路由

# CentOS系统:
yum update && yum install traceroute -y
 
# Debian/Ubuntu系统:
apt-get update && apt-get install traceroute -y


mkdir besttrace && cd besttrace
wget http://cdn.ipip.net/17mon/besttrace4linux.zip
unzip besttrace4linux.zip
chmod +x *


./besttrace -q 1 IP

 

Speedtest

wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli
./speedtest-cli

 

Fast.com

wget https://github.com/ddo/fast/releases/download/v0.0.4/fast_linux_amd64 -O fast
chmod +x fast
./fast

 

IPIP.net

var out = []
String.prototype.replaceAll = function(s1,s2){return this.replace(new RegExp(s1,"gm"),s2);}
$("tr", "table").each(function(i,tr){
	tds = $("td", tr);
	if(i > 0){
		out.push(_replace_num(tds.eq(0).text())+"  "+$("span",tds.eq(2)).eq(0).text()+"  "+ _replace_ms(tds.eq(5).html().replaceAll("<br>","/"))+"  "+_replace_as(tds.eq(4).text())+"  "+_replace($("span",tds.eq(3)).eq(0).text()||tds.eq(3).text()))
	}
})
console.log(out.join("\n"))

function _replace_num(v){
	return v < 10 ? " "+v : v;
}

function _replace(v){
	return v.replaceAll("N/A","")
}

function _replace_as(v){
	if (/(AS\d+)/i.test(v))
		return RegExp.$1
	else
		 return ""
}

function _replace_ms(v){
	if (/([^*/ "]+)/.test(v))
		return RegExp.$1 + " ms"
	else
		 return ""
}

 

 

 

WEBKAKA

//http://www.webkaka.com/Ping.aspx
var j_total = 0;//节点总数
var l_total = 0;//总丢包数
var p_total = 0; //总延迟

var str = '<table class="table table-bordered table-condensed">\n';
str += '<tr><th>节点位置</th><th>发包次数</th><th>接包次数</th><th>丢包</th><th>平均延迟</th></tr>'
$("tr[class*='ulTTResult_bg']").each(function(i,tr){
    if($("td", tr).eq(1).text() != '超时'){
        if(!$(tr).attr('style')){
            var p = $("td", tr).eq(2).text() - $("td", tr).eq(3).text()
            if(p > 0 && p <= 2){
                str += '<tr class="warning">';
            }else if(p > 2){
                 str += '<tr class="danger">';
            }else{
                str += "<tr>";
            }

            str +='<td>' + $("td", tr).eq(0).text() + '</td>';
            str +='<td>' + $("td", tr).eq(2).text() + '</td>';
            str +='<td>' + $("td", tr).eq(3).text() + '</td>';
            str +='<td>' + p + '</td>';
            str +='<td>' + $("td", tr).eq(7).text() + '</td>';
            str += "</tr>\n";
            
            j_total++;
            l_total+= parseInt(p);
            p_total+= parseInt($("td", tr).eq(7).text());
        }
    }
    
})
str += '</table>';


str = '<b>区域平均延迟(毫秒)</b>\n<p>华南:' +$("#divPingAvgHuanan").text()+ ' / 华东:' +$("#divPingAvgHuadong").text()+' / 华中:' +$("#divPingAvgHuazhong").text()+ ' / 华北:' +$("#divPingAvgHuabei").text()+' / 西南:' +$("#divPingAvgXinan").text()+ ' / 西北:' +$("#divPingAvgXibei").text()+ ' / 东北:' +$("#divPingAvgDongbei").text()+'</p>\n' + str




str = '<b>运营商平均延迟(毫秒)</b>\n<p>联通:' +$("#lt_avgValue").text()+ ' / 移动:' +$("#yd_avgValue").text()+ ' / 电信:' +$("#dx_avgValue").text()+ ' / 其他:' + $("#qt_avgValue").text()+ '</p>\n' + str

str = '<p>总丢包率:' + ((l_total / (j_total * 10)) * 100).toFixed(2) +'% </p>\n<p>总均延迟:' + (p_total / j_total).toFixed(2) +'(毫秒)</p>\n' + str
console.log(str);

 

 

 

 

内存测试

yum install wget -y
yum groupinstall "Development Tools" -y
wget https://raw.githubusercontent.com/FunctionClub/Memtester/master/memtester.cpp
gcc -l stdc++ memtester.cpp
./a.out

 

数据库测试

mysqlslap -a --concurrency=100,1000 --number-of-queries 2000 --iterations=5 --engine=myisam,innodb --debug-info -uroot -poneinstack