https://jackxiang.com/post/10343/,出现磁盘等待wait较高,如下:
iostat -x 2 5  # %util 出现100,设备是挂载的dm-0
Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
dm-0              0.00     0.00    0.00    0.00     0.00     0.00     0.00     2.00    0.00   0.00 100.00



#dm-0的%utilized 是100.00%,这个很好的说明了有进程正在写入到dm-0磁盘中。
dm是device mapper(设备映射)的意思:
dm-0是个块设备,就是个分区,他被挂载在不同的目录,但是不同目录里的文件却不一样。


实践如何不用重启直接生效/etc/fstab的方法:
修改过/etc/fstab后mount -a 即可生效

      -a, --all
              Mount all filesystems (of the given types) mentioned in fstab.



二)查找iostat与df -h,挂载磁盘dm-0的对应关系。
cd /dev/mapper/
ll
ddf1_4c5349202020202010000055000000004711471100001450p1 -> ../dm-1

dmsetup ls|grep ddf1_4c5349202020202010000055000000004711471100001450p1
ddf1_4c5349202020202010000055000000004711471100001450p1 (253:1)

df -Plh|grep 'ddf1_4c5349202020202010000055000000004711471100001450p1'
/dev/mapper/ddf1_4c5349202020202010000055000000004711471100001450p1  194M   34M  151M  19% /boot

双出现:dm-3              0.00     0.00    0.00    0.00     0.00     0.00     0.00     2.00    0.00   0.00 100.00
df -Plh|grep 'ddf1_4c5349202020202010000055000000004711471100001450p3'
/dev/mapper/ddf1_4c5349202020202010000055000000004711471100001450p3  119G  2.4G  110G   3% /

指向boot目录。
反证:以为是卸载了所有的mount目录iowait就好,实践发现并没有好,负载依然高:




ddf1_4c5349202020202010000055000000004711471100001450p1 通过下面命令也能看:


来自:https://www.iteye.com/blog/andnnl-2236548
磁盘有问题:
sudo badblocks -s -v -o sdbbadblocks.log /dev/sda  #出现一堆的坏块编号

dmesg |less -i     #jbd2,当有硬盘坏道时,通常在dmesg输出的信息中会有 Buffer I/O Error,所以经常检查dmesg的输出可以及时发现是否存在硬盘问题。
NFO: task jbd2/dm-3-8:526 blocked for more than 120 seconds.
      Not tainted 2.6.32-431.el6.x86_64 #1
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
jbd2/dm-3-8   D 0000000000000002     0   526      2 0x00000000


查看第2个CPU上的程序定位到jbd2:
|grep -v '\[' 去掉系统服务进程

ps -eo 'pid,psr,cmd' |sort -nk 2|awk '{if($2==2)print }'|grep -v '\['
ps -eo 'pid,psr,cmd' |sort -nk 2|awk '{if($2==2)print }'|grep  '\['

ls -l /dev/dm-3
brw-rw---- 1 root disk 253, 3 Nov 11 14:59 /dev/dm-3

ps -LF -p 526   #看它的主进程
UID        PID  PPID   LWP  C NLWP    SZ   RSS PSR STIME TTY          TIME CMD
root       526     2   526  0    1     0     0   2 Nov11 ?        00:00:00 [jbd2/dm-3-8]

lsof -nPp 526
COMMAND   PID USER   FD      TYPE DEVICE SIZE/OFF NODE NAME
jbd2/dm-3 526 root  cwd       DIR  253,3     4096    2 /
jbd2/dm-3 526 root  rtd       DIR  253,3     4096    2 /
jbd2/dm-3 526 root  txt   unknown                      /proc/526/exe


dmraid -r  #man dmraid
/dev/sda: ddf1, ".ddf1_disks", GROUP, ok, 285155328 sectors, data@ 0
/dev/sdb: ddf1, ".ddf1_disks", GROUP, ok, 285155328 sectors, data@ 0


