LMFDB / lmfdb-inventory

inventory of the lmfdb database
3 stars 14 forks source link

bmfs #65

Closed edgarcosta closed 6 years ago

edgarcosta commented 7 years ago

We might be missing some compound indices in bmfs.forms to accommodate the query followed by the sort.

bmfs.dimesnsion also has a couple of slow queries.

Here is a sample of them: https://gist.github.com/anonymous/e2f9ca1568d7f672cb7a25945b51441e

JohnCremona commented 7 years ago

Thanks, I'll look into it. I did look at the queries which could be made and thought I had created appropriate indices, but the code has evolved since then.

JohnCremona commented 7 years ago

Do you have a date/timestamp on those?

edgarcosta commented 7 years ago

These were all triggered by running tests.sh.

Here is the log with the timestamps: https://gist.github.com/5f40bac386150839894218ab419b9d48

JohnCremona commented 7 years ago

OK then, certainly anything in the tests should be indexed. The new link concerns hmfs not bmfs. I'll look into it tomorrow.

edgarcosta commented 7 years ago

I have fixed the link.

JohnCremona commented 7 years ago

I found a source of slowness in bmfs.dimensions and will fix it -- requires a small code change as well as a precomputation into a stats collection. There was even TODO in the code -- my fault.

JohnCremona commented 7 years ago

I have added a couple of new indices and made some code changes -- see upcoming PR over on LMFDB/lmfdb. This is rather a dark art I think. Watching the mongo log while running the bianchi tests I still see a couple of things, not count or find requests but things like command bmfs.dimensions command: getMore { getMore: 293342921519, collection: "dimensions" } cursorid:293342921519 keyUpdates:0 writeConflicts:0 numYields:1019 nreturned:21652 reslen:4194438 locks:{ Global: { acquireCount: { r: 2040 } }, MMAPV1Journal: { acquireCount: { r: 1020 } }, Database: { acquireCount: { r: 1020 } }, Collection: { acquireCount: { R: 1020 } } } protocol:op_query 197ms which I don't understand.

On a more general point here, while testing it was crucial that I could look at the mongo log using 'tail -f'. Most LMFDB developers cannot do that. Might there be a way to change the permissions on /data/db/mongo.log so that all those with their key in mongo-user could see that?

edgarcosta commented 7 years ago

This is rather a dark art I think.

Yeah, there are many things in the mongo log I don't understand. But I wouldn't worry about it very much.

I don't think we can do that. But perhaps we should post the following on a regular basis:

$ grep op_query /var/log/mongodb/mongod.log{,.1}  > opquery_log
$ cat opquery_log | rev | cut -f1 -d" " | rev  > times_log 
$ paste times_log opquery_log | sort -n -r | gist

https://gist.github.com/2f82df17bc6aee5f66700c3f42e0d8d1

and now you have the slowest queries that have been hitting the production server for the last two days.

edgarcosta commented 7 years ago

perhaps, they can use: https://docs.mongodb.com/manual/reference/command/getLog/#dbcmd.getLog ?

JohnCremona commented 6 years ago

Can we close this @edgarcosta ?

edgarcosta commented 6 years ago

Yes, we can