-
-
Notifications
You must be signed in to change notification settings - Fork 165
Open
Description
On my production server (now on develop
with a few additional uncommitted changes) when I am in a course and try to go to the Job Manager, it takes a very long time to load. On the order of one minute. Eventually it loads, and for one course, it only had a few things to show.
On my regular development server on develop
, it does not take long at all to load this page.
Is anyone else using a production server where the Job Manager is available? I can't see why my local uncommitted changes would affect this, so I am naturally wondering if there is something about the scale of everything in production could explain the slowdown.
Activity
drgrice1 commentedon Mar 26, 2024
You could try installing
sqlite
(or reallysqlite3
), then executesqlite3 /opt/webwork/webwork2/DATA/webwork2_job_queue.db
, and then runselect COUNT(*) from minion_jobs
. How many jobs does is show?drgrice1 commentedon Mar 26, 2024
By the way type
.exit
to exit sqlite3.drgrice1 commentedon Mar 26, 2024
It seems on Oracle Linux there is a package for sqlite 3. It is called
sqlite
, and the executable is alsosqlite
. Ubuntu hassqlite
andsqlite3
packages, and the first has the executablesqlite
and the second hassqlite3
.Alex-Jordan commentedon Mar 26, 2024
OK, the package was
sqlite
but the executable wassqlite3
. I got 10768 jobs.drgrice1 commentedon Mar 26, 2024
Yeah, that seems to be a lot. It may be that you will need to use one of the other database backends for Minion. I suspect that
sqlite
is not good enough to handle that kind of scale. There aremysql
andpostgres
backends. Most likely you will wantmysql
since you are already using that for webwork2. For that installMinion::Backend::mysql
from cpan. As to the rest of the setup, I will need to figure that out again. It has been a while. I know you have to create a database for Minion to use. You can just use the usualwebworkWrite
user (or whatever you are already using for webwork2). You have to set the permissions for that user for the database. But I don't remember the rest.drgrice1 commentedon Mar 26, 2024
So here are more detailed steps on setting up the webwork job queue to use the
mysql
backend.Minion::Backend::mysql
from cpan (as I already mentioned).sudo mysql -u root
(this may be different for you on Oracle, but I assume you know how to do this).create database webwork2_job_queue
(you can use a different database name if you like).GRANT ALL PRIVILEGES ON webwork2_job_queue.* TO 'webworkWrite'@'localhost'
. Not all privileges are needed, but I am not sure which ones. I know all of the privileges we use for the usual webwork2 database are needed as well as theTRIGGER
privilege, but there is something else too. At one point I had it narrowed down, but apparently I didn't document it anywhere.site.conf
set$job_queue{backend} = 'mysql'
and$job_queue{database_dsn} = 'mysql://webworkWrite:yourdbpasswd@localhost/webwork2_job_queue'
.At this point I recommend that you test the webwork2 job queue from the command line (not the systemctl service). For this run
sudo -u www-data bin/webwork2 minion worker
from the/opt/webwork/webwork2
directory. If all goes well the job queue will start and all tables in the database will be created. You can check this withshow tables
in the database, and you should see severalminion_...
tables.There is an issue though. The
Minion::Backend::mysql
package uses an experimental feature of theMojo::mysql
package. Whenever the job queue starts or anytime a job is enqueued you will see the warning "Use of Mojo::mysql::PubSub is highly EXPERIMENTAL and should be considered an experiment at /usr/local/share/perl/5.34.0/Mojo/mysql.pm line 39". So you will need to addEnvironment="MOJO_PUBSUB_EXPERIMENTAL=1"
to theconf/webwork2.service
file to disable that warning. That will disable the warning when a job is enqueued by the webwork2 app at least. That is the bad one because it shows up in the UI. If you want to disable the warning for the minion worker also, then add that to theconf/webwork2-job-queue.service
file. Although that warning is only in the console, and you probably won't even see it when run via the systemd service.Alex-Jordan commentedon Mar 26, 2024
So, I'm not able to get
Minion::Backend::mysql
because it depends onDBD::mysql
, which I can't get. (I haveDBD::MariaDB
.) If I try to installDBD::mysql
, it's like:In that file that it says to look into:
So I think I'm stuck.
drgrice1 commentedon Mar 26, 2024
Yeah, it does use
DBD::mysql
and can't be switched to useDBD::mariadb
. Although, you should be able to installDBD::mysql
. You just need to install the development header files for mysql. Those are probably in a package for Oracle.drgrice1 commentedon Mar 26, 2024
Alternately, you could use
postgres
. That is easier to get working, assuming it is not hard to installpostgres
. I would also have to remember how to do that!drgrice1 commentedon Mar 26, 2024
It seems that
DBD::mysql
is available in a package for Oracle. It isperl-DBD-mysql
. Would that work?Alex-Jordan commentedon Mar 26, 2024
That may have worked. I got to the point of running
sudo -u apache bin/webwork2 minion worker
but I can't tell if I should ctrl-c now to end it, or if it is doing something I shouldn't interrupt:That's where it is right now.
drgrice1 commentedon Mar 26, 2024
It looks like it worked. You can use ctrl-c to kill it now. If it were running jobs you would see output in the terminal.
Check that the tables were created in the database, but that should be it.
Alex-Jordan commentedon Mar 26, 2024
OK, and all running now. Of course in this new database there are no jobs, so the page loads very fast :)
drgrice1 commentedon Mar 26, 2024
Yeah, so you could try to dump the sqlite database and import that into the mysql database. To dump the sqlite database run
sqlite /opt/webwork/webwork2/DATA/webwork2_job_queue.db
. Then in sqlite executeYou should then see the file
queue.sql
in the directory you are in. Then runmysql webwork2_job_queue < queue.sql
(adding all of the usual parameters you use to access mysql).Either that or just wait, and let time tell.
Alex-Jordan commentedon Mar 27, 2024
I dumped it OK, but having trouble importing it. There are grammar/syntax differences between sqlite and mysql.
drgrice1 commentedon Mar 27, 2024
I didn't test that. I knew there might be issues. Well then time will tell.
Although, since you can now monitor jobs, you can prevent them from building up. You must have had failed jobs, because jobs that complete successfully are automatically removed after two days.