lsblk -f   #RAID1:数据安全性高,即同样的数据在另一块盘上备份一份,硬盘的容量也就减少一半。
NAME                                                               FSTYPE          LABEL UUID                                 MOUNTPOINT
sdb                                                                ddf_raid_member       LSI     \x10                        
└─ddf1_4c5349202020202010000055000000004711471100001450 (dm-0)                                                                
  ├─ddf1_4c5349202020202010000055000000004711471100001450p1 (dm-1) ext4                  bef5de45-511b-41c2-b487-6cf98faf978a /boot
  ├─ddf1_4c5349202020202010000055000000004711471100001450p2 (dm-2) swap                  861a3dbd-ca4b-4c97-b2b8-51504ee45949 [SWAP]
  └─ddf1_4c5349202020202010000055000000004711471100001450p3 (dm-3) ext4                  410be0c5-9b55-490e-b924-606d46182ea2 /
sda                                                                ddf_raid_member       LSI     \x10                        
└─ddf1_4c5349202020202010000055000000004711471100001450 (dm-0)                                                                
  ├─ddf1_4c5349202020202010000055000000004711471100001450p1 (dm-1) ext4                  bef5de45-511b-41c2-b487-6cf98faf978a /boot
  ├─ddf1_4c5349202020202010000055000000004711471100001450p2 (dm-2) swap                  861a3dbd-ca4b-4c97-b2b8-51504ee45949 [SWAP]
  └─ddf1_4c5349202020202010000055000000004711471100001450p3 (dm-3) ext4                  410be0c5-9b55-490e-b924-606d46182ea2 /

dmraid -s
*** Group superset .ddf1_disks
--> Active Subset
name   : ddf1_4c5349202020202010000055000000004711471100001450
size   : 285155328
stride : 128
type   : mirror
status : ok
subsets: 0
devs   : 2
spares : 0


步骤一) top命令显示后 按1
             Cpu2  :  0.0%us,  0.0%sy,  0.0%ni,  0.0%id,100.0%wa,  0.0%hi,  0.0%si,  0.0%st
             wa -- iowait  AmountoftimetheCPUhasbeenwaitingfor I/O to complete.

步骤二)iostat -x 2 5  #定位各个磁盘读写哪个高一些,iostat 会每2秒更新一次,一共打印5次信息, -x 的选项是打印出扩展信息,实际使用得需要扩展信息-x得到svctm一项,反应了磁盘的负载情况,如果该项大于15ms,并且util%接近100%,那就说明,磁盘现在是整个系统性能的瓶颈了。
svctm:          平均每次设备I/O操作的服务时间 (毫秒)。即 delta(use)/delta(rio+wio)
%util:          一秒中有百分之多少的时间用于 I/O 操作,或者说一秒中有多少时间 I/O 队列是非空的。即 delta(use)/s/1000 (因为use的单位为毫秒)
              如果 %util 接近 100%,说明产生的I/O请求太多,I/O系统已经满负荷,该磁盘可能存在瓶颈。
avgqu-sz:     平均I/O队列长度。即 delta(aveq)/s/1000 (因为aveq的单位为毫秒)。

浅显易懂的解释:
平均服务时间(svctm)类似于收银员的收款速度
平均等待时间(await)类似于平均每人的等待时间
I/O 操作率 (%util)类似于收款台前有人排队的时间比例。


实践发现dm-0 / dm-3 卡住了,产生的I/O请求太多,I/O系统已经满负荷,该磁盘可能存在瓶颈,也可能是坏了,
第一个iostat 报告会打印出系统最后一次启动后的统计信息,这也就是说,在多数情况下,第一个打印出来的信息应该被忽略,剩下的报告,都是基于上一次间隔的时间。举例子来说,这个命令会打印5次,第二次的报告是从第一次报告出来一个后的统计信息,第三次是基于第二次 ,依次类推:
iostat -x 2 5  # %util 出现100,设备是挂载的dm-0
Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
dm-0              0.00     0.00    0.00    0.00     0.00     0.00     0.00     2.00    0.00   0.00 100.00


#dm-0的%utilized 是100.00%,这个很好的说明了有进程正在写入到dm-0磁盘中。
dm是device mapper(设备映射)的意思:
dm-0是个块设备,就是个分区,他被挂载在不同的目录,但是不同目录里的文件却不一样。


