gridfsmigrate icon indicating copy to clipboard operation
gridfsmigrate copied to clipboard

Is there any way to improve performance

Open ranqiangjun opened this issue 6 years ago • 2 comments

I adjusted the script a little bit on my fork. Following is the pseudocode:

Before:

for item in items:
    dump_file()
for item in items:
   update_db()
for item in items:
    remove_blobs()

After:

for item in items:
    dump_file()
    update_db()
    remove_blobs()

the scanned rows would become less and less, I guess it will improve the performance a little

For MongoDB, I am a newbie. As you can see from the screenshot below, about 20s to dump the file, and 20 more seconds to remove blobs. The migration process is pretty slow. So I am wondering if there is a way to improve it, thanks in advance, and thanks for your script!

image

ranqiangjun avatar Jul 06 '19 12:07 ranqiangjun

btw, creating index saved my day db.rocketchat_uploads.chunks.createIndex( { files_id: 1, n: 1 }, { unique: true } )

ranqiangjun avatar Jul 07 '19 14:07 ranqiangjun

@jungleran , I am quite supprised that rocketchat does not set in an index files_id, I guess should be fixed in RC as well

arminfelder avatar Mar 08 '21 14:03 arminfelder