Just noticed that on my (low-end) laptop I get fairly high CPU usage from the browser tab for https://programming.dev
So thought I look what it’s doing via Chromium’s DevTools and there is a constant stream of activity. Looking at the websocket messages, it looks like it’s syncing all messages from the server (even for communities I am not subscribed to) to my browser tab (probably every time I reload the page?)
Seriously, that can’t be how it’s supposed to work - and certainly won’t scale? What is going on? Any ideas?
Just one random message from the Websocket (and I am certainly not subscribed to “animals”):
{
"post_view": {
"post": {
"id": 85854,
"name": "Happy sunday from those two sunshines",
"url": "https://feddit.de/pictrs/image/af5f9c55-a257-46a5-8f5b-01a19b13239f.jpeg",
"body": "I will try not to overload this community with pictures of the guinea pig gang, but I can't promise anything.",
"creator_id": 34228,
"community_id": 350,
"removed": false,
"locked": false,
"published": "2023-06-18T10:36:43.876949",
"updated": null,
"deleted": false,
"nsfw": false,
"embed_title": null,
"embed_description": null,
"embed_video_url": null,
"thumbnail_url": "https://beehaw.org/pictrs/image/aaaefb47-ab90-418f-814b-c63086b746f8.jpeg",
"ap_id": "https://feddit.de/post/908703",
"local": false,
"language_id": 0,
"featured_community": false,
"featured_local": false
},
"creator": {
"id": 34228,
"name": "November",
"display_name": null,
"avatar": "https://feddit.de/pictrs/image/ad41ccb1-9fb7-4615-bea4-9dafa4a3cc20.jpeg",
"banned": false,
"published": "2023-06-12T05:45:00.284014",
"updated": null,
"actor_id": "https://feddit.de/u/November",
"bio": null,
"local": false,
"banner": null,
"deleted": false,
"inbox_url": "https://feddit.de/u/November/inbox",
"shared_inbox_url": "https://feddit.de/inbox",
"matrix_user_id": null,
"admin": false,
"bot_account": false,
"ban_expires": null,
"instance_id": 6
},
"community": {
"id": 350,
"name": "animals",
"title": "Animals and Pets",
"description": "Pretty self explanatory. Post animals, post pets, post stuff about animals and pets!\n\n---\n\nThis community's icon was made by Aaron Schneider, under the [CC-BY-NC-SA 4.0 license](https://creativecommons.org/licenses/by-nc-sa/4.0/).",
"removed": false,
"published": "2023-06-06T23:15:43.737680",
"updated": "2023-06-16T19:33:12.626731",
"deleted": false,
"nsfw": false,
"actor_id": "https://beehaw.org/c/animals",
"local": false,
"icon": "https://beehaw.org/pictrs/image/fc62ef62-657e-4ab8-ae33-b32cc20e4dc0.png",
"banner": null,
"hidden": false,
"posting_restricted_to_mods": false,
"instance_id": 5
},
"creator_banned_from_community": false,
"counts": {
"id": 30595,
"post_id": 85854,
"comments": 13,
"score": 64,
"upvotes": 64,
"downvotes": 0,
"published": "2023-06-18T10:36:43.876949",
"newest_comment_time_necro": "2023-06-18T23:01:59.286120",
"newest_comment_time": "2023-06-18T23:01:59.286120",
"featured_community": false,
"featured_local": false,
"hot_rank": 34,
"hot_rank_active": 80
},
"subscribed": "NotSubscribed",
"saved": false,
"read": false,
"creator_blocked": false,
"my_vote": null,
"unread_comments": 13
}
}
There are a lot of performance related issues stemming from the current use of Websockets. While I can’t speak to this specific issue, I can say that the upcoming 0.18 release is going to get rid of the Websockets API in favor of HTTP requests, so this issue may become moot within the next week.
I agree that I suspect is websockets. From the source
Indeed, on lemmy.ml I don’t see that madness of trying to sync all posts from the server with the browser UI over a Websocket connection any more (as the Websocket connection is gone).