-
Notifications
You must be signed in to change notification settings - Fork 980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
listdir/readdir SQL may be get improved #5417
Labels
kind/feature
New feature or request
Comments
Also may need to consider jfs_edge.parent!=jfs_node.parent. Is it hardlink?
Considering existence of hard link, we may modify the query to
pgbench , about 10% CPU usage.
We also need to be cautious on a file system with many hardlinks, which will degrade parent=0 subquery. Let me double check its performance. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What would you like to be added:
If client use readdir or os.listdir in python, it will call below query in juicefs metadata DB:
This query can consume significant DB CPU in some scenarios. Eg, one of our workload will call this query against a directory with 6.9k symlinks repeatedly and this query consume 90% of overall CPU among all juicefs queries with 100ms avg time cost under high load.
Seems both jfs_edge and jfs_node include "parent" column, it is possible to create a covered index on jfs_node on parent column and rewrite the query, eg in PostgreSQL
Using pgbench with old SQL shows 334 tps and used 80% of CPU of a 48 CPU cores DB.
Using pgbench with new SQL and new index shows 522 tps and only used 10% of CPU of a 48 CPU cores DB.
In PostgreSQL, for covered index, there may be performance degradation when "vacuum" is not happening in a timely manner and cause tuple visibility issue, if we configure "vacuum" properly, the chance to encounter such degradation should be minimal.
In MySQL maybe there is no "include" syntax but could create a normal index with all the necessary columns can meet the same goal.
Why is this needed:
The text was updated successfully, but these errors were encountered: