vmstat n 管道至 curl

使用 vmstat n命令每间隔n秒不间断的输出系统状态.
而目前想把每次输出状态立即通过curl POST到一个url上.
是否可以通过管道完成?

1个回答

You can use the -d option in curl with a @- argument to accept input from a pipe.

http://serverfault.com/questions/313599/how-do-i-pipe-the-output-of-uptime-df-to-curl

oyljerry
oyljerry 回复acecz: 你可以换一个思路,用另一个程序周期性调用vmstat,这样对于每次来说,都是一次数据发送给管道
接近 5 年之前 回复
acecz
acecz 第一次是OK的,关键在于 vmstat n中的n,这个是周期性的,第二次就会报错
接近 5 年之前 回复
chenshu_ivory
CSivory 谢谢
接近 5 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
你怎么读取PHP中的最后一行并解析出某些列

<div class="post-text" itemprop="text"> <p>I am very new to php. I'd really appreciate all the help here.</p> <p>I am using sftp to login to a server and get a file. I am only interested in the last line in that file. The last line seperated by tabs. I would like to store the 15, 16, 19 and 20, and 21st col values to 5 different variables. The last line looks like this:</p> <pre><code>7 1 0 59422170 306669 20188 20386 0 0 39787 59981 2014 67796 48953 2 7 90 1 1.81 11.3 12:19:50 </code></pre> <p>When I issue this cCurl command the get the file, how would I read the last line in this file and parse out the certain columns in the last line?</p> <pre><code>&lt;?php $user="user"; $pass="pass"; $c = curl_init("sftp://$user:$pass@server1/vmstat"); curl_setopt($c, CURLOPT_PROTOCOLS, CURLPROTO_SFTP); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); $data = curl_exec($c); curl_close($c); #echo $data; ?&gt; </code></pre> </div>

为什么等待运行时间的进程数量很高,但我的CPU 99%空闲?

<div class="post-text" itemprop="text"> <p>I have a script that runs a large number (around 100) of php files simultaneously. I noticed that the time for each script to start was often delayed a lot. When firing all scripts at once some scripts would only start after 15 seconds. </p> <p>I use the below code to simultaneously run those scripts (this code is working without any errors). Please note that the 100 php files are on the same server as the script that calls them simultaneously.</p> <pre><code>function my_curl ($i, $url, $post_data, $return, $auth='', $proxy='', $timeout=5) { $curl="/usr/bin/curl -s"; if ($post_data!='') $curl.=" --data '$post_data'"; if ($timeout!='') $curl.=" --connect-timeout $timeout"; if ($auth!='') { list($user,$pass)=explode(':',$auth); $curl.=" --basic --user $user:$pass"; } if ($proxy!='') { list($proxy_ip,$proxy_port,$proxy_user,$proxy_pass)=explode(':',$proxy); $curl.=" --proxy $proxy_ip:$proxy_port --proxy-user $proxy_user:$proxy_pass"; } if ($return==0) { $curl.=" $url &gt;/dev/null 2&gt;/dev/null &amp;"; } else { $curl.=" $url &gt;return-$i 2&gt;/dev/null &amp;"; } return("$curl "); } $to_run=''; for ($i=0; $i&lt;$max; $i++) { $url='http://www.some_url_to_the_same_server.com/post.php'; $post_data="var=web-$i"; $to_run.=my_curl($i, $url, $post_data, $return, $auth, $proxy, $timeout); } file_put_contents(realpath($_SERVER["DOCUMENT_ROOT"]).'/run_data/runner.sh',$to_run); shell_exec('/bin/bash '.realpath($_SERVER["DOCUMENT_ROOT"]).'/run_data/runner.sh'); </code></pre> <p>I have a 3CPU linux centos server. I know that I should not have more than 12 procs r for my system, however it is a lot more (see below). When I run the above script and fire 100 php scripts at once I see the below vmstat.</p> <pre><code>procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ r b swpd free buff cache si so bi bo in cs us sy id wa st 30 0 60 90388 14428 223996 0 0 20 10 3 10 0 0 99 1 0 </code></pre> <p>When the system is in "rest" I get the below output:</p> <pre><code>procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ r b swpd free buff cache si so bi bo in cs us sy id wa st 0 0 60 155064 14672 223952 0 0 20 10 3 10 0 0 99 1 0 </code></pre> <p>As procs r shows that there is a CPU overload I don't understand how the CPU shows 99% idle and procs r very high at the same time.</p> <p>What can I do to improve the performance of my system such that all the 100 scripts are fired at once?</p> <p>Your help is very appreciated.</p> <p><strong>UPDATE 1:</strong></p> <p>This is the relevant part of my httpd.conf file:</p> <pre><code>User apache Group apache KeepAlive On KeepAliveTimeout 30 ServerAdmin admin@localhost DocumentRoot "/var/www/html" MaxClients 50 MaxRequestsPerChild 50 StartServers 5 MinSpareServers 5 MaxSpareServers 20 MaxKeepAliveRequests 50 </code></pre> </div>

动态创建结构

