Skip to content

CommentCache.sortWithRedis can seriously degrade performance and seems unnecessary #4860

@fdintino

Description

@fdintino

The code that sorts comments using redis keys can result in what seems like an excessive number of redis calls. On a recent AllCommentsTabQuery for a stream with 900 comments there were a total of 1,815 ZRANGE, ORGANIZE, and EXISTS calls made.

What's more, I'm not quite clear on what value the redis sort logic provides. If the sort cache key doesn't exist it falls back to a straightforward array sort (CommentCache.sortComments) using data that has already been queried (so it's not as though the redis sort is taking the place of potentially slower mongo queries).

I've opened this ticket to get confirmation that I'm not overlooking something with the cache-based comment sorting. If it turns out to be unnecessary I'd be happy to open a pull request removing this code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions