Commit f7b153f
authored
Rewrite Python version of supervisor-proc-exit-listener in Rust (supervisor-proc-exit-listener-rs) without integration (#24508)
#### Why I did it
Rewrite Python version of supervisor-proc-exit-listener in Rust (supervisor-proc-exit-listener-rs)
Add unit test, achieve coverage "73.60% coverage, 184/250 lines covered".
Change executable name to supervisor-proc-exit-listener-rs.
However, the executable is not used in any the docker containers, we will use another PR (#23688) to use it in each docker container.
Before this PR:
```
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
13062 root 20 0 130.3m 33.4m 19.0m S 0.0 0.2 0:00.23 /usr/bin/python3 /usr/local/bin/supervisor-proc-exit-listener --container-name swss
15163 root 20 0 130.3m 32.1m 17.8m S 0.0 0.2 0:00.17 /usr/bin/python3 /usr/local/bin/supervisor-proc-exit-listener --container-name eventd
13170 root 20 0 130.3m 32.1m 17.8m S 0.0 0.2 0:00.26 /usr/bin/python3 /usr/local/bin/supervisor-proc-exit-listener --container-name sysmgr
20784 root 20 0 130.3m 32.1m 17.8m S 0.0 0.2 0:00.23 /usr/bin/python3 /usr/local/bin/supervisor-proc-exit-listener --container-name gnmi
19288 root 20 0 130.3m 32.1m 17.7m S 0.0 0.2 0:00.17 /usr/bin/python3 /usr/local/bin/supervisor-proc-exit-listener --container-name bmp
21357 root 20 0 129.3m 32.0m 17.8m S 0.0 0.2 0:00.12 /usr/bin/python3 /usr/local/bin/supervisor-proc-exit-listener --container-name snmp
13286 root 20 0 130.3m 32.0m 17.7m S 0.0 0.2 0:00.27 /usr/bin/python3 /usr/local/bin/supervisor-proc-exit-listener --container-name teamd
15647 root 20 0 129.3m 31.9m 17.7m S 0.0 0.2 0:00.17 /usr/bin/python3 /usr/local/bin/supervisor-proc-exit-listener --container-name bgp
17187 root 20 0 130.2m 31.9m 17.6m S 0.0 0.2 0:00.15 /usr/bin/python3 /usr/local/bin/supervisor-proc-exit-listener --container-name syncd
5191 root 20 0 129.3m 31.9m 17.6m S 0.0 0.2 0:00.20 /usr/bin/python3 /usr/local/bin/supervisor-proc-exit-listener --container-name database
17893 root 20 0 129.3m 31.9m 17.6m S 0.0 0.2 0:00.13 /usr/bin/python3 /usr/local/bin/supervisor-proc-exit-listener --container-name pmon
21026 root 20 0 129.3m 31.8m 17.6m S 0.0 0.2 0:00.13 /usr/bin/python3 /usr/local/bin/supervisor-proc-exit-listener --container-name lldp
17195 root 20 0 129.3m 31.8m 17.6m S 0.0 0.2 0:00.12 /usr/bin/python3 /usr/local/bin/supervisor-proc-exit-listener --container-name radv
```
| RES | SHR | RssAnon | All |
|-------|-------|---------|-------------|
| 33.4 | 19 | 14.4 | |
| 32.1 | 17.8 | 14.3 | |
| 32.1 | 17.8 | 14.3 | |
| 32.1 | 17.8 | 14.3 | |
| 32.1 | 17.7 | 14.4 | |
| 32 | 17.8 | 14.2 | |
| 32 | 17.7 | 14.3 | |
| 31.9 | 17.7 | 14.2 | |
| 31.9 | 17.6 | 14.3 | |
| 31.9 | 17.6 | 14.3 | |
| 31.9 | 17.6 | 14.3 | |
| 31.8 | 17.6 | 14.2 | |
| 31.8 | 17.6 | 14.2 | |
| **Total** | | **185.7** | **203.49** |
| **Avg** | **17.79** | | |
After this PR:
```
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
20051 root 20 0 94.9m 8.4m 7.7m S 0.0 0.1 0:00.01 /usr/bin/supervisor-proc-exit-listener-rs --container-name bmp
16240 root 20 0 94.9m 8.4m 7.7m S 0.0 0.1 0:00.01 /usr/bin/supervisor-proc-exit-listener-rs --container-name eventd
17235 root 20 0 94.9m 8.3m 7.6m S 0.0 0.1 0:00.02 /usr/bin/supervisor-proc-exit-listener-rs --container-name syncd
21093 root 20 0 94.9m 8.3m 7.7m S 0.0 0.1 0:00.01 /usr/bin/supervisor-proc-exit-listener-rs --container-name gnmi
16207 root 20 0 94.9m 8.3m 7.6m S 0.0 0.1 0:00.01 /usr/bin/supervisor-proc-exit-listener-rs --container-name teamd
16092 root 20 0 94.9m 8.3m 7.6m S 0.0 0.1 0:00.02 /usr/bin/supervisor-proc-exit-listener-rs --container-name sysmgr
16288 root 20 0 94.9m 8.3m 7.6m S 0.0 0.1 0:00.01 /usr/bin/supervisor-proc-exit-listener-rs --container-name bgp
21158 root 20 0 94.9m 8.3m 7.6m S 0.0 0.1 0:00.01 /usr/bin/supervisor-proc-exit-listener-rs --container-name lldp
17281 root 20 0 94.9m 8.3m 7.6m S 0.0 0.1 0:00.01 /usr/bin/supervisor-proc-exit-listener-rs --container-name radv
16093 root 20 0 94.9m 8.3m 7.6m S 0.0 0.1 0:00.02 /usr/bin/supervisor-proc-exit-listener-rs --container-name swss
21452 root 20 0 94.9m 8.3m 7.6m S 0.0 0.1 0:00.01 /usr/bin/supervisor-proc-exit-listener-rs --container-name snmp
18123 root 20 0 94.9m 8.2m 7.6m S 0.0 0.1 0:00.01 /usr/bin/supervisor-proc-exit-listener-rs --container-name pmon
7246 root 20 0 94.9m 8.2m 7.5m S 0.0 0.1 0:00.04 /usr/bin/supervisor-proc-exit-listener-rs --container-name database
```
Memory calc sheet:
| RES | SHR | RssAnon | All |
|-------|-------|---------|-------------|
| 8.4 | 7.7 | 0.7 | |
| 8.4 | 7.7 | 0.7 | |
| 8.3 | 7.6 | 0.7 | |
| 8.3 | 7.7 | 0.6 | |
| 8.3 | 7.6 | 0.7 | |
| 8.3 | 7.6 | 0.7 | |
| 8.3 | 7.6 | 0.7 | |
| 8.3 | 7.6 | 0.7 | |
| 8.3 | 7.6 | 0.7 | |
| 8.3 | 7.6 | 0.7 | |
| 8.3 | 7.6 | 0.7 | |
| 8.2 | 7.6 | 0.6 | |
| 8.2 | 7.5 | 0.7 | |
| **Total** | | **8.9** | **16.52** |
| **Avg** | **7.62** | | |
The total memory reduction is about 203.49 - 16.52 = 186.97 MB1 parent f9891be commit f7b153f
File tree
20 files changed
+3344
-1
lines changed- rules
- src/sonic-supervisord-utilities-rs
- debian
- src
- bin
- tests
- dev
- etc/supervisor
- test_data
20 files changed
+3344
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
0 commit comments