bitmagnet-io / bitmagnet

A self-hosted BitTorrent indexer, DHT crawler, content classifier and torrent search engine with web UI, GraphQL API and Servarr stack integration.
https://bitmagnet.io/
MIT License
2.07k stars 80 forks source link

The import and database operations have become extremely slow. #262

Closed peterzam closed 2 weeks ago

peterzam commented 1 month ago

Describe the bug

I am importing 30 million torrents through the /import endpoint, and the database and queue becomes quite slow for the later parts of the process. The import process slows down exponentially as it goes on.

To Reproduce

Steps to reproduce the behavior: Import.

Expected behavior

A clear and concise description of what you expected to happen.

Environment Information (Required)

Additional context

I think the unique property of the info_hash is slowing down the process.

peterzam commented 1 month ago

Database inserts also slow when merging a large number of queries. May be the culprit is checking unique for info_hash.