Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging start-up time of mtda-cli #250

Open
jan-kiszka opened this issue Oct 13, 2022 · 9 comments
Open

Debugging start-up time of mtda-cli #250

jan-kiszka opened this issue Oct 13, 2022 · 9 comments
Assignees
Milestone

Comments

@jan-kiszka
Copy link
Contributor

On my RPi4 - which is not really a slow device - I'm facing several seconds of delay between calling mtda-cli and getting the prompt. With debug=4, it takes almost 4 s to get the first output ("# debug3: main.load_remote_config()"). I also tried removing all drivers from the local config, but that had no impact.

Any suggestions how to debug this further?

@chombourger
Copy link
Collaborator

is that with HEAD?

@jan-kiszka
Copy link
Contributor Author

Not yet, still on b92d55b (with Debian). I don't see "suspicious" commits since - do you expect differences?

@chombourger
Copy link
Collaborator

me neither - was just curious to understand which "version" you were running. I will build and flash the Pi4 image

@chombourger
Copy link
Collaborator

finally going to take a look

@chombourger chombourger self-assigned this Dec 1, 2022
@chombourger chombourger added this to the 0.17 milestone Dec 1, 2022
@chombourger
Copy link
Collaborator

Reproduced on Pi4 using the following command:

root@mtda:/home/mtda# (echo start && mtda-cli -d -n 2>&1) | ts '[%Y-%m-%d %H:%M:%S]'
[2022-12-09 00:02:52] start
[2022-12-09 00:02:55] # debug3: main.load_timeouts_config()
[2022-12-09 00:02:55] # debug3: main.load_timeouts_config: None
[2022-12-09 00:02:55] # debug3: main._parse_script()
[2022-12-09 00:02:55] # debug3: main._parse_script(): scripts.power_on()
[2022-12-09 00:02:55] # debug3: main._parse_script()
[2022-12-09 00:02:55] # debug3: main._parse_script(): scripts.power_off()
[2022-12-09 00:02:55] # debug3: main.start()

and a minimalistic config:

root@mtda:/home/mtda# cat /etc/mtda/config
[main]
debug=3

@chombourger
Copy link
Collaborator

reaching main() takes 3s alone as shown below:

root@mtda:/home/mtda# (echo start && mtda-cli -d -n 2>&1) | ts '[%Y-%m-%d %H:%M:%S]'
[2022-12-09 00:08:04] start
[2022-12-09 00:08:07] ### main

@chombourger
Copy link
Collaborator

used python3 -X importtime to check import times and self [us] for mtda.main is 1476358 (~1.5s)

@chombourger
Copy link
Collaborator

the overall import time is 2649476 (~2.5s)

@chombourger chombourger modified the milestones: 0.17, 0.18 Jan 4, 2023
@chombourger chombourger modified the milestones: 0.18, 1.0 Jan 23, 2023
@fmoessbauer
Copy link
Member

I debugged this as part of f61f2fa, citing:

The startup of the mtda service might take quite long on the nanopi-neo
board (~15sec). This is due to the loading of a ton of dependencies,
which cannot really be avoided.

The mtda-cli is affected as well, as it internally loads MTDA to get the (local) MTDA version. This can be speed up by generating the .pyc files (by executing it once as root), but it is still slow. IMHO, the whole import should be made more dynamic and ideally the dependency to MTDA itself could be avoided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants