SmartOS zones have a cap or maximum number of lightweight processes defined in the zone package. To check if my current settings make sense I would like to collect the total number of lightweight processes over time (from within the zone). I already have tools in place to collect kstat counters so I would prefer to use it. I have noticed that prstat provides a lwps
count and any information on how prstat get this value might be helpful.
In the meantime I have been able to fetch the number of processes using 'caps:*:nprocs_zone_*:usage'
or 'unix:0:system_misc:nproc'
but nothing regarding lightweight processes.
To sum-up, I would like to know:
- if there is any kstat counter representing the total number of lwps or per processes counters that I could sum to get this value.
- if not, how is prstat getting the total lwps count?
- is there any other way to get this value ? (Hopefully without parsing prstat output)
prstat is querying the /proc filesystem for info, example of running truss against a prstat command shows:
proc is well documented here, alternatively search for "oracle man pages section 4 File Formats proc".
Within each /proc/[pid] dir exists a /proc/[pid]/lwp/ directory. For example:
Running ps against the same process will read what each lwp is and present it back, this particular pid relates to the fmd service.
The following command should parse the total LWPs for you.
Run with zlogin -c to obtain details of LWPs in zones. You could probably obtain the same info with dtrace however I know not how to do this. Post back with your findings should you find out...
Should you want to delve deeper into LWP info, the -lL switches provide detailed info regarding LWPs, for example:
HTH.