svctm 一般要小于 await (因为同时等待的请求的等待时间被重复计算了),如果 svctm 比较接近 await,说明 I/O 几乎没有等待时间;如果 await 远大于 svctm,说明 I/O 队列太长,应用得到的响应时间变慢,如果响应时间超过了用户可以容许的范围,这时可以考虑更换更快的磁盘......。



步骤三)查找引起高I/O wait 对应的进程 ,iotop    #查找I/O wait 对应的进程


步骤四)查找哪个文件引起的I/Owait:
lsof 命令可以展示一个进程打开的所有文件,或者打开一个文件的所有进程。从这个列表中,我们可以找到具体是什么文件被写入,根据文件的大小和/proc中io文件的具体数据

我们可以使用-p <pid>的方式来减少输出,pid是具体的进程
lsof -p 1028

步骤四)更深入的确认这些文件被频繁的读写,我们可以通过如下命令来查看

[root@localhost ~]# df /tmp
文件系统               1K-块    已用     可用 已用% 挂载点
/dev/mapper/cl-root 17811456 3981928 13829528   23% /
  从上面的命令结果来看,我们可以确定/tmp 是我们环境的逻辑磁盘的根目录

复制代码
复制代码
[root@localhost ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               cl
  PV Size               19.00 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              4863
  Free PE               0
  Allocated PE          4863
  PV UUID               4QfaOy-DNSO-niK1-ayn2-K6AY-WZMy-9Nd2It
复制代码
复制代码
  过pvdisplay我们能看到/dev/sda2其实就是我们用来创建逻辑磁盘的具体磁盘。通过以上的信息我们可以放心的说lsof的结果就是我们要查找的文件

cat /proc/18987/io
rchar: 58891582418
wchar: 58891579778
syscr: 46556085
syscw: 46556077
read_bytes: 212992
write_bytes: 59580235776
cancelled_write_bytes: 0

同时可以结合vmstat 查看查看b参数(等待资源的进程数),b有一个等待:
vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
0  1      0 11119256 238876 205460    0    0     0     0    2    3  0  0 99  1  0


来自:https://www.cnblogs.com/happy-king/p/9234122.html
cat test.txt


sh test.txt
. test.txt


run:
sh test.txt
hello world


. test.txt  
hello world

即便test.txt没有可执行权限,也能够正常运行。

想一个自己的printf程序到底执行的是哪一个呢?
type -a printf
printf is a shell builtin
printf is /bin/printf
printf is /usr/bin/printf


更多来自:https://mp.weixin.qq.com/s/LdHHVsK9UsQ1mNLgA1pdSw
type用法,查找对应命令的返回值:
type cwww
cwww is an alias for cd /data/www/

k8s里的shell代码运行:


函数检测:

原理:应该是默认路由出口IP,它也就是能上网的default路由,发起公网请求的clientIP也就是要获取的服务器IP地址。



10.71.10.40


more:
echo $(python -c "
import socket;s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM);s.connect(('i.api.weibo.com',0));print(s.getsockname())  
")
('10.71.10.40', 45847)


换成别的IP也一样能行:
背景:好久没有摸C了,顺带学一下C语言数组下标的越界是否能访问到东西的问题,是能访问到的,但这些值没有任何意义,可能对于一些黑客有一定意义,但咱不细深入,简单了解一下即可。

cat test.c



#make test  
cc     test.c   -o test


#./test
i[0]===99
i[1]===100
i[2]===101
i[3]===0
i[4]===1559561856
i[5]===32764
*i===99
*(i+1)===100
*(i+2)===101
*(i+3)===0
*(i+4)===1559561856
*(i+5)===32764

*j===99
*(j+1)===100
*(j+2)===101
*(j+3)===0
*(j+4)===1559561856
*(j+5)===32764


===
如果不是整数数组,只是一个定义整数,j=i;是不行的,得:
    int a = 6;
    int *p = &a;

原因是:数组的首地址是指针,而单个整数变量不是指针,上面这个情况得用&取到其地址赋值给指针变量p,如下:
int *p;
p = &a;
https://github.com/hexagonal-sun/bic

Installation
You can compile and install bic with the following commands:

autoreconf -i
./configure --enable-debug
make
make install


make出现:
onfigure: WARNING: Expect not found, disabling REPL test cases.
./configure: line 5093: AX_LIB_READLINE: command not found
checking for __gmpz_init in -lgmp... no
configure: error: GNU MP not found, see https://gmplib.org/
========================安装地发现问题=======================

执行autoconf -i是遇到 possibly undefined macro: AM_INIT_AUTOMAKE
尝试运行: autoreconf --install

autoreconf --install
Can't exec "aclocal": No such file or directory at /usr/share/autoconf/Autom4te/FileUtils.pm line 326.
autoreconf: failed to run aclocal: No such file or directory



sudo yum install automake  #解决:failed to run aclocal: No such file or directory


#autoreconf --install    
configure.ac:8: installing './config.guess'
configure.ac:8: installing './config.sub'
configure.ac:11: installing './install-sh'
configure.ac:11: installing './missing'
src/Makefile.am: installing './depcomp'
configure.ac: installing './ylwrap'
parallel-tests: installing './test-driver'


今天Text Mate2 开源,来自:https://macromates.com/

有点像windows里的editplus.
对域名以及请求模式乃至缓存等过滤:
domain: mi.com is:from-cache
domain: mi.cm is:from-cache method:post

限速:Disable Cahce 右边有一个:online 右邻一个倒三角形。
Throttling Add custom profile...,用来限定网速作下接口和页面渲染测试。
背景:运行一个alfred的workflow后(https://www.mac69.com/news/399.html),终端exit;它不退出,不爽,于是找到解决办法了,如下:
解决Mac终端exit退出不爽:

入手Mac后发现各种不爽,比如在终端输入exit命令后,竟然不退出,以下解决:

  ------->终端

    -------->偏好设置

      ------->描述文件

            -------->Shell

              --------->单shell退出时:

                          选择:关闭窗口
————————————————
原文链接:https://blog.csdn.net/u010164190/article/details/60772827


二)mac效率神器alfred热键工作创建流程!用它打开一些应用程序并设置快捷键:
https://www.mac69.com/news/399.html
/usr/local/nginx/conf/vhosts/yum.qr.cntv.net.conf



关闭前:
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/xml
Date: Wed, 18 Sep 2019 02:23:28 GMT
ETag: W/"5d80ad08-bb9" 【】
ip_network: 234.253
Last-Modified: Tue, 17 Sep 2019 09:53:12 GMT
Server: nginx
Transfer-Encoding: chunked
Vary: Accept-Encoding

关闭后:
http://yum.qr.cntv.net/centos/6/x86_64/repodata/repomd.xml
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/xml
Date: Wed, 18 Sep 2019 02:18:51 GMT
ip_network: 234.254
Last-Modified: Tue, 17 Sep 2019 09:53:12 GMT
Server: nginx
Transfer-Encoding: chunked
Vary: Accept-Encoding


来自:http://nginx.org/en/docs/http/ngx_http_core_module.html
Syntax:  etag on | off;
Default:  
etag on;
Context:  http, server, location
This directive appeared in version 1.3.3.


二)关闭 if_modified_since off;的方法。
默认是开启的

