wl Files
-
Upload
vijraajeev5534 -
Category
Documents
-
view
226 -
download
0
Transcript of wl Files
-
8/11/2019 wl Files
1/32
Classification : Public
UNIX Knowledgefor
WLA
Jawad Ahmed2008
-
8/11/2019 wl Files
2/32
Classification : Public
Todays topics File Related Commands
Process Related Commands
Resource Utilization/statistics
Other useful commands
Real-time Usage Scenarios Script Executionsforeground,
background, nohup, cron
-
8/11/2019 wl Files
3/32
Classification : Public
File related commands cat , more , tail ,touch, mkdir , rm , ln ,
ls , chmod , cp , tar , jar , find , grep
lns
find name
tarcvf /*
tarxvf
-
8/11/2019 wl Files
4/32
Classification : Public
Redirecting stdout , stderr 0filedescriptor for standard input
1 - filedescriptor for standard output
2filedescriptor for standard error
./startWeblogic > start.out
./startWeblogic > start.out 2>&1
-
8/11/2019 wl Files
5/32
Classification : Public
append and pipe ./monitorprocess.sh >> proc_mon.out
psef | grep
-
8/11/2019 wl Files
6/32
-
8/11/2019 wl Files
7/32
Classification : Public
Taking Thread dump nohup ./startWeblogic.sh > start.out 2>&1 &
psef|grep startWeblogic.sh (Find processid)
ptree (Find the child java processid)
kill -3 (send SIGQUIT to java pid)
Look PROCESS console logfile for thread
dump
-
8/11/2019 wl Files
8/32
Classification : Public
Resource Utilization/Statistics top , prstat , netstat , iostat , vmstat ,
df , du , swap
-
8/11/2019 wl Files
9/32
Classification : Public
top commandTop command will display the high CPU utilizing processes list
last pid: 16532; load averages: 1.30, 1.15, 0.7908:09:05
116 processes: 113 sleeping, 1 zombie, 1 stopped, 1 on cpuCPU states: 92.0% idle, 5.8% user, 2.2% kernel, 0.0% iowait, 0.0%swap
Memory: 16G real, 6307M free, 11G swap in use, 36G swap freePID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
3515 gspace 133 29 10 337M 279M sleep 66.0H 2.09% java14169 admin 121 0 10 1330M 825M sleep 8:46 1.74% java
10150 admin 121 0 10 1330M 771M sleep 8:14 1.55% java6076 admin 124 0 10 1351M 701M sleep 5:37 1.32% java1925 admin 139 0 10 1347M 801M sleep 8:00 1.31% java
-
8/11/2019 wl Files
10/32
Classification : Public
prstat commandprstat -a
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP14169 admin 1330M 825M sleep 0 10 0:00.42 2.1% java/12114757 admin 1266M 865M cpu546 29 10 0:00.50 1.8% java/1351925 admin 1348M 801M sleep 0 10 0:00.40 1.7% java/13910150 admin 1331M 772M sleep 0 10 0:00.42 1.7% java/121
6076 admin 1351M 710M sleep 0 10 0:00.41 1.6% java/12421947 admin 1266M 789M sleep 0 10 0:00.45 0.8% java/12027533 admin 1269M 873M sleep 0 10 0:00.46 0.6% java/11723089 admin 1282M 896M sleep 0 10 0:00.47 0.6% java/1203515 gspace 337M 279M sleep 29 10 0:02.13 0.1% java/135
NPROC USERNAME SIZE RSS MEMORY TIME CPU22 admin 11G 7098M 45% 0:06.25 11%87 root 623M 211M 1.2% 126:21.35 0.2%2 gspace 458M 343M 2.2% 0:02.17 0.2%
2 logread 3200K 2424K 0.0% 0:00.00 0.0%1 daemon 2752K 1240K 0.0% 0:00.00 0.0%
Total: 114 processes, 1927 lwps, load averages: 1.27, 1.22, 0.88
http://developers.sun.com/solaris/articles/prstat.html
-
8/11/2019 wl Files
11/32
Classification : Public
Load Average Load Average gives the load on the
system for the past 1 , 5 and 15 min.
Load Average is a measure of activeprocesses and Ready Queue (Processeswaiting to execute).
Load Average below 3 is consideredgood.
-
8/11/2019 wl Files
12/32
Classification : Public
vmstat command$ vmstat
procs memory page disk faults cpu
r b w swap free re mf pi po fr de sr s2 s3 s4 s1 in sy cs us sy id
0 0 66 1855624 192024 144 545 307 130 162 0 66 6 6 0 0 53 391 910 36 10 53
-
8/11/2019 wl Files
13/32
Classification : Public
iostat$ iostat -xt
extended disk statistics tty cpudisk r/s w/s Kr/s Kw/s wait actv svc_t %w %b tin tout us sy wt idsd0 2.6 10.0 20.7 22.7 0.1 0.2 59.2 6 19 0 84 3 85 11 0sd1 4.2 1.0 310.5 8.0 0.0 0.2 47.2 2 23
sd2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0sd3 10.2 1.6 51.4 12.8 0.1 0.3 31.2 3 31
-
8/11/2019 wl Files
14/32
Classification : Public
netstat commandNetwork statistics$ netstat -na| grep 8110
*.8110 *.* 0 0 24576 0 LISTEN10.171.1.3.35287 10.171.16.3.8110 32768 0 32768 0 ESTABLISHED
10.171.1.3.8110 10.171.16.3.35287 32768 0 32768 0 ESTABLISHED10.171.1.3.35291 10.171.16.3.8110 32768 0 32768 0 ESTABLISHED10.171.1.3.8110 10.171.16.3.35291 32768 0 32768 0 ESTABLISHED
Status could be one of the following:CLOSED - Closed. The socket is not being used.LISTEN - Listening for incoming connections.SYN_SENT - Actively trying to establish connection
SYN_RECEIVED - Initial synchronization of the connection under wayESTABLISHED - Connection has been establishedCLOSE_WAIT - Remote shut down; waiting for the socket to closeFIN_WAIT_1 - Socket closed; shutting down connectionFIN_WAIT_2 - Socket closed; waiting for shutdown from remote.TIME_WAIT - Wait after close for remote shutdown retransmission.
-
8/11/2019 wl Files
15/32
Classification : Public
df and du commands$ df -kFilesystem kbytes used avail capacity Mounted on/dev/vx/dsk/rootvol 1987399 108466 1819312 6% //dev/vx/dsk/usr 1987399 1417772 510006 74% /usr
/proc 0 0 0 0% /procfd 0 0 0 0% /dev/fdmnttab 0 0 0 0% /etc/mnttab/dev/vx/dsk/var 1987399 1522783 404995 79% /varswap 938280 16 938264 1% /var/runswap 939000 736 938264 1% /tmp/dev/vx/dsk/wkstdg/vol01
3932128 2780812 758104 79% /app01
/dev/vx/dsk/opt 9340301 7525409 1721489 82% /opt/dev/vx/dsk/wkstdg/vol02
12575932 11043215 275124 98% /export/home
$ du -sk .498368 .
-
8/11/2019 wl Files
16/32
Classification : Public
swap command
$ swap -stotal: 6799480k bytes allocated + 1737544k reserved = 8537024k used,
940392k available
$ swap -lswapfile dev swaplo blocks free/dev/vx/dsk/swapvol 227,8 16 4094704 16/dev/vx/dsk/wkstdg/extraswap 227,104002 16 8601584 720896
-
8/11/2019 wl Files
17/32
Classification : Public
Other useful commads[admin@swsweb016 ~]$ whoamiadmin
[admin@swsweb016 ~]$ who am ijawahd pts/3 Jun 3 02:13 (10.209.217.245)
[admin@swsweb016 ~]$ w08:32:52 up 214 days, 22:20, 1 user, load average: 1.28, 1.33, 1.09USER TTY FROM LOGIN@ IDLE JCPU PCPU WHATjawahd pts/3 10.209.217.245 02:13 0.00s 0.07s 0.01s
sshd: jawahd [priv]
[admin@swsweb016 ~]$ finger
Login Name Tty Idle Login Time Office OfficePhone
jawahd Jawad Ahmed pts/3 Jun 3 02:13(10.209.217.245)
[admin@swsweb016 ~]$
-
8/11/2019 wl Files
18/32
Classification : Public
-
8/11/2019 wl Files
19/32
Classification : Public
Scenario 1: High Filesystem Utilization
df -k .
dudak . |sortn|tail -50
-
8/11/2019 wl Files
20/32
Classification : Public
Scenario 2: Port conflict
netstatna| grep
getservbyport(int port_number, const
char *protocol_name)
pfiles |grep sockname |grep port
-
8/11/2019 wl Files
21/32
Classification : Public
Scenario 3: Searching log files
grepi error
grepv pattern
grepi error |wc l
-i option used for ignore case
-v option for all lines except the pattern
-
8/11/2019 wl Files
22/32
Classification : Public
Scenario 4: wrong entry in config file
find type fexec grep pattern {} \;-print
To replace the pattern
:1,$ s/oldstring/newstring/g
-
8/11/2019 wl Files
23/32
Classification : Public
Scenario 5: High CPU Utilization
10.1 Run the prstat command on the Java process.$ prstat -L -p 9499 1 1
PID USERNAME SIZE RSS STATE PRINICE TIME CPU PROCESS/LWPID
9499 usera 153M 100M sleep 58 0 0:00.22 0.6% java/89499 usera 153M 100M sleep 58 0 0:00.10 0.2% java/109499 usera 153M 100M sleep 58 0 0:00.11 0.1% java/99499 usera 153M 100M sleep 58 0 0:00.03 0.0% java/59499 usera 153M 100M sleep 58 0 0:01.01 0.0% java/19499 usera 153M 100M sleep 58 0 0:00.00 0.0% java/129499 usera 153M 100M sleep 58 0 0:00.00 0.0% java/119499 usera 153M 100M sleep 58 0 0:00.00 0.0% java/14
9499 usera 153M 100M sleep 58 0 0:00.00 0.0% java/139499 usera 153M 100M sleep 59 0 0:00.07 0.0% java/79499 usera 153M 100M sleep 59 0 0:00.00 0.0% java/69499 usera 153M 100M sleep 59 0 0:00.00 0.0% java/49499 usera 153M 100M sleep 58 0 0:00.11 0.0% java/39499 usera 153M 100M sleep 58 0 0:00.00 0.0% java/2
-
8/11/2019 wl Files
24/32
Classification : Public
10.2 Run the pstack command.
pstack 9499 > 9499_pstack.out
-
8/11/2019 wl Files
25/32
Classification : Public
10.3 Examine the pstack outputfor "lwp# 8"
-------- lwp# 8 / thread# 76 --------------------ff29d190 poll (e2e81548, 0, bb8)ff24d154 select (0, 0, 0, e2e81548, ff2bf1b4, e2e81548) + 348ff36b134 select (0, bb8, 7fffffff, fe4c8000, 0, bb8) + 34fe0f62e4 __1cCosFsleep6FpnGThread_xl_i_ (0, bb8, fe4c8000, 1, 0, 1e2fd8) + 234fe23f050 JVM_Sleep (2, 0, bb8, fe4de978, fe4c8000, 1e2fd8) + 22c
0008f7ac ???????? (e2e818d4, bb8, 1e2fd8, 984a4, 0, 109a0)0008c914 ???????? (e2e8194c, 1, fe4d6a80, 98564, 8, e2e81868)fe5324e8 __1cMStubRoutinesG_code1_ (e2e819d8, e2e81c10, a, f6cb5000, 4, e2e818f0) +3ecfe0cbe94
__1cJJavaCallsLcall_helper6FpnJJavaValue_pnMmethodHandle_pnRJavaCallArguments_pnGThread__v_ (e2e81c08,fe4c8000, e2e81b54, 1e2fd8, 8e764, e2e81c10) +308fe1f6dbc
__1cJJavaCallsMcall_virtual6FpnJJavaValue_nLKlassHandle_nMsymbolHandlee81c08,e2e81b54) + 150pnGThread__v_(f6cb64b8, e2e81b40, e2e81b44, fe4c8000, e2d8) +60e_5pnGThread__v_ (e2e81c08, e2e81c04, e2e81c00,e2e81bf4, e2e81bec, 1e2f8000,e2e81d10, 1e, e) + 120FpnKJavaThread_pnGThread__v_ (f6817ff8, 1e2fd8, fe4c7fd70) + 3d8cKJavaThreadDrun6M_v_ (e2e02000, fe4d3e34, fe4c8000, 7fd70, 1e2fd8,fe213ec8 _start (fe4c8000, fe625d10, 0, 5, 1, fe401000) + 20ff36b728 _thread_start (1e2fd8, 0, 0, 0, 0, 0) + 40
-
8/11/2019 wl Files
26/32
Classification : Public
10.4 Get a thread dump of theserver
kill -3 9499
-
8/11/2019 wl Files
27/32
Classification : Public
10.5 Map lwp# to Thread#
Since lwp# 8 mapped to thread #76, you can
calculate the hex value of 76 to be 4c.
This maps to nid=0x4c in the JVM thread dump:"Thread-6" prio=5 tid=0x1e2fd8 nid=0x4c waitingon monitor [0xe2e81000..0xe2e819d8]
at java.lang.Thread.sleep(Native Method)at
weblogic.management.deploy.GenericAppPoller
.run(GenericAppPoller.java:139)
-
8/11/2019 wl Files
28/32
Classification : Public
Batch Job Executions
Foreground
Background
nohup
cron jobs
-
8/11/2019 wl Files
29/32
Classification : Public
Foreground Jobs
Shell prompt does not return untill theexecution of job done
Ctrl+c will terminate the job (process)
./startWeblogic
-
8/11/2019 wl Files
30/32
Classification : Public
Background Jobs
Job can be started in background by
giving &at the end
Shell prompt will come back, you canexecute other jobs
Job will terminate once the terminal is
closed
./startWeblogic&
-
8/11/2019 wl Files
31/32
Classification : Public
No hangup
Jobs started with nohup will notterminate even after closing the
terminal window nohup writes the status into a file
nohup.out
nohup ./startWeblogic &
-
8/11/2019 wl Files
32/32
Classification : Public
Cron jobs
Cron is a unix utility to schedule jobs. Cron has a format to specify the job timing * * * * * Job_Name minute (0-59), hour (0-23), day of the month (1-31), month of the year
(1-12),
day of the week (0-6 with 0=Sunday). crontabl listing cron jobs crontabe for editing