#
系統這兩天出現了長時間的full gc, 使用-XX:+UseConcMarkSweepGC后,系統正常
5.4 The Concurrent Low Pause Collector
The concurrent low pause collector is a generational collector similar to the serial collector. The tenured generation is collected concurrently with this collector.
This collector attempts to reduce the pause times needed to collect the tenured generation. It uses a separate garbage collector thread to do parts of the major collection concurrently with the applications threads. The concurrent collector is enabled with the command line option -XX:+UseConcMarkSweepGC. For each major collection the concurrent collector will pause all the application threads for a brief period at the beginning of the collection and toward the middle of the collection. The second pause tends to be the longer of the two pauses and multiple threads are used to do the collection work during that pause. The remainder of the collection is done with a garbage collector thread that runs concurrently with the application. The minor collections are done in a manner similar to the serial collector although multiple threads are used to do the collection. See "Parallel Minor Collection Options with the Concurrent Collector" below for information on using multiple threads with the concurrent low pause collector.
The techniques used in the concurrent collector (for the collection of the tenured generation) are described at:
http://research.sun.com/techrep/2000/abstract-88.html
http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html
print gc.log
-verbose:gc -Xloggc:gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution
系統運行一段時間后老是出現爆cpu的情況,通過jconsole查看jvm,原來是hashmap引起的,系統使用hashmap作為cache容器.
替換成高并發訪問下性能更好的ConcurrentHashMap并調整實際的initialCapacity就可以解決爆cpu的問題.
iptables -I INPUT -s 66.249.89.147 -j DROP
lftp -e "cd /home/root; mirror -R $DIRNAME; quit" -u root,$2 sftp://$1
周一公司搬家,臨時使用網通的寬帶,可惜公司的服務器放在電信機房.網通連電信實在讓人無法忍受,還好google到netpas,果然好用,試用后注冊成包月用戶(15元/月).哎,上網舒服多了.
#!/bin/sh
while :
do
PID=`cat /home/pid.file`
RUN_FLAG=`ps -p $PID | awk -v var=$PID '$1==var { print "1" }'`
if [ -n "$RUN_FLAG" ] # string is not "null".
then
echo 'running' # running
else
echo 'kao' # restart process
fi
sleep 60 # 1 minute
done
for f in $UPLOADDIR
do
if [ -f $f ]; then
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
ascii
put ${f##*/}
END_SCRIPT
fi
done
當然使用其他ftp client更加方便
http://www.columbia.edu/kermit/ftpscripts.html
date +%Y-%m-%d
DIRNAME=$(date +%Y-%m-%d)
echo $DIRNAME
Given:
foo=/tmp/my.dir/filename.tar.gz
We can use these expressions:
path = ${foo%/*}
To get: /tmp/my.dir (like dirname)
file = ${foo##*/}
To get: filename.tar.gz (like basename)
base = ${file%%.*}
To get: filename
ext = ${file#*.}
To get: tar.gz
http://linuxgazette.net/issue18/bash.html