<div class="post-text" itemprop="text"> <p>This script does not work. How may I create a new struc dynamically by getting the types of incoming variables like proc.ReadStat ? (type of proc.ReadStat is *linux.Stat as shown by reflect.TypeOf() )</p> <pre><code>package main import ( "fmt" "reflect" //"html" "log" "net/http" //"time" "encoding/json" "github.com/gorilla/mux" proc "github.com/c9s/goprocinfo/linux" ) func sysinfo(w http.ResponseWriter, r *http.Request) { sstat, _ := proc.ReadStat("/proc/stat") sdiskstats, _ := proc.ReadDiskStats("/proc/diskstats") sloadavg, _ := proc.ReadLoadAvg("/proc/loadavg") smeminfo,_ := proc.ReadMemInfo("/proc/meminfo") smounts, _ := proc.ReadMounts("/proc/mounts") snetstat, _ := proc.ReadNetStat("/proc/net/netstat") sdevstat, _ := proc.ReadNetworkStat("/proc/net/dev") ssockstat, _ := proc.ReadSockStat("/proc/net/sockstat") svmstat, _ := proc.ReadVMStat("/proc/vmstat") t /* type Info interface { stat *linux.Stat diskstats []linux.DiskStat loadavg *linux.LoadAvg meminfo *linux.MemInfo mounts *linux.Mounts netstat *linux.NetStat devstat []linux.NetworkStat sockstat *linux.SockStat vmstat *linux.VMStat }*/ type Info struct { stat reflect.TypeOf(sstat) diskstats reflect.TypeOf(sdiskstats) loadavg reflect.TypeOf(sloadavg) meminfo reflect.TypeOf(smeminfo) mounts reflect.TypeOf(smounts) netstat reflect.TypeOf(snetstat) devstat reflect.TypeOf(sdevstat) sockstat reflect.TypeOf(ssockstat) vmstat reflect.TypeOf(svmstat) } type infos []Info infos := info{ stat : sstat, diskstats : sdiskstats, loadavg : sloadavg, meminfo : smeminfo, mounts : smounts, netstat : snetstat, devstat : sdevstat, sockstat : ssockstat, vmstat : svmstat, } json.NewEncoder(w).Encode(infos) } func main() { router := mux.NewRouter().StrictSlash(true) router.HandleFunc("/", sysinfo) log.Fatal(http.ListenAndServe(":8080", router)) } </code></pre> </div>

转到os / exec命令参数问题[重复]

<div class="post-text" itemprop="text"> <div class="question-status question-originals-of-duplicate"> <p>This question already has an answer here:</p> <ul> <li> <a href="/questions/24427615/calling-command-with-some-arguments-works-but-not-with-others-bu-wotrks-from-con" dir="ltr">calling command with some arguments works but not with others bu wotrks from console</a> <span class="question-originals-answer-count"> 1 answer </span> </li> </ul> </div> <p>I wrote some code in Go to call vmstat to pull some statistics data. There are several variations to the cmdArgs and I annotated which are working and which are not:</p> <pre><code>1 package main 2 3 import ( 4 "bufio" 5 "fmt" 6 "os" 7 "os/exec" 8 ) 9 10 func main() { 11 // cmdName := "sar" 12 // cmdArgs := []string{"-n DEV 1 1"} 13 cmdName := "vmstat" 14 15 // cmdArgs := []string{"-tSm 1 1"} //&lt;--- This works but does 16 // not produce desired output 17 18 cmdArgs := []string{"-t -Sm 1 1"} //&lt;--- This works but does 19 // not produce desired output 20 21 // cmdArgs := []string{"-Sm 1 1", "-t"} //&lt;--- This does NOT work 22 // cmdArgs := []string{"-t","-Sm 1 1"} //&lt;--- This does NOT work 23 24 cmd := exec.Command(cmdName, cmdArgs...) 25 cmdReader, err := cmd.StdoutPipe() 26 if err != nil { 27 fmt.Fprintln(os.Stderr, "Error creating StdoutPipe for Cmd", err) 28 os.Exit(1) 29 } 30 31 scanner := bufio.NewScanner(cmdReader) 32 go func() { 33 for scanner.Scan() { 34 fmt.Printf("%s ", scanner.Text()) 35 } 36 }() 37 38 err = cmd.Start() 39 if err != nil { 40 fmt.Fprintln(os.Stderr, "Error starting Cmd", err) 41 os.Exit(1) 42 } 43 44 err = cmd.Wait() 45 if err != nil { 46 fmt.Fprintln(os.Stderr, "Error waiting for Cmd", err) 47 os.Exit(1) 48 } 49 } </code></pre> <p>Bottom line is I want to get the data in Megabytes and if I run the following on my shell, it works:</p> <pre><code># vmstat -t -Sm 1 1 procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ ---timestamp--- r b swpd free buff cache si so bi bo in cs us sy id wa st 0 1 201 4544 190 7970 0 0 85 32 1 1 1 0 97 2 0 2018-06-21 16:52:13 EDT # vmstat -Sm -t 1 1 procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ ---timestamp--- r b swpd free buff cache si so bi bo in cs us sy id wa st 0 1 201 4496 191 8012 0 0 85 32 1 1 1 0 97 2 0 2018-06-21 16:52:33 EDT </code></pre> <p>My question is - what is the acceptable way to arrange the arguments and still get the desired output? Also, I have a similar issue with sar(I am trying to pull network interface stats), but I cannot get it to accept any variation of the arguments:</p> <pre><code> 1 package main 2 3 import ( 4 "bufio" 5 "fmt" 6 "os" 7 "os/exec" 8 ) 9 10 func main() { 11 cmdName := "sar" 12 cmdArgs := []string{"-n DEV 1 1"} //&lt;--- This does NOT work 13 14 // cmdArgs := []string{"-n DEV","1 1"} //&lt;--- This does NOT work 15 16 cmd := exec.Command(cmdName, cmdArgs...) 17 cmdReader, err := cmd.StdoutPipe() 18 if err != nil { 19 fmt.Fprintln(os.Stderr, "Error creating StdoutPipe for Cmd", err) 20 os.Exit(1) 21 } 22 23 scanner := bufio.NewScanner(cmdReader) 24 go func() { 25 for scanner.Scan() { 26 fmt.Printf("%s ", scanner.Text()) 27 } 28 }() 29 30 err = cmd.Start() 31 if err != nil { 32 fmt.Fprintln(os.Stderr, "Error starting Cmd", err) 33 os.Exit(1) 34 } 35 36 err = cmd.Wait() 37 if err != nil { 38 fmt.Fprintln(os.Stderr, "Error waiting for Cmd", err) 39 os.Exit(1) 40 } 41 } </code></pre> <p>Here is how I call sar from the shell:</p> <pre><code>$ sar -n DEV 1 1 Linux 2.6.32-696.18.7.el6.x86_64 (invenioq.gmu.edu) 06/21/2018 _x86_64_ (2 CPU) 05:08:56 PM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 05:08:57 PM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 05:08:57 PM eth0 3.96 0.00 0.24 0.00 0.00 0.00 0.00 05:08:57 PM eth1 2.97 0.00 0.17 0.00 0.00 0.00 0.00 Average: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s Average: lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 Average: eth0 3.96 0.00 0.24 0.00 0.00 0.00 0.00 Average: eth1 2.97 0.00 0.17 0.00 0.00 0.00 0.00 </code></pre> <p>I appreciate any feedback/help. Thank you</p> </div>

CPU 的上下文切换数 突然异常升高,又突然下降 ,怎么调试异常?

``` 服务器的cpu 上下文切换数 突然升高,然后又马上下降,前后不过十几秒,期间服务器都不能执行命令,不知道是什么原因导致的,不知道用什么方法去调试,已知这是个高并发的java应用,最近几天的流量并未有明显的变化, ``` vmstat 1 监控图如下: ![图片说明](https://img-ask.csdn.net/upload/201906/19/1560921199_732194.png) zabbix的监控图如下: ![图片说明](https://img-ask.csdn.net/upload/201906/19/1560921706_784950.png)

linux内存充足但java报 不能申请到内存

OS:centos7 [ykt@yhbd-011 hadoop]$ uname -a Linux yhbd-011 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux [ykt@yhbd-011 hadoop]$ java -version java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode) 开始运行SPARK任务后(该节点注册200G内存),不能再申请JVM,已运行的JAVA进程也可能报错。如下: [ykt@yhbd-011 hadoop]$ java -version Error occurred during initialization of VM Could not reserve enough space for object heap Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. [ykt@yhbd-011 hadoop]$ free -g total used free shared buff/cache available Mem: 503 109 1 8 392 385 Swap: 46 0 46 [ykt@yhbd-011 hadoop]$ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 2062565 max locked memory (kbytes, -l) 1024 max memory size (kbytes, -m) unlimited open files (-n) 65536 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 60000 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited [ykt@yhbd-010 sbin]$ ulimit -a -H core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 2062565 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 65536 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) unlimited cpu time (seconds, -t) unlimited max user processes (-u) 2062565 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited [ykt@yhbd-011 hadoop]$ jps Error occurred during initialization of VM Could not reserve enough space for object heap Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. [ykt@yhbd-011 hadoop]$ cat /proc/loadavg 33.95 13.65 7.01 23/2586 158650 [ykt@yhbd-011 hadoop]$ cat /proc/meminfo MemTotal: 528038572 kB MemFree: 1220568 kB MemAvailable: 443702696 kB Buffers: 515228 kB Cached: 443081564 kB SwapCached: 3720 kB Active: 296629196 kB Inactive: 217739768 kB Active(anon): 74540456 kB Inactive(anon): 5041016 kB Active(file): 222088740 kB Inactive(file): 212698752 kB Unevictable: 0 kB Mlocked: 0 kB SwapTotal: 48776184 kB SwapFree: 48747648 kB Dirty: 769960 kB Writeback: 0 kB AnonPages: 70770396 kB Mapped: 2974732 kB Shmem: 8807272 kB Slab: 8223164 kB SReclaimable: 8032496 kB SUnreclaim: 190668 kB KernelStack: 41920 kB PageTables: 416692 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 312795468 kB Committed_AS: 288057748 kB VmallocTotal: 34359738367 kB VmallocUsed: 1110088 kB VmallocChunk: 34090206704 kB HardwareCorrupted: 0 kB AnonHugePages: 64978944 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 177184 kB DirectMap2M: 4902912 kB DirectMap1G: 533725184 kB [ykt@yhbd-011 hadoop]$ vmstat 5 5 procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 20 0 28536 1205320 511080 451261120 0 0 80 145 0 2 2 0 98 0 0 20 1 28536 1230880 507240 451189664 0 0 436039 24046 48238 18268 46 3 49 2 0 20 0 28536 1233228 507288 451152096 0 0 377784 8043 49985 21706 51 6 41 2 0 11 0 28536 1250476 507220 451097600 0 0 295318 15249 40533 15827 45 3 50 1 0 7 0 28536 1382224 507196 450526816 0 0 29652 16351 31081 12710 10 3 87 0 0

linux io 读取文件问题

![图片说明](https://img-ask.csdn.net/upload/201504/05/1428248129_272877.jpg) 我遇到一个困扰了我很久的问题, 到时我项目挂掉好多次, 每次读硬盘过高时,项目就会挂, 我现在想问的是: 谁能告诉我, 是读哪些文件名字? linux 下面怎么查看呢...我不需要实时监控的vmstat,iostat命令哦..

java 内存问题

resin版本3.1 java版本1.5 操作系统版本 centos 4.6 服务器的cpu消耗很低,但内存消耗很快,不到一个小时就吃到交换分区了,把swap分区吃完了,机器就挂掉了。我们配置的时候是Apache和resin结合使用的,apache通过6800端口把jsp传给resin处理。 resin.conf 配置文件里面配置有5个HOST,另外jvm的配置参数是这样的: [code="java"] <jvm-arg>-Xmx2048m</jvm-arg> <jvm-arg>-Xms2048m</jvm-arg> <jvm-arg>-XX:MaxPermSize=128m</jvm-arg> <jvm-arg>-Xmn1200m</jvm-arg> <jvm-arg>-XX:ParallelGCThreads=20</jvm-arg> <jvm-arg>-XX:+UseConcMarkSweepGC</jvm-arg> <jvm-arg>-XX:+UseParNewGC</jvm-arg> <jvm-arg>-Xss1m</jvm-arg> <jvm-arg>-Xdebug</jvm-arg> [/code] top结果: top - 16:47:38 up 1 day, 2:23, 1 user, load average: 5.30, 3.81, 1.82 Tasks: 128 total, 2 running, 126 sleeping, 0 stopped, 0 zombie Cpu(s): 1.2% us, 13.3% sy, 0.0% ni, 71.3% id, 14.1% wa, 0.0% hi, 0.1% si Mem: 8161396k total, 8137632k used, 23764k free, 388k buffers Swap: 8385920k total, 2892784k used, 5493136k free, 8320k cached [b]问题补充:[/b] java进程号8536 [code="java"] top - 21:16:07 up 1 day, 6:51, 2 users, load average: 0.16, 0.17, 0.20 Tasks: 128 total, 1 running, 127 sleeping, 0 stopped, 0 zombie Cpu(s): 1.4% us, 0.1% sy, 0.0% ni, 98.5% id, 0.1% wa, 0.0% hi, 0.0% si Mem: 8161396k total, 7809248k used, 352148k free, 14676k buffers Swap: 8385920k total, 516368k used, 7869552k free, 582428k cached PID USER PR NI %CPU TIME+ %MEM VIRT SWAP RES CODE DATA SHR S COMMAND 8536 root 16 0 11 4:35.74 84.5 8920m 2.1g 6.6g 52 8.5g 36m S java [/code] java进程占用内存87.4%,进程号8536 [code="java"] ps aux root 8536 9.2 87.4 9417572 7136552 ? Sl 20:26 4:43 /usr/local/jdk1.5.0_17/bin/java -Djava.util.logging.manager=com.caucho.log.LogManagerImpl -Djava.system.class.loader=com.caucho.loader [/code] 第二次top: [code="java"] top - 21:20:28 up 1 day, 6:55, 2 users, load average: 0.08, 0.11, 0.16 Tasks: 131 total, 1 running, 130 sleeping, 0 stopped, 0 zombie Cpu(s): 1.2% us, 0.6% sy, 0.0% ni, 97.1% id, 1.1% wa, 0.0% hi, 0.0% si Mem: 8161396k total, 8124104k used, 37292k free, 564k buffers Swap: 8385920k total, 540296k used, 7845624k free, 40192k cached PID USER PR NI %CPU TIME+ %MEM VIRT RES SHR S COMMAND 8536 root 16 0 10 5:08.40 95.8 9.8g 7.5g 28m S java 121 root 16 0 4 35:51.87 0.0 0 0 0 D kswapd0 [/code] 第三次top: [code="java"] top - 21:23:00 up 1 day, 6:58, 2 users, load average: 0.14, 0.16, 0.17 Tasks: 131 total, 1 running, 130 sleeping, 0 stopped, 0 zombie Cpu(s): 1.6% us, 0.2% sy, 0.0% ni, 97.9% id, 0.2% wa, 0.0% hi, 0.0% si Mem: 8161396k total, 8125048k used, 36348k free, 1060k buffers Swap: 8385920k total, 1082024k used, 7303896k free, 38212k cached PID USER PR NI %CPU TIME+ %MEM VIRT SWAP RES CODE DATA SHR S COMMAND 8536 root 16 0 14 5:27.79 97.1 10.5g 2.9g 7.6g 52 10g 28m S java 121 root 15 0 2 35:54.77 0.0 0 0 0 0 0 0 S kswapd0 [/code] 第四次top: [code="java"] Tasks: 131 total, 1 running, 130 sleeping, 0 stopped, 0 zombie Cpu0 : 2.8% us, 0.4% sy, 0.0% ni, 95.7% id, 0.9% wa, 0.0% hi, 0.1% si Cpu1 : 0.6% us, 0.3% sy, 0.0% ni, 98.7% id, 0.4% wa, 0.0% hi, 0.0% si Cpu2 : 0.7% us, 1.2% sy, 0.0% ni, 96.4% id, 1.7% wa, 0.0% hi, 0.0% si Cpu3 : 0.6% us, 0.5% sy, 0.0% ni, 98.3% id, 0.7% wa, 0.0% hi, 0.0% si Cpu4 : 0.5% us, 0.3% sy, 0.0% ni, 98.7% id, 0.4% wa, 0.0% hi, 0.0% si Cpu5 : 0.6% us, 0.3% sy, 0.0% ni, 98.7% id, 0.4% wa, 0.0% hi, 0.0% si Cpu6 : 0.7% us, 0.7% sy, 0.0% ni, 97.7% id, 1.0% wa, 0.0% hi, 0.0% si Cpu7 : 0.5% us, 0.3% sy, 0.0% ni, 98.8% id, 0.4% wa, 0.0% hi, 0.0% si Mem: 8161396k total, 8113456k used, 47940k free, 292k buffers Swap: 8385920k total, 1564668k used, 6821252k free, 32044k cached PID USER PR NI %CPU TIME+ %MEM VIRT RES SHR S COMMAND 8536 root 16 0 9 5:55.63 97.8 11.1g 7.6g 26m S java 121 root 15 0 4 36:12.40 0.0 0 0 0 S kswapd0 [/code] [code="java"] ps aux root 8536 10.0 97.5 11760484 7962748 ? Sl 20:26 5:58 /usr/local/jdk1.5.0_17/bin/java -Djava.util.logging.manager=com.caucho.log.LogManagerImpl -Djava.system.class.loader=com.caucho.loader [/code] 第五次top(swap已经到2G了): [code="java"] top - 21:29:20 up 1 day, 7:04, 2 users, load average: 5.53, 2.84, 1.23 Tasks: 131 total, 2 running, 129 sleeping, 0 stopped, 0 zombie Cpu(s): 1.0% us, 9.8% sy, 0.0% ni, 68.4% id, 20.8% wa, 0.0% hi, 0.0% si Mem: 8161396k total, 8122488k used, 38908k free, 280k buffers Swap: 8385920k total, 2263088k used, 6122832k free, 29776k cached PID USER PR NI %CPU TIME+ %MEM VIRT RES SHR S COMMAND 121 root 16 0 95 37:43.77 0.0 0 0 0 R kswapd0 32161 root 16 0 19 17:29.02 0.1 1079m 5600 3528 S java 8536 root 16 0 19 6:43.04 98.3 11.9g 7.7g 25m S java [/code] [code="java"] ps aux root 8536 10.7 98.3 12598116 8025284 ? Sl 20:26 6:48 /usr/local/jdk1.5.0_17/bin/java -Djava.util.logging.manager=com.caucho.log.LogManagerImpl -Djava.system.class.loader=com.caucho.loader [/code] 检测内存分配: [code="java"] vmstat 5 procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 1 0 593940 38444 824 40576 26 40 32 43 2 16 1 1 98 1 0 0 622980 43740 824 40672 248 5808 248 5864 1198 1493 2 0 97 1 0 0 649200 41756 852 40756 2166 5308 2190 5347 1274 17118 1 0 94 5 0 0 669316 38108 868 40948 13 4030 13 4064 1187 869 1 0 98 1 0 0 673568 47268 888 40564 13 2203 14 2238 1220 867 1 0 98 1 0 0 679384 40572 908 40192 208 2867 211 2918 1243 924 2 0 97 2 1 0 685080 43964 840 38196 32 4185 32 4220 1286 5405 2 0 97 2 0 0 685280 43068 872 38108 150 3086 174 3128 1502 940 1 0 93 6 0 0 683952 46964 776 36468 814 4018 821 4069 1452 989 1 0 92 6 0 3 685628 46612 808 36516 131 5669 134 5706 1360 940 2 0 92 6 0 1 688560 46428 312 34936 462 2614 471 2658 1372 965 2 4 89 5 0 1 690816 42140 340 33948 399 1882 491 1938 1351 1239 2 1 94 4 0 0 713104 44052 308 33548 906 6016 906 6062 1484 954 1 0 90 8 0 1 745548 36852 496 33684 2371 6489 2406 6524 1312 1132 1 0 93 5 0 0 766192 44924 620 33852 1130 4131 1183 4166 1251 1009 2 0 95 3 0 0 802552 42428 652 34012 638 7272 648 7324 1243 5389 2 0 96 2 vmstat 5 procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 0 11 2401820 31692 380 31052 27 42 33 45 3 19 1 1 98 1 1 3 2407864 37516 332 29172 3432 2327 3702 2370 1524 1221 1 14 66 20 1 0 2409332 25364 320 29164 4075 1054 4582 1090 1529 1314 1 11 72 16 1 1 2430024 25236 308 29764 3578 4680 4086 4714 1439 1249 1 12 75 12 4 2 2437212 23764 316 30032 4291 2304 4861 2362 1513 1284 1 16 71 12 7 2 2454028 23764 336 29740 5968 4057 6538 4102 1639 1492 1 40 45 14 0 0 2500428 36868 348 30840 4363 9719 4910 9735 1390 71980 0 39 46 14 [/code] [b]问题补充:[/b] @pJun; 两台机器做集群: 1.dell 2950 高配:64位,8G,CPU 8个 2.dell 2950 标配:32位,4G,CPU 8个 两台机器其它配置都一样,跑的程序也相同,但64位的内存泄露相当严重,大概一个小时就会物理内存全部耗光,swap2G全部耗光,需要重启。 32位 没这种情况,偶尔也会有一次,32位物理内存耗到只剩4 50M的时候,就不会用swap了,而是自动重启java服务进程,然后内存就会恢复到启动时候的状态。 64位机器 resin配置文件里最大线程是400, 64位的机器通过jconsole 观察垃圾回收时正常的:在resin配置文件里分配2G内存给jvm,当内存到1.5G的时候,会自动回收) 跟系统环境变量有没有关系,我感觉跟分配的线程有问题?

程序偶尔挂起一段时间

<div class="post-text" itemprop="text"> <p>I have written a simple KV database in golang, this database runs smoothly most time, however, it hangs for a few seconds occasionally.</p> <p>The version of golang and linux is:</p> <ol> <li>go version: 1.12.5</li> <li>linux version: CentOS release 6.7 (Final) 2.6.32-573.el6.x86_64</li> </ol> <p>Cpu,Mem,IO info:<a href="https://i.stack.imgur.com/Bq6Bc.png" rel="nofollow noreferrer">CPU</a>, <a href="https://i.stack.imgur.com/lfMiB.png" rel="nofollow noreferrer">MEM</a>, <a href="https://i.stack.imgur.com/c4Yjr.png" rel="nofollow noreferrer">IO</a></p> <p>I've tried some ways to debug this problem:</p> <ol> <li>Import http/pprof package and gops package, however, I fail to get process heap stack because the process is totally unresponsive when it hangs.</li> <li>Strace tool is used to get process syscalls: </li> </ol> <pre class="lang-xml prettyprint-override"><code>process 32573 attached with 178 threads [pid 172460] 11:12:25.260132 futex(0xc1dc4d0f48, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 24633] 11:12:25.260197 futex(0xc0dc3012c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 34073] 11:12:25.260209 futex(0xc33b8464c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 34071] 11:12:25.260233 futex(0xc3b259c148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 34069] 11:12:25.260264 futex(0xc1f7eef648, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 33989] 11:12:25.260275 futex(0xc368336f48, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 33988] 11:12:25.260285 futex(0xc36795cbc8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 33987] 11:12:25.260293 futex(0xc368336bc8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 33986] 11:12:25.260313 futex(0xc36795c848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 33984] 11:12:25.260320 futex(0xc36795c4c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 33983] 11:12:25.260342 futex(0xc3683364c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 33982] 11:12:25.260350 futex(0xc36795c148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 33980] 11:12:25.260360 futex(0xc0b79d1d48, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 33978] 11:12:25.260368 futex(0xc0b79d19c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 33977] 11:12:25.260376 futex(0xc3720559c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 33974] 11:12:25.260385 futex(0xc0b79d1648, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 33973] 11:12:25.260393 futex(0xc3720552c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 33972] 11:12:25.260402 futex(0xc4959e4bc8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32787] 11:12:25.260411 futex(0xc000a44f48, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32786] 11:12:25.260421 futex(0xc0d5df4848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32785] 11:12:25.260431 futex(0xc0d5e5e4c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32784] 11:12:25.260440 futex(0xc0d60184c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32782] 11:12:25.260448 futex(0xc0a0eea4c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32781] 11:12:25.260456 futex(0xc0d5c2c848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32779] 11:12:25.260465 futex(0xc00068ebc8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32777] 11:12:25.260473 futex(0xc0d5df44c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32776] 11:12:25.260482 futex(0xc0005d3648, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32775] 11:12:25.260491 futex(0xc000a059c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32774] 11:12:25.260500 futex(0xc000a772c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32773] 11:12:25.260508 futex(0xc0d5ed64c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32772] 11:12:25.260518 futex(0xc0d5df24c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32770] 11:12:25.260526 futex(0xc0d5d524c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32767] 11:12:25.260534 futex(0xc0a6c66148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32766] 11:12:25.260542 futex(0xc0d5d4e4c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32763] 11:12:25.260552 futex(0x1cdada0, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32761] 11:12:25.260561 futex(0xc000b54848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32760] 11:12:25.260569 futex(0xc000b60848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32756] 11:12:25.260578 futex(0xc0005d32c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32755] 11:12:25.260586 futex(0xc000a05648, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32754] 11:12:25.260594 futex(0xc0d5ed6148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32753] 11:12:25.260603 futex(0xc000185648, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32752] 11:12:25.260611 futex(0xc000a76f48, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32751] 11:12:25.260620 futex(0xc08a27c148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32750] 11:12:25.260629 futex(0xc0d5e5e148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32748] 11:12:25.260643 futex(0xc075230148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32747] 11:12:25.260652 futex(0xc0d5df4148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32746] 11:12:25.260659 futex(0xc075038148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32745] 11:12:25.260667 futex(0xc0d5df2148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32744] 11:12:25.260675 futex(0xc0004a12c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32743] 11:12:25.260683 futex(0xc073c7e148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32742] 11:12:25.260692 futex(0xc0d5d52148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32741] 11:12:25.260702 futex(0xc0d5d50148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32740] 11:12:25.260711 futex(0xc0d5d4e148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32739] 11:12:25.260718 futex(0xc0d5c2c148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32738] 11:12:25.260726 futex(0xc0d5c2a148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32737] 11:12:25.260734 futex(0xc000a44848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32736] 11:12:25.260742 futex(0xc000b564c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32735] 11:12:25.260750 futex(0xc000b544c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32734] 11:12:25.260758 futex(0xc000b604c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32733] 11:12:25.260766 futex(0xc000b1c4c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32732] 11:12:25.260775 futex(0xc0001a4f48, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32728] 11:12:25.260784 futex(0xc0001852c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32727] 11:12:25.260794 restart_syscall(&lt;... resuming interrupted call ...&gt; &lt;unfinished ...&gt; [pid 32725] 11:12:25.260806 futex(0xc00068e4c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32724] 11:12:25.260815 futex(0xc000aa9648, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32723] 11:12:25.260823 futex(0xc000aa92c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32722] 11:12:25.260833 futex(0xc00083abc8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32721] 11:12:25.260842 futex(0xc000868848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32718] 11:12:25.260851 futex(0xc000a76bc8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32651] 11:12:25.260859 futex(0xc000aa8bc8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32650] 11:12:25.260867 futex(0xc000aa8848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32649] 11:12:25.260875 futex(0xc0008eb648, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32648] 11:12:25.260883 futex(0xc00097dd48, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32647] 11:12:25.260891 futex(0xc00097d9c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32646] 11:12:25.260899 futex(0xc00097d648, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32644] 11:12:25.260908 futex(0xc0009e1d48, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32643] 11:12:25.260918 futex(0xc0008eaf48, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32642] 11:12:25.260926 futex(0xc0008eabc8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32639] 11:12:25.260935 futex(0xc00097d2c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32638] 11:12:25.260945 futex(0xc00097cf48, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32637] 11:12:25.260954 futex(0xc0009e1648, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32635] 11:12:25.260963 futex(0xc0008ea4c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32634] 11:12:25.260971 futex(0xc00097c848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32633] 11:12:25.260979 futex(0xc0009a6848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32631] 11:12:25.260986 futex(0xc0009e12c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32630] 11:12:25.260994 futex(0xc000aa84c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32629] 11:12:25.261002 futex(0xc000a76848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32628] 11:12:25.261009 futex(0xc000a04bc8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32627] 11:12:25.261024 futex(0xc000b60148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32626] 11:12:25.261032 futex(0xc000a04848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32625] 11:12:25.261040 futex(0xc000b54148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32624] 11:12:25.261047 futex(0xc000b56148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32623] 11:12:25.261067 futex(0xc0009e0f48, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32621] 11:12:25.261076 futex(0xc0009e0bc8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32620] 11:12:25.261083 futex(0xc0009e0848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32619] 11:12:25.261101 futex(0xc00083a848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32618] 11:12:25.261110 futex(0xc0000f59c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32617] 11:12:25.261118 futex(0xc000a044c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32616] 11:12:25.261127 futex(0xc00097c4c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32613] 11:12:25.261136 futex(0xc0005d2bc8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32612] 11:12:25.261144 futex(0xc000184f48, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32611] 11:12:25.261152 futex(0xc0009e04c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32610] 11:12:25.261160 futex(0xc000a444c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32609] 11:12:25.261169 futex(0xc000a764c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32608] 11:12:25.261178 futex(0xc000aa8148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32606] 11:12:25.261186 futex(0xc000a44148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32604] 11:12:25.261194 futex(0xc0009e0148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32603] 11:12:25.261207 futex(0xc0009a6148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32602] 11:12:25.261216 futex(0xc00097c148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32601] 11:12:25.261224 futex(0xc0008ea148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32600] 11:12:25.261232 futex(0xc000868148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32598] 11:12:25.261240 restart_syscall(&lt;... resuming interrupted call ...&gt; &lt;unfinished ...&gt; [pid 32596] 11:12:25.261249 futex(0xc0000c3648, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32595] 11:12:25.261257 futex(0xc0004a0848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32594] 11:12:25.261266 futex(0xc000184848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32593] 11:12:25.261276 futex(0xc0005d2848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32592] 11:12:25.261285 futex(0xc0000f5648, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32590] 11:12:25.261294 futex(0xc0001a4848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32588] 11:12:25.261302 futex(0xc0005d2148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32587] 11:12:25.261310 futex(0xc0000f4f48, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32586] 11:12:25.261318 futex(0xc0001a44c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32585] 11:12:25.261325 futex(0xc000184148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32584] 11:12:25.261334 futex(0xc0004a04c8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32579] 11:12:25.261343 futex(0xc0001a4148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32578] 11:12:25.261350 futex(0x1cdacb8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32577] 11:12:25.261359 futex(0xc0000f4148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32575] 11:12:25.261368 futex(0xc0000c2848, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32574] 11:12:25.261377 restart_syscall(&lt;... resuming interrupted call ...&gt; &lt;unfinished ...&gt; [pid 32573] 11:12:25.261385 futex(0x1cbe8e8, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32574] 11:12:25.264099 &lt;... restart_syscall resumed&gt; ) = 0 &lt;0.002704&gt; [pid 32574] 11:12:25.264131 epoll_pwait(4&lt;[eventpoll]&gt;, {}, 128, 0, NULL) = 0 &lt;0.000014&gt; </code></pre> <pre class="lang-xml prettyprint-override"><code>[pid 32574] 11:12:25.264197 nanosleep({0, 10000000}, &lt;unfinished ...&gt; [pid 34072] 11:12:31.236049 read(16699&lt;socket:[371657496]&gt;, &lt;unfinished ...&gt; </code></pre> <pre class="lang-xml prettyprint-override"><code>[pid 34070] 11:12:31.236128 read(16691&lt;socket:[371657488]&gt;, &lt;unfinished ...&gt; [pid 33985] 11:12:31.236142 sched_yield( &lt;unfinished ...&gt; [pid 33981] 11:12:31.236161 futex(0xc06ed9c148, FUTEX_WAKE_PRIVATE, 1 &lt;unfinished ...&gt; [pid 33979] 11:12:31.236171 futex(0xc0d5df44c8, FUTEX_WAKE_PRIVATE, 1 &lt;unfinished ...&gt; [pid 33976] 11:12:31.236178 futex(0xc3720552c8, FUTEX_WAKE_PRIVATE, 1 &lt;unfinished ...&gt; [pid 33971] 11:12:31.236193 read(7443&lt;socket:[371660645]&gt;, &lt;unfinished ...&gt; [pid 33975] 11:12:31.236243 futex(0xc0004a12c8, FUTEX_WAKE_PRIVATE, 1 &lt;unfinished ...&gt; [pid 32789] 11:12:31.236253 futex(0xc06ed9c148, FUTEX_WAIT_PRIVATE, 0, NULL &lt;unfinished ...&gt; [pid 32788] 11:12:31.236262 futex(0xc000a76bc8, FUTEX_WAKE_PRIVATE, 1 &lt;unfinished ...&gt; [pid 32783] 11:12:31.236270 read(5583&lt;socket:[371824829]&gt;, &lt;unfinished ...&gt; [pid 32780] 11:12:31.236295 read(1258&lt;socket:[371660662]&gt;, &lt;unfinished ...&gt; [pid 32778] 11:12:31.236311 read(2795&lt;socket:[371660629]&gt;, &lt;unfinished ...&gt; [pid 32771] 11:12:31.236339 read(16828&lt;socket:[371657506]&gt;, &lt;unfinished ...&gt; [pid 32769] 11:12:31.236356 read(1163&lt;socket:[371770203]&gt;, &lt;unfinished ...&gt; [pid 32768] 11:12:31.236370 read(16955&lt;socket:[371657515]&gt;, &lt;unfinished ...&gt; [pid 32765] 11:12:31.236385 read(16696&lt;socket:[371657494]&gt;, &lt;unfinished ...&gt; [pid 32764] 11:12:31.236398 futex(0xc1f7eef648, FUTEX_WAKE_PRIVATE, 1 &lt;unfinished ...&gt; [pid 32762] 11:12:31.236423 read(9849&lt;socket:[371825259]&gt;, &lt;unfinished ...&gt; [pid 32759] 11:12:31.236437 read(16944&lt;socket:[371657509]&gt;, &lt;unfinished ...&gt; [pid 32758] 11:12:31.236451 read(16684&lt;socket:[371657485]&gt;, &lt;unfinished ...&gt; [pid 32757] 11:12:31.236473 read(3335&lt;socket:[371657499]&gt;, &lt;unfinished ...&gt; [pid 32749] 11:12:31.236493 read(16950&lt;socket:[371657513]&gt;, &lt;unfinished ...&gt; [pid 32731] 11:12:31.236509 futex(0xc000868148, FUTEX_WAKE_PRIVATE, 1 &lt;unfinished ...&gt; [pid 32730] 11:12:31.236518 futex(0xc0008ea4c8, FUTEX_WAKE_PRIVATE, 1 &lt;unfinished ...&gt; [pid 32729] 11:12:31.236526 futex(0xc0000f5648, FUTEX_WAKE_PRIVATE, 1 &lt;unfinished ...&gt; [pid 32726] 11:12:31.236535 futex(0xc0d5e5e4c8, FUTEX_WAKE_PRIVATE, 1 &lt;unfinished ...&gt; [pid 32720] 11:12:31.236544 read(6925&lt;socket:[371811451]&gt;, &lt;unfinished ...&gt; [pid 32719] 11:12:31.236562 read(16702&lt;socket:[371657497]&gt;, &lt;unfinished ...&gt; [pid 32717] 11:12:31.236576 read(16713&lt;socket:[371657498]&gt;, &lt;unfinished ...&gt; [pid 32645] 11:12:31.236590 read(6490&lt;socket:[371824831]&gt;, &lt;unfinished ...&gt; [pid 32640] 11:12:31.236608 futex(0xc0d5d4e148, FUTEX_WAKE_PRIVATE, 1 &lt;unfinished ...&gt; [pid 32636] 11:12:31.236619 accept4(4105, &lt;unfinished ...&gt; [pid 32632] 11:12:31.236628 read(9867&lt;socket:[371825263]&gt;, &lt;unfinished ...&gt; [pid 32615] 11:12:31.236648 read(2699&lt;socket:[371813455]&gt;, &lt;unfinished ...&gt; [pid 32614] 11:12:31.236665 futex(0xc00068e4c8, FUTEX_WAKE_PRIVATE, 1 &lt;unfinished ...&gt; </code></pre> <p>GC info(from 11:00 to 11:42):</p> <pre class="lang-xml prettyprint-override"><code>gc 4547 @519870.695s 0%: 0.64+7727+0.098 ms clock, 30+54557/86497/4449+4.7 ms cpu, 30446-&gt;36079-&gt;19800 MB, 33340 MB goal, 48 P GC forced gc 4548 @519998.441s 0%: 1.4+2698+0.028 ms clock, 70+71/32202/90622+1.3 ms cpu, 30366-&gt;30623-&gt;14272 MB, 39601 MB goal, 48 P scvg3465: 921 MB released scvg3465: inuse: 26152, idle: 73618, sys: 99771, released: 52270, consumed: 47501 (MB) GC forced gc 4549 @520121.156s 0%: 0.89+2614+0.029 ms clock, 42+244/31128/89017+1.3 ms cpu, 23255-&gt;23387-&gt;14064 MB, 28545 MB goal, 48 P scvg3466: 35 MB released scvg3466: inuse: 26928, idle: 72843, sys: 99771, released: 51276, consumed: 48494 (MB) GC forced gc 4550 @520243.784s 0%: 0.76+2723+0.036 ms clock, 36+184/32007/89703+1.7 ms cpu, 20919-&gt;21049-&gt;14074 MB, 28129 MB goal, 48 P scvg3467: 17831 MB released scvg3467: inuse: 27049, idle: 72722, sys: 99771, released: 69057, consumed: 30714 (MB) GC forced gc 4551 @520366.531s 0%: 0.78+2736+0.032 ms clock, 37+174/32370/91383+1.5 ms cpu, 20387-&gt;20478-&gt;14120 MB, 28149 MB goal, 48 P scvg3468: 1808 MB released scvg3468: inuse: 28066, idle: 71704, sys: 99771, released: 70795, consumed: 28976 (MB) GC forced gc 4552 @520489.286s 0%: 0.72+2641+0.034 ms clock, 34+258/31377/88676+1.6 ms cpu, 21277-&gt;21360-&gt;14002 MB, 28240 MB goal, 48 P GC forced gc 4553 @520611.942s 0%: 0.41+2648+0.029 ms clock, 20+58/31402/89121+1.4 ms cpu, 21806-&gt;21897-&gt;14362 MB, 28005 MB goal, 48 P scvg3469: 34 MB released scvg3469: inuse: 26701, idle: 73069, sys: 99771, released: 69940, consumed: 29830 (MB) GC forced gc 4554 @520734.608s 0%: 0.55+2685+0.038 ms clock, 26+147/32051/88317+1.8 ms cpu, 21565-&gt;21877-&gt;14352 MB, 28725 MB goal, 48 P scvg3470: 39 MB released scvg3470: inuse: 26641, idle: 73130, sys: 99771, released: 69576, consumed: 30195 (MB) GC forced gc 4555 @520857.307s 0%: 0.43+2614+0.031 ms clock, 20+0.31/31264/91012+1.5 ms cpu, 20760-&gt;20849-&gt;14183 MB, 28704 MB goal, 48 P scvg3471: 394 MB released scvg3471: inuse: 27167, idle: 72604, sys: 99771, released: 69929, consumed: 29841 (MB) GC forced gc 4556 @520979.937s 0%: 0.51+2716+0.026 ms clock, 24+116/32239/91899+1.2 ms cpu, 22069-&gt;22175-&gt;14134 MB, 28366 MB goal, 48 P scvg3472: 720 MB released scvg3472: inuse: 27667, idle: 72104, sys: 99771, released: 69954, consumed: 29817 (MB) GC forced gc 4557 @521102.679s 0%: 0.45+2737+0.051 ms clock, 21+38/32726/89390+2.4 ms cpu, 21606-&gt;21995-&gt;14750 MB, 28269 MB goal, 48 P scvg3473: 25 MB released scvg3473: inuse: 32397, idle: 67369, sys: 99766, released: 66966, consumed: 32800 (MB) GC forced gc 4558 @521225.432s 0%: 6.2+2703+0.037 ms clock, 300+104/32314/90152+1.7 ms cpu, 27118-&gt;27332-&gt;14253 MB, 29500 MB goal, 48 P GC forced gc 4559 @521348.157s 0%: 10+2655+0.028 ms clock, 521+447/31809/89384+1.3 ms cpu, 23382-&gt;23651-&gt;14316 MB, 28507 MB goal, 48 P scvg3474: 51 MB released scvg3474: inuse: 26034, idle: 73736, sys: 99771, released: 66841, consumed: 32930 (MB) GC forced gc 4560 @521470.837s 0%: 9.8+2605+0.026 ms clock, 474+143/30936/90046+1.2 ms cpu, 22733-&gt;22833-&gt;14100 MB, 28632 MB goal, 48 P scvg3475: 79 MB released scvg3475: inuse: 26480, idle: 73290, sys: 99771, released: 66906, consumed: 32864 (MB) GC forced gc 4561 @521593.476s 0%: 0.41+2615+0.046 ms clock, 19+159/30798/88548+2.2 ms cpu, 20629-&gt;20769-&gt;14033 MB, 28201 MB goal, 48 P scvg3476: 2438 MB released scvg3476: inuse: 27789, idle: 71982, sys: 99771, released: 69305, consumed: 30465 (MB) GC forced gc 4562 @521716.106s 0%: 0.51+2673+0.051 ms clock, 24+88/32054/92490+2.4 ms cpu, 21751-&gt;21896-&gt;14198 MB, 28066 MB goal, 48 P scvg3477: 1294 MB released scvg3477: inuse: 29695, idle: 70076, sys: 99771, released: 69666, consumed: 30104 (MB) GC forced gc 4563 @521838.810s 0%: 0.47+2635+0.028 ms clock, 22+111/31434/90845+1.3 ms cpu, 22623-&gt;22705-&gt;14057 MB, 28397 MB goal, 48 P GC forced gc 4564 @521961.461s 0%: 0.46+2727+0.031 ms clock, 22+155/32528/93412+1.5 ms cpu, 19763-&gt;19851-&gt;14138 MB, 28114 MB goal, 48 P scvg3478: 142 MB released scvg3478: inuse: 25743, idle: 74027, sys: 99771, released: 69729, consumed: 30042 (MB) GC forced gc 4565 @522084.205s 0%: 0.44+2657+0.029 ms clock, 21+214/31701/90716+1.4 ms cpu, 20424-&gt;20514-&gt;14179 MB, 28276 MB goal, 48 P scvg3479: 28 MB released scvg3479: inuse: 28391, idle: 71380, sys: 99771, released: 69228, consumed: 30543 (MB) GC forced gc 4566 @522206.879s 0%: 0.38+2652+0.033 ms clock, 18+108/31342/90698+1.6 ms cpu, 23690-&gt;23781-&gt;14146 MB, 28359 MB goal, 48 P scvg3480: 557 MB released scvg3480: inuse: 27188, idle: 72582, sys: 99771, released: 68737, consumed: 31034 (MB) GC forced gc 4567 @522329.545s 0%: 0.55+2585+0.031 ms clock, 26+47/30887/89360+1.5 ms cpu, 22082-&gt;22182-&gt;14378 MB, 28292 MB goal, 48 P scvg3481: 27 MB released scvg3481: inuse: 28056, idle: 71715, sys: 99771, released: 67790, consumed: 31981 (MB) </code></pre> <p>Vmstat info:</p> <pre class="lang-xml prettyprint-override"><code>procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 2 0 2538448 965376 985720 193366176 0 0 7468 4144 30760 37141 3 0 97 0 0 0 0 2538448 866052 985720 193425296 0 0 6096 4796 29720 36705 4 0 95 0 0 3 2 2538448 781104 985720 193466992 0 0 8868 4888 31129 40341 3 0 97 0 0 0 0 2538448 684132 985720 193525088 0 0 6456 7256 27751 34601 4 0 95 0 0 1 0 2538448 591752 985728 193568112 0 0 7588 7448 31251 39921 2 1 97 0 0 0 1 2538596 603712 985724 193519232 0 148 9192 5040 85975 41792 3 1 96 0 0 6 1 2538824 581488 985724 193478368 0 228 12044 8736 76500 44506 3 1 96 0 0 1 0 2539052 588596 985720 193401248 0 228 17488 7708 95530 47809 5 1 94 1 0 0 0 2539228 605584 985584 193341440 0 176 7720 3880 85563 38079 3 1 97 0 0 3 0 2539344 598864 985280 193296800 0 116 9784 4296 48443 41580 3 1 96 0 0 3 0 2540228 4245764 959772 189644656 0 884 7732 4464 594631 41907 3 3 94 0 0 0 0 2540588 5716636 958540 188141504 0 360 12832 35124 240269 37573 3 1 96 0 0 2 0 2540588 5614180 958540 188207216 0 0 13784 2984 27044 34481 2 0 97 0 0 0 0 2540588 5433884 958560 188269600 0 0 9644 538844 51809 47156 3 1 94 2 0 3 0 2540588 5333084 958584 188335344 0 0 15500 552292 53730 74434 2 1 93 4 0 4 0 2540588 5201944 958588 188409344 0 0 20760 5628 31898 40993 3 1 96 0 0 3 0 2540588 5110636 958588 188476512 0 0 17764 8540 29821 38110 3 1 97 0 0 0 0 2540588 4966540 958596 188550064 0 0 18972 4364 29049 35744 3 1 96 0 0 1 0 2540588 4816128 958604 188614416 0 0 14372 3448 29185 36645 3 1 97 0 0 0 0 2540588 4655996 958612 188687328 0 0 20540 16648 29179 36005 3 1 96 0 0 0 0 2540588 4476048 958620 188754208 0 0 16456 4308 29029 35896 3 1 96 0 0 procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 1 0 2540588 4333448 958620 188818256 0 0 13888 13564 26797 32078 3 1 97 0 0 0 0 2540588 4117432 958620 188887184 0 0 15688 3948 29182 35576 3 1 96 0 0 6 0 2540588 3933804 958620 188948192 0 0 9872 1600 26391 31619 3 1 96 0 0 1 0 2540588 3753960 958628 189011008 0 0 11588 4104 32898 39632 3 1 96 0 0 2 0 2540588 3577940 958632 189074000 0 0 12528 4576 28383 36093 2 1 97 0 0 50 0 2540588 3457128 958648 189134080 0 0 8516 182148 67199 31207 47 1 51 1 0 49 0 2540588 3654512 958664 188890368 0 0 8172 42092 77663 13805 91 1 8 0 0 37 11 2540588 3532092 958664 188962656 0 0 23604 7932 67246 12802 92 1 6 1 0 2 0 2540588 3423520 958676 189049424 0 0 41140 36392 49538 38934 30 1 67 3 0 13 0 2540588 3353936 958676 189119248 0 0 14636 3820 31720 37868 6 1 94 0 0 1 0 2540588 3288452 958684 189185456 0 0 14984 10288 27419 29717 5 1 94 0 0 0 0 2540588 3228116 958684 189244896 0 0 8464 3180 27235 33955 2 0 97 0 0 2 0 2540588 3181408 958684 189290576 0 0 11088 2968 27061 32916 3 0 97 0 0 0 0 2540588 3115948 958692 189356912 0 0 13488 22464 30301 38231 2 0 97 0 0 1 0 2540588 3049144 958700 189423712 0 0 13900 4504 30000 37108 3 1 96 0 0 1 0 2540588 2985992 958708 189486880 0 0 12216 10648 28751 34676 2 0 97 0 0 1 0 2540588 2922520 958708 189551104 0 0 13076 3224 28077 34695 3 0 97 0 0 0 1 2540588 2863000 958708 189611968 0 0 6900 2748 27320 34072 3 0 97 0 0 1 0 2540588 2799620 958720 189674800 0 0 13164 18360 29380 36358 3 1 96 0 0 0 0 2540588 2746148 958728 189727936 0 0 12840 4884 29313 37243 2 0 97 0 0 1 0 2540588 2686116 958740 189788928 0 0 8024 33552 28742 34802 3 0 97 0 0 </code></pre> <p>as the second strace info block shown, when the time was between 11:12:25.264197 and 11:12:31.236049, no syscall was invoked, but the client was still writing data to this database.</p> <p>I have no ideas about what the process is doing when the process hangs.</p> <p><strong>Any suggestions to help me investigate this problem?</strong></p> <p><strong>Is there any tools to get process stack when the process hangs?</strong></p> <p>Maybe I need the answer to this question: <a href="https://stackoverflow.com/questions/23354810/how-can-i-dump-all-a-go-processs-stacks-without-killing-it?noredirect=1&amp;lq=1">How can I dump all a Go process's stacks without killing it?</a></p> </div>

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

点沙成金:英特尔芯片制造全过程揭密

“亚马逊丛林里的蝴蝶扇动几下翅膀就可能引起两周后美国德州的一次飓风……” 这句人人皆知的话最初用来描述非线性系统中微小参数的变化所引起的系统极大变化。 而在更长的时间尺度内,我们所生活的这个世界就是这样一个异常复杂的非线性系统…… 水泥、穹顶、透视——关于时间与技艺的蝴蝶效应 公元前3000年,古埃及人将尼罗河中挖出的泥浆与纳特龙盐湖中的矿物盐混合,再掺入煅烧石灰石制成的石灰,由此得来了人...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

你打算用Java 8一辈子都不打算升级到Java 14,真香

我们程序员应该抱着尝鲜、猎奇的心态,否则就容易固步自封,技术停滞不前。

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

一文带你入门Java Stream流,太强了

两个星期以前,就有读者强烈要求我写一篇 Java Stream 流的文章,我说市面上不是已经有很多了吗,结果你猜他怎么说:“就想看你写的啊!”你看你看,多么苍白的喜欢啊。那就“勉为其难”写一篇吧,嘻嘻。 单从“Stream”这个单词上来看,它似乎和 java.io 包下的 InputStream 和 OutputStream 有些关系。实际上呢,没毛关系。Java 8 新增的 Stream 是为...

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

我说我懂多线程,面试官立马给我发了offer

不小心拿了几个offer,有点烦

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

2020春招面试了10多家大厂,我把问烂了的数据库事务知识点总结了一下

2020年截止目前,我面试了阿里巴巴、腾讯、美团、拼多多、京东、快手等互联网大厂。我发现数据库事务在面试中出现的次数非常多。

爬虫(101)爬点重口味的

小弟最近在学校无聊的很哪,浏览网页突然看到一张图片,都快流鼻血。。。然后小弟冥思苦想,得干一点有趣的事情python 爬虫库安装https://s.taobao.com/api?_ks...

在拼多多上班,是一种什么样的体验?我心态崩了呀!

之前有很多读者咨询我:武哥,在拼多多上班是一种什么样的体验?由于一直很忙,没抽出时间来和大家分享。上周末特地花点时间来写了一篇文章,跟大家分享一下拼多多的日常。 1. 倒时差的作息 可能很多小伙伴都听说了,拼多多加班很严重。这怎么说呢?作息上确实和其他公司有点区别,大家知道 996,那么自然也就能理解拼多多的“11 11 6”了。 所以当很多小伙伴早上出门时,他们是这样的: 我们是这样的: 当...

应聘3万的职位,有必要这么刁难我么。。。沙雕。。。

又一次被面试官带到坑里面了。面试官:springmvc用过么?我:用过啊,经常用呢面试官:springmvc中为什么需要用父子容器?我:嗯。。。没听明白你说的什么。面试官:就是contr...

立即提问
相关内容推荐