可以参考两个方案(实践没有成功)

第一在nginx.conf里设置

if_modified_since off|on;
第二在具体的location段里

location ~* \.(?:manifest|appcache|html?|xml|json)$ {
# add_header  Last-Modified $date_gmt;
  # add_header  Last-Modified ""; #不想要就置空
# add_header  Cache-Control "public";
}
PS:$date_gmt是内嵌变量,具体参考ngx_http_ssi_module模块

nginx如果打开了SSI模块,会默认关闭header中的last-modified输出
https://blog.csdn.net/weixin_34168700/article/details/92438695
((3+5)*7-20)/6

div.c  plus.c  sub.c  times.c



./plus 5|./times 7|./sub 20|./div 6
3
6


来自:https://mp.weixin.qq.com/s/0a_T8UKFNiaQueYrUs1TCw
server.php


ACCEPT队列(全连接队列):由listen()函数的第二个参数 backlog 指定,内核硬限制由 net.core.somaxconn 限制,即实际的值由min(backlog,somaxconn) 来决定。表示已完成连接的队列,等待被 accept系统调用取走。

php server.php
connection open: 1
[2019-09-17 06:47:18 *9116.0]   NOTICE  swFactoryProcess_finish (ERRNO 1004): send 25 byte failed, because connection[fd=1] is closed
connection close: 1

