Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

server-key fetching logic is slow and queue-bound #3825

@richvdh

Description

@richvdh

There are a number of problems with the logic in keyring.py for fetching server keys:

  • each request that needs a key for a given server gets queued up, and it's possible to end up with quite a long queue for a given server. If the lookup is successful, that's ok. However, if it fails (which may take many minutes while we wait for timeouts), then we try again for each request in the queue - so we can rapidly end up getting very badly behind. When we want key X for server Y, if there is already a request in the queue for that key, then we should just use the results from it, even if it fails.

  • relatedly, the queueing logic might never complete. If a given request wants keys from server A and server B, and a lookup is already in progress for A, it waits for that to complete. By that time, another request might be doing a lookup for B, so it waits for that to complete. Then we might be waiting for A again. etc. We should immediately start lookups for those servers which aren't already in progress, rather than waiting for the complete set.

  • see also store_server_verify_keys shouldn't need to lock the table #3819 and get_keys_from_store should do one big lookup, not hundreds of tiny ones #3818

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-FederationA-PerformancePerformance, both client-facing and admin-facingz-p2(Deprecated Label)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions