Answer the question
In order to leave comments, you need to log in
Looking for NextCloud files?
Question to the organization of search in NextCloud 20
The raid contains 700 GB of them ~ 1,000,000 files. When trying to find something using the built-in search by inserting a query into the field, the system loads 1 processor thread at 100%, the search continues for 01min 13sec
If you enter the file name in the search field manually, then the search will take 02min 13sec, while all 4 are loaded flow by 100% in the first half a minute, then the load is reduced to 50-70%.
Searching for a file works the same regardless of which storage folder the search request was launched from. Let's say if I went to the folder "\docs\photo\folder1" and it contains the file "img_001.jpg" and I start looking for the file "img_001.jpg" from the folder "folder1", then the search will find it in about 01min 13sec (with provided that the file name has been copied and pasted into the search field). If you start searching for their storage root, as well as from any place, then the file search time will be the same. Naturally, the work of the search by this method does not allow you to use it comfortably.
And now the question is, what can help in reducing the time spent searching for a file?
Answer the question
In order to leave comments, you need to log in
Solution found! After many tests, database changes, I finally found the reason for the long search. The problem was really in the database, or rather I will write a little lower. By enabling logging of slow queries SET GLOBAL slow_query_log=1; I tracked what request is formed through a web search
SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `permissions`, `checksum`, `metadata_etag`, `creation_time`, `upload_time` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` WHERE (`storage` = 2) AND (`name` COLLATE utf8mb4_general_ci LIKE '%namefile%');
mysql> SHOW VARIABLES LIKE 'innodb_buffer_pool_size';
+-------------------------+-----------+
| Variable_name | Value |
+-------------------------+-----------+
| innodb_buffer_pool_size | 134217728 |
+-------------------------+-----------+
1 row in set (0.01 sec)
mysql>
mysql> SELECT table_schema "nextcloud",
-> Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
-> FROM information_schema.tables
-> GROUP BY table_schema;
+--------------------+---------------+
| nextcloud | DB Size in MB |
+--------------------+---------------+
| information_schema | 0.2 |
| mysql | 0.8 |
| nextcloud | 415.6 |
| performance_schema | 0.0 |
| sys | 0.0 |
+--------------------+---------------+
5 rows in set (0.13 sec)
mysql> SET GLOBAL innodb_buffer_pool_size=1073741824;
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT @@innodb_buffer_pool_size;
+---------------------------+
| @@innodb_buffer_pool_size |
+---------------------------+
| 1073741824 |
+---------------------------+
1 row in set (0.00 sec)
/snap/nextcloud/current/my.cnf вот этот файл и он только для чтения
Up to a certain point (version change or crooked settings) everything worked instantly. There are more files even than yours, the search was instantaneous. But, after this point, all the symptoms are the same as yours.
Most likely Nextcloud + Elasticsearch will suit you
https://nextcloud.com/blog/nextcloud-11-introduces...
UPD:
Installation instructions: https://andalys.com/how-to-set-up-elastic-full -tex...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question