NodeBB Global Chat Plugin : Forum with many users performance issues
-
Hello,
I use global chat plugin on my forum
In the last days, we had a massive influx of registrations and new members which means that they all integrate the chat room of the plugin.Global chat tends to be slow to open and display messages.
Currently with the number of users, my message takes 10s to appear!We see this topic on github plugin page : https://github.com/NodeBB/nodebb-plugin-global-chat/issues/5
I saw this topic and we are exactly in this case. I also answered it and asked a question that remained unanswered, which is why I'm testing my luck here
In this thread, i see maybe a hope fix : https://github.com/NodeBB/nodebb-plugin-global-chat/issues/5#issuecomment-492242438
For anyone with a big forum using this plugin, we implemented a dirty solution.
The issue with many users is that any time a new message arrives to this global chat, the forum hangs cause it needs to deliver notifications to every user in the forum.
To avoid this, we just placed a contidional in this part of the code, if the message was placed in this global chat, it will notify ONLY the online users:
src/messaging/notifications.js
Messaging.notifyUsersInRoom = function (fromUid, roomId, messageObj) { async.waterfall([ function (next) { if (roomId != 5) { // 5 Is the ID of the ID of the global chat room. Messaging.getUidsInRoom(roomId, 0, -1, next); // Proceed as normal. } else { user.getUidsFromSet('users:online', 0, -1, next); // Only notify online users. } },
--> I want to test fix by @fgallese above but :
-
Is this still relevant?
-
Where in the file ( src/messaging/notifications.js) should I put the code?
Thans for your answer. (Hope )
-
-
Anyone ?
I have delete all unregistered users and I have win 5s (10s --> 5s) -
On latest nodebb that code is here https://github.com/NodeBB/NodeBB/blob/master/src/messaging/notifications.js#L15.
It would certainly help since it loads all users in the room and sends a notification to them.
The chat room system wasn't really designed for thousands of users in a room. It started out as private chat between two users, then got expanded to include more users. The current system stores a message history for each user in the room. So when a new message is sent the message id is stored in their history. That means creating 1000s of entries if there are 1000s of users in the room.
I think a shoutbox style global chat plugin makes more sense where message ids are only stored once then it would perform better. That means users would see all the history when they join though which I don't think is a big deal since global chat room is mostly public.
-
First, thanks for your answer
Ok, so I understand that the code has already been integrated and that it does not change much because too many users.
So for now, I understand that I would not have a solution for this problem.
@baris said in NodeBB Global Chat Plugin : Forum with many users performance issues:
I think a shoutbox style global chat plugin makes more sense where message ids are only stored once then it would perform better. That means users would see all the history when they join though which I don't think is a big deal since global chat room is mostly public.
Completely agree with this
And indeed, it will not cause any problem for the user
This is I think the best approachAs this plugin does not currently exist, I will take my troubles patiently
-
If you want to disable sending notifications in the plugin you can simply change index.js file on this line https://github.com/NodeBB/nodebb-plugin-global-chat/blob/master/index.js#L158 and do
data.uids = []
then notifications won't be sent to all users in the global room.That would help but it is not a perfect solution since the message will still need to be added to every single users list of messages.
Properly supporting global chat rooms requires bigger backend changes to core.
-
thanks @baris , I'll try that to see if it helps to resolve my problem
The interesting thing would be not to automatically put users in the chat room and that users can join it manually if they wish without validation on the admin side
Like that, only users wanting to participate (usually few people) would come manually.This would lighten the global chat and not overload it for nothing
--> Maybe with comment this lines like this (I will test) :
-
I have test with your first solution @baris
Result :
- the user who sends the message does not see it displayed. For this he must refresh the page with F5 = no refresh of the chat.
- The other users do receive a notification, which the oin does not want.
--> The global chat should refresh itself when sending a message from anyone without notifying the members of the chat room