The tantalizing aroma of svcs(1)

A side point: svcs(1) is pretty fast. Our example from last week was

$ svcs \\\*milestone\\\*
STATE          STIME    FMRI
online         Jul_23   svc:/milestone/devices:default
online         Jul_23   svc:/milestone/single-user:default
online         Jul_23   svc:/milestone/name-services:default
online         Jul_23   svc:/milestone/multi-user:default
online         Jul_23   svc:/milestone/multi-user-server:default

Other approaches to service management in Unix-like systems ask each service for their status. On a large system, with a complete representation of its running daemons as services, this can be thousands of fork(2)/exec(2) pairs. That's not how smf(5) works, and so a command like svcs(1) can be quick:

$ time svcs \\\*milestone\\\* 
STATE          STIME    FMRI
online         Jul_23   svc:/milestone/devices:default
online         Jul_23   svc:/milestone/single-user:default
online         Jul_23   svc:/milestone/name-services:default
online         Jul_23   svc:/milestone/multi-user:default
online         Jul_23   svc:/milestone/multi-user-server:default

real    0m0.027s
user    0m0.004s
sys     0m0.009s

In fact, we're not even calling fork(2) to get this report on service status:

$ truss -t fork,write,exit svcs \\\*milestone\\\* 
STATE          STIME    FMRI
write(1, " S T A T E              ".., 29)      = 29
online         Jul_23   svc:/milestone/devices:default
write(1, " o n l i n e            ".., 55)      = 55
online         Jul_23   svc:/milestone/single-user:default
write(1, " o n l i n e            ".., 59)      = 59
online         Jul_23   svc:/milestone/name-services:default
write(1, " o n l i n e            ".., 61)      = 61
online         Jul_23   svc:/milestone/multi-user:default
write(1, " o n l i n e            ".., 58)      = 58
online         Jul_23   svc:/milestone/multi-user-server:default
write(1, " o n l i n e            ".., 65)      = 65
_exit(0)

I'll start drawing a suitable architecture diagram...

Comments:

Post a Comment:
Comments are closed for this entry.
About

sch

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
External blogs