Yesterday some major server operators were talking about federation performance.

Database and client API performance… no serious cries for help, urgency to the situation. Caching layer on something, even if the server operator has a switch to enable/disable it. Some emergency new log on the API calls to get performance data gathered on what is slow and propose specific fixes for calls.

Lemmy.ml is throwing errors constantly for me in casual reading and commenting. Spent 30 minutes reading and looking at new incoming comments and posts on lemm.ee - it seems sluggish to me, more data than my test server - and routine listing of pages seems slow.

  • RoundSparrowOP
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    lemm.ee seems fast on creating new comments and even votes seem pretty fast. But loading the list of posts seems slow.

  • RoundSparrowOP
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    1 year ago

    I’m looking for low-hanging fruit with api calls in the Rust code.

    The home page of lemmy-ui has trending, which uses a logged-in session to do API call every refresh: /api/v3/community/list?type_=Local&sort=Hot&limit=6

    Personal blocking of communities aside (and NSFW, default to exclude?), this is an ideal query for caching. Re-query every 60 seconds, cut refresh to home page DB access.

    and a switch for operators to set the time, including 0 = always query

    Is it this query in Lemmy 0.18.0 backend?

    SELECT "community"."id", "community"."name", "community"."title", "community"."description", "community"."removed", "community"."published", "community"."updated", "community"."deleted", "community"."nsfw", "community"."actor_id", "community"."local", "community"."private_key", "community"."public_key", "community"."last_refreshed_at", "community"."icon", "community"."banner", "community"."followers_url", "community"."inbox_url", "community"."shared_inbox_url", "community"."hidden", "community"."posting_restricted_to_mods", "community"."instance_id", "community"."moderators_url", "community"."featured_url", "community_aggregates"."id", "community_aggregates"."community_id", "community_aggregates"."subscribers", "community_aggregates"."posts", "community_aggregates"."comments", "community_aggregates"."published", "community_aggregates"."users_active_day", "community_aggregates"."users_active_week", "community_aggregates"."users_active_month", "community_aggregates"."users_active_half_year", "community_aggregates"."hot_rank", "community_follower"."id", "community_follower"."community_id", "community_follower"."person_id", "community_follower"."published", "community_follower"."pending", "community_block"."id", "community_block"."person_id", "community_block"."community_id", "community_block"."published" FROM (((("community" INNER JOIN "community_aggregates" ON ("community_aggregates"."community_id" = "community"."id")) LEFT OUTER JOIN "local_user" ON ("local_user"."person_id" = $1)) LEFT OUTER JOIN "community_follower" ON (("community"."id" = "community_follower"."community_id") AND ("community_follower"."person_id" = $2))) LEFT OUTER JOIN "community_block" ON (("community"."id" = "community_block"."community_id") AND ("community_block"."person_id" = $3))) WHERE (((((("community"."removed" = $4) AND ("community"."deleted" = $5)) AND (("community"."hidden" = $6) OR ("community_follower"."person_id" = $7))) AND ("community"."local" = $8)) AND ("community_block"."person_id" IS NULL)) AND (("community"."nsfw" = $9) OR ("local_user"."show_nsfw" = $10))) ORDER BY "community_aggregates"."hot_rank" DESC LIMIT $11 OFFSET $12