1 #!/usr/sbin/dtrace -s
2
3 /*
4 * This file and its contents are supplied under the terms of the
5 * Common Development and Distribution License ("CDDL"), version 1.0.
6 * You may only use this file in accordance with the terms of version
7 * 1.0 of the CDDL.
8 *
9 * A full copy of the text of the CDDL should have accompanied this
10 * source. A copy of the CDDL is also available via the Internet at
11 * http://www.illumos.org/license/CDDL.
12 */
13
14 /*
15 * Copyright 2018, Nexenta Systems, Inc. All rights reserved.
16 */
17
18 /* Description: This script measures the percentage of NFS thread pool currently utilized
19 * (maximum being NFSD_SERVERS), along with Max pending (queued) NFS requests that have not
20 * yet been assigned a thread. It is useful in troubleshooting bottlenecks in the Solaris
21 * NFS server, and determining the correct NFSD_SERVERS value for high-load systems. */
22 /* Author: Kirill.Davydychev@Nexenta.com */
23 /* Version: 0.1 */
24
25 #pragma D option quiet
26
27 svc_xprt_qput:entry
28 {
29 @pending_reqs = max(args[0]->p_reqs);
30 @act_threads = max(args[0]->p_threads - args[0]->p_asleep);
31 @pool_pct_util = max(100 * (args[0]->p_threads - args[0]->p_asleep) / args[0]->p_maxthreads);
32 }
33
34 tick-5sec
35 {
36 printf("%Y", walltimestamp);
37 printa(" Max Pending NFS requests: %@d; Max Active threads: %@d; Thread pool utilized percentage: %@d\n", @pending_reqs, @act_threads, @pool_pct_util);
38 trunc(@pending_reqs);
39 trunc(@act_threads);
40 trunc(@pool_pct_util);
41 }