Re: systemd: Is it wrong?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 11 Jul 2011 08:44:16 +0000 (UTC) JB wrote:
> Let me take a shot at 2 examples of service files below.
> Are they correct setup-wise ?
> Will both examples be executed sequentially only ?
>  
> 1.
> 
> main-service-1.service:
> [Unit]
> Description=Main service 1
> Requires= ... sub-service-1.service sub-service-2.service
> After= ... sub-service-1.service sub-service-2.service
> ...
> [Service]
> Type=forking    <---------------------- any other type too ?      
> ExecStartPre=
> ExecStartPre=
> ExecStart=
> ExecStart= /usr/sbin/some-service

Nitpick: You can have only one ExecStart= in a forking unit. Only
oneshot units can have more.

> ExecStartPost=
> ExecStartPost=
> ...
> 
> sub-service-1.service:
> [Unit]
> Description=Sub service 1
> ...
> [Service]
> ...
> 
> sub-service-2.service:
> [Unit]
> Description=Sub service 2
> ...
> [Service]
> ...

First, sub-service-1.service and sub-service-2.service will be started
in parallel. When they're running, main-service-1.service will be
started by processing its ExecStart* commands sequentially.

> 2.
> 
> main-service-2.service:
> [Unit]
> Description=Main service 2
> After= ...
> ...
> [Service]
> Type=forking    <---------------------- any other type too ?      
> ExecStartPre= sub-service-1.service 
> ExecStartPre= sub-service-2.service

This is incorrect. ExecStartPre= expects a command to run, not a unit
name.

> What if sysadmin wants to execute them in parallel because she knows
> they can be executed this way (no conflict and no races) ?
> How, if by definition, systemd executes them sequentially only ?
> Can they be grouped and execution-parallelized in the whole service
> file, or at least in subgroups Pre-, regular, and Post- ?

Parallelism in systemd happens between multiple units, but never between
ExecStart* commands of one unit.
Requesting parallelism within one unit seems like over-engineering to
me. You can always split your unit to smaller ones if you want
parallelism.

> Can you give us a working example of a services setup (or something
> else) in systemd where execution-parallelism would be present or at
> least theoretically exploitable ?

Take a look at 'systemd-analyze plot' where you can clearly see
services starting in parallel. This Lennart's blog post has an example:
http://0pointer.de/blog/projects/blame-game.html

Michal
-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux