Adding environment variables to an SMF service

I create an SMF manifest last week for a new service, and needed two environment variables to be set prior to the services’ start method being invoked. After poking around the svccfg manual page, I came across the setenv subcommand, which can be used to set an environment variable:

$ svccfg -s tinydns setenv FOO bar

Since I was creating a manifest from scratch, I ran this against a temporary service and then used the svccfg “export” command to display the entry I needed to add to the manifest I was creating:

$ svccfg export tinydns

Here is the XML that was displayed for the environment variable addition:

<exec_method name=’start’ type=’method’ exec=’/lib/svc/method/tinydns start’ timeout_seconds=’60’>
<method_context>
<method_environment>
<envvar name=’FOO’ value=’bar’/>
</method_environment>
</method_context>
&t;/exec_method>

I like SMF, but sometimes wonder if it is over-engineered for what it actually needs to do. If you have opinions on this, please let me know by submitting a comment.

Figuring out if a dedicated ZFS intent log will help

ZFS uses the ZFS intent log (also referred to as a ZIL) to store synchronous writes. This has the advantage that a full transaction group doesn’t need to be written when a synchronous write occurs, and maximizes the use of I/O bandwidth. For some applications (databases come to mind), placing the ZIL on a dedicated device can be extremely helpful. But how can you tell if placing the intent log on a separate device would be useful? To answer this question, you can run Richard Elling’s super handy zilstat DTrace script. As SSD becomes cheaper and cheaper, this script will be a useful tool for folks who want to applications and database performance.