-
Notifications
You must be signed in to change notification settings - Fork 299
fleetd: get filtered list of units instead of all units #1564
Conversation
|
Just for the history. Commands to test systemd dbus methods using busctl: # fleet.service
busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/fleet_2eservice \
org.freedesktop.DBus.Properties GetAll "s" ""
# [email protected]
busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/hello_403_2eservice \
org.freedesktop.DBus.Properties GetAll "s" ""
# [email protected]
busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/hello_403_2eservice \
org.freedesktop.DBus.Properties Get "ss" "org.freedesktop.systemd1.Unit" "LoadState"
# [email protected]
busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/hello_403_2eservice \
org.freedesktop.DBus.Properties GetAll "s" "org.freedesktop.systemd1.Unit" |
|
Got a bug, UPD: Hm, have noticed same result with vanilla v225 systemd branch. UPD2: Machine filter was not applied because of the patch which was reverted in coreos branch: coreos/systemd#27 |
9828ed1 to
fcd97f0
Compare
eaaae32 to
58ccffc
Compare
|
Have create yet another systemd improvement: systemd/systemd#3182 |
58ccffc to
a90aa38
Compare
a90aa38 to
de73981
Compare
|
rebased and updated code. Now all units are retrieved by |
1ca90cb to
7271d4a
Compare
|
Test case: One template unit: [email protected] [Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/truefleetctl submit [email protected]
fleetctl load hello@{1..500}And we have 500 inactive units which triggers exactly the same issue which was reported in the #1418. With systemd < 230:500 units info retrieving takes 7-8 seconds when you use systemd < 230. top output for 60 secs: $ top -d 60
top - 10:11:17 up 6 min, 3 users, load average: 1.47, 1.31, 0.62
Tasks: 67 total, 1 running, 66 sleeping, 0 stopped, 0 zombie
%Cpu(s): 66.8 us, 31.8 sy, 0.0 ni, 0.0 id, 0.0 wa, 1.1 hi, 0.3 si, 0.0 st
KiB Mem: 505052 total, 310236 used, 194816 free, 9320 buffers
KiB Swap: 0 total, 0 used, 0 free. 165880 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
748 fleet 20 0 53952 51332 6768 S 47.4 10.2 3:02.35 fleetd
1 root 20 0 119576 6252 4480 S 41.4 1.2 1:17.40 systemd
610 message+ 20 0 42632 3876 3164 S 5.8 0.8 0:11.24 dbus-daemon
739 etcd 20 0 322800 48168 13612 S 3.3 9.5 0:47.10 etcd2With the systemd 230:cpu load for fleet/systemd - 30-40/15-20 % top output for 60 secs: $ top -d 60
top - 10:03:40 up 11 min, 3 users, load average: 0.19, 0.54, 0.44
Tasks: 68 total, 3 running, 65 sleeping, 0 stopped, 0 zombie
%Cpu(s): 52.3 us, 7.2 sy, 0.0 ni, 38.9 id, 0.6 wa, 0.6 hi, 0.2 si, 0.2 st
KiB Mem: 505052 total, 297516 used, 207536 free, 9764 buffers
KiB Swap: 0 total, 0 used, 0 free. 177768 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
929 root 20 0 25172 20120 6008 S 33.7 4.0 2:11.35 fleetd
1 root 20 0 105960 6832 4152 R 18.3 1.4 1:36.35 systemd
717 etcd 20 0 336136 53012 13364 S 3.5 10.5 0:58.63 etcd2
563 message+ 20 0 34384 3776 3100 R 2.8 0.7 0:15.54 dbus-daemonAs a result we have 40-50% advantage for systemd performance, for fleetd: 15-30%. |
|
@hectorj2f can you benchmark this PR with the latest systemd 230? |
| states := make(map[string]*unit.UnitState) | ||
| for _, dus := range dbusStatuses { | ||
| if !filter.Contains(dus.Name) { | ||
| if fallback && !filter.Contains(dus.Name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you going through this loop even if the filtered call worked?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, ignore this, you're right
e0b2094 to
94a8001
Compare
94a8001 to
b96d05f
Compare
|
go-systemd was updated. I removed [WIP] and updated this PR. |
* Updated vendor, set go-systemd to v9
b96d05f to
4edc9ba
Compare
|
@hectorj2f ping |
|
@kayrus Nice. I'll benchmark it to find the benefits. |
14580b0 to
63b20dc
Compare
|
LGTM. I'll merge it soon. |
|
LGTM, I didn't bake any plots yet. But it works smoothly and a bit faster than the current version. |
resolves #478. Code works with these systemd changes: endocode/systemd@5b4452a
Otherwise fleet will fallback to the normal
ListUnitsmethod.I don't like this code: https://github.com/endocode/fleet/blob/9828ed19752bdaae167d79e458fd7200ca3cb305/systemd/manager.go#L248
Instead of calling several times for each unit's status I'd like to implement new method called
GetUnitsPropertiesThis PR contains godeps diffs only for test purposes. These changes are also introduced in go-systemd repo: coreos/go-systemd#150
/cc @jonboulle @tixxdz @antrik