jamesrwhite / minicron

🕰️ Monitor your cron jobs
GNU General Public License v3.0
2.34k stars 154 forks source link

Execution UI slow with lots of output #287

Open LaszloHont opened 7 years ago

LaszloHont commented 7 years ago

e.g. loading 127.0.0.1:9292/execution/15 takes more than a minute with ruby using 100% cpu

LaszloHont commented 7 years ago

I think that the problem is when the application being called from cron outputs a line that clears itself (like for an interactive shell, with ^L to clear the line). Then the output gets very long and minicron gets slow.

jamesrwhite commented 7 years ago

How much is a lot? You can check in the database how many lines of output it has. If you run the server in debug mode you can see what queries are being run also, that may give a clue what the problem is.

LaszloHont commented 7 years ago

22 seconds to render in the web interface less than a second to select in sqlite3

sqlite> select count(*) from job_execution_outputs where execution_id=19;
45971
LaszloHont commented 7 years ago

This was almost the samec cron job with the --verbose flag removed. With the flag still on it would have been more than ten times as much output.

jamesrwhite commented 7 years ago

Can you run the server with the --debug and --verbose flag and see what it outputs? You should be able to see the execution times for all the queries which will hopefully point to the issue.

LaszloHont commented 7 years ago

The easy fix for this issue is for minicron to run the cron commands (or users be told to run the cron commands...) with a TERM setting that does not clear anything. Perhaps TERM=dumb

jamesrwhite commented 7 years ago

The UI should be able to handle a job with any amount of output. I think there are two fixes here: