github.com/ranjib/nomad@v0.1.1-0.20160225204057-97751b02f70b/website/source/docs/drivers/systemd.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Drivers: systemd"
     4  sidebar_current: "docs-drivers-systemd"
     5  description: |-
     6    The systemd task driver is used to run executables using transient systemd units.
     7  ---
     8  
     9  # systemd Driver
    10  
    11  Name: `systemd`
    12  
    13  The `systemd` driver provides an interface to use [systemd](http://www.freedesktop.org/wiki/Software/systemd/) transient units for running executables with cgroups enforcement. Currently, the driver supports arbitrary executables with resource isolation. It is very similar to the `raw_exec` driver, but allows resource control. systemd task driver uses [dbus api](http://www.freedesktop.org/wiki/Software/systemd/dbus/) and does not support dynamic ports or any sort of chrooting.
    14  
    15  ## Task Configuration
    16  
    17  The `systemd` driver supports the following configuration in the job spec:
    18  
    19  * `command` - Executable with all its arguments. Note: executable must have its fully qualified path.
    20  Example:
    21  
    22  ```
    23  task "sleep" {
    24    driver = "systemd"
    25    config {
    26      command = "/bin/sleep 10"
    27    }
    28    resources {
    29      cpu = 500
    30      memory = 256
    31    }
    32  }
    33  ```
    34  
    35  ## Task Directories
    36  
    37  The `systemd` driver currently does not support mounting of the `alloc/` and `local/` directory.
    38  
    39  ## Client Requirements
    40  
    41  The `systemd` driver requires systemd to be installed on the agents. Agents need to be run as root.
    42  
    43  ## Client Attributes
    44  
    45  The `systemd` driver will set the following client attributes:
    46  
    47  * `driver.systemd` - Set to `1` if systemd is running on the host node.
    48  * `driver.systemd.version` - Version of `systemd` eg: `"225"`
    49  
    50  ## Resource Isolation
    51  
    52  ### CPU
    53  
    54  Nomad limits containers' CPU based on CPU shares. CPU shares allow containers
    55  to burst past their CPU limits. CPU limits will only be imposed when there is
    56  contention for resources. When the host is under load your process may be
    57  throttled to stabilize QOS depending on how many shares it has. You can see how
    58  many CPU shares are available to your process by reading `NOMAD_CPU_LIMIT`.
    59  1000 shares are approximately equal to 1Ghz.
    60  
    61  Please keep the implications of CPU shares in mind when you load test workloads
    62  on Nomad.
    63  
    64  ### Memory
    65  
    66  Nomad limits containers' memory usage based on total virtual memory. This means
    67  that containers scheduled by Nomad cannot use swap. This is to ensure that a
    68  swappy process does not degrade performance for other workloads on the same
    69  host.
    70  
    71  Since memory is not an elastic resource, you will need to make sure your
    72  container does not exceed the amount of memory allocated to it, or it will be
    73  terminated or crash when it tries to malloc. A process can inspect its memory
    74  limit by reading `NOMAD_MEMORY_LIMIT`, but will need to track its own memory
    75  usage. Memory limit is expressed in megabytes so 1024 = 1Gb.
    76  
    77  ### IO
    78  
    79  Nomad's uses blkio cgroup, enforced via BlkioWeight systemd directive to throttle filesystem IO.