Optimize domain blocks by storing in a dedicated table
What feature would you like implemented? (Please give us a brief description of what you'd like.)
Migrate (or copy) the blocked domains list out of the meta
table and into a dedicated table. This would allow for multiple optimizations:
- Pre-normalize the host names (make them lower-case).
- Pre-generate a "base domain" pattern (
%.example.com
). - Use a join instead of dynamically generated queries (
FederationChart
is a prime candidate).
Additional optimizations are possible with other small changes:
-
Pre-normalize the host names in(this is already implemented)instance
to avoidILike
operations. - Apply the same changes to the silenced instance list.
- Avoid duplicate case conversions. (
UtilityService.isBlockedHost
,UtilityService.isSilencedHost
)
Why should we add this feature? (Please give us a brief description of why your feature is important.)
Domain blocks have a serious impact to server performance, especially in the FederationChart
service. This is because the entire blocklist must be inlined into a dynamically-generated query based on ILike
comparisons. This query - and others like it - have O(D*B*L)
growth where D is the number of known domains, B is the number of blocked domains, and L is the average length of a blocked domain name. This can result is long freezes, even on a small instance.
Concerns and notes:
- For backwards compatibility, we should preserve the existing field in
meta
.
Contribution Guidelines By submitting this issue, you agree to follow our Contribution Guidelines
- I agree to follow this project's Contribution Guidelines
- I have searched the issue tracker for similar requests, and this is not a duplicate.