client.php


netstat -lantp|grep 6666          
tcp        0      0 127.0.0.1:48344         127.0.0.1:6666          FIN_WAIT2   -      #客户端进入  FIN_WAIT2 状态            
tcp        0      0 127.0.0.1:6666          127.0.0.1:48344         CLOSE_WAIT  9110/php     #服务器端进入CLOSE_WAIT


https://blog.csdn.net/Tanswer_/article/details/78375317


SYN队列(半连接队列):由/proc/sys/net/ipv4/tcp_max_syn_backlog指定,表示处于 SYN_RECV 状态的队列
ACCEPT队列(全连接队列):由listen()函数的第二个参数 backlog 指定,内核硬限制由 net.core.somaxconn 限制,即实际的值由min(backlog,somaxconn) 来决定。表示已完成连接的队列,等待被 accept系统调用取走。
原文链接:https://blog.csdn.net/Tanswer_/article/details/78375317

点击在新窗口中浏览此图片

cat /proc/sys/net/ipv4/tcp_max_syn_backlog
65535
cat /proc/sys/net/core/somaxconn
65535
netstat -s | egrep "listen|LISTEN"
Fri May  5 15:39:59 CST 2017
1641906 times the listen queue of a socket overflowed
1641906 SYNs to LISTEN sockets ignored


ss -lnt
State       Recv-Q Send-Q                              Local Address:Port                                             Peer Address:Port              
LISTEN      0      300                                             *:3307                                                        *:*                  
LISTEN      0      511                                             *:80                                                          *:*        


ss -lnt
Recv-Q Send-Q Local Address:Port  Peer Address:Port
0        50               *:3306             *:*
上面看到的第二列Send-Q 表示第三列的listen端口上的全连接队列最大为50,第一列Recv-Q为全连接队列当前使用了多少

全连接队列的大小取决于:min(backlog, somaxconn) . backlog是在socket创建的时候传入的,somaxconn是一个os级别的系统参数

半连接队列的大小取决于:max(64, /proc/sys/net/ipv4/tcp_max_syn_backlog)。 不同版本的os会有些差异


来自:https://blog.csdn.net/Tanswer_/article/details/78375317
AirServer投屏pc之iPhone和win10同一个wifi可以通过iphone把内容投递上去:
https://bbs.feng.com/forum.php?mobile=2&mod=viewthread&page=1&tid=11567782

AirServer投屏pc:
https://jingyan.baidu.com/article/495ba841c6491238b30edeba.html
用户文件是一个底层且常用的需求。
阅读全文
背景:出现没有OOM,但是stress子进程反复重启,于是系统负载到118,死机,让机房重启,需要验证为何没有OOM?

container_memory_cache,我们会发现使用的缓存量继续增加,直到container_memory_usage_bytes达到限制,然后开始减少。container_memory_usage_bytes确实考虑了一些正在缓存的文件系统页面。我们还可以看到OOMKiller正在跟踪container_memory_working_set_bytes。这是有道理的,因为共享文件系统缓存页面可以随时从内存中逐出。

也就是说:container_memory_cache ((思考文件系统缓存))平时是不动它的一个值,但是当container_memory_usage_bytes伴随container_memory_usage_bytes的增长而增长,container_memory_usage_bytes增长到设定的limit 200M后,发现container_memory_usage_bytes还继续增长,那么它会把container_memory_cache的内存给用掉。

来自:https://medium.com/faun/how-much-is-too-much-the-linux-oomkiller-and-used-memory-d32186f29c9d


kubectl get pod memory-demo-2 --namespace=mem-example
这时候,容器可能会运行,也可能会被杀掉。如果容器还没被杀掉,重复之前的命令直至 你看到这个容器被杀掉:

NAME            READY     STATUS      RESTARTS   AGE
memory-demo-2   0/1       OOMKilled   1          24s


来自:https://www.cnblogs.com/weifeng1463/p/10174432.html


相关测试的yaml:https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/
分页: 10/339 第一页 上页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 下页 最后页 [ 显示模式: 摘要 | 列表 ]