Opened 4 years ago

Last modified 3 years ago

#5452 accepted enhancement

Slow gmg command

Reported by: Elinvention Owned by:
Priority: minor Milestone:
Component: programming Keywords: medium
Cc: Parent Tickets:

Description

On my tiny home server, the gmg command takes ages just to show the usage message. I think the first thing it should do is parsing the command line and possibly throw errors immediately. Only after that import all other required modules.

% time ./bin/gmg

usage: gmg [-h] [-cf CONF_FILE]

{batchaddmedia,shell,adduser,assetlink,makeadmin,reprocess,serve,deleteuser,addmedia,dbupdate,deletemedia,changepw,alembic}
...

gmg: error: too few arguments
./bin/gmg 6,30s user 2,89s system 86% cpu 10,612 total

6,30 seconds just to list possible commands!!! I'd say it's a bit unresponsive.

Subtickets

Change History (3)

comment:1 Changed 4 years ago by Elinvention

Mediagoblin version 0.9.0, my OS is Debian testing, hardware OLinuXino A20 LIME2 (see https://www.olimex.com/Products/OLinuXino/A20/A20-OLinuXIno-LIME2-4GB/open-source-hardware) with 1GB of RAM, I'm using python2.

I also tried on a much more powerful machine with 16GB of RAM, AMD FX-8320 and python3, but it's still slow: gmg 1,03s user 0,06s system 98% cpu 1,104 total

Last edited 4 years ago by Elinvention (previous) (diff)

comment:2 Changed 4 years ago by Christopher Allan Webber

Yes, we'd have to do some tricks to make this not import as much as it has to. I seem to recall that part of the reason it's so slow is it pulls up a full copy of the application for plugin hooks reasons, but I could well be wrong.

comment:3 Changed 3 years ago by Ben Sturmfels

Keywords: medium added
Status: newaccepted

Marking as medium-sized. Will require some experience with profiling to review the CPU, memory and hard-disk usage. May require substantial changes to bring some of the error handling to earlier in the process.

Note: See TracTickets for help on using tickets.