I have 2000 rooms running concurrently in my system where users are joined. I need to send command in every room in every 1 second to update some properties. These properties can be database stuff, hitting external REST APIs or some variables.
As of now, I'm iterating over room list and sending commands via handleInternalMessage of room extension to all the rooms. But it seems to be a synchronous activity as I can return data from room extension and can read from where I called.
Is it the good way to implement this or any other way through which I can send commands to all the rooms in every 1 second simultaneously.
Please assist.
Is handleInternalMessage Synchronous?
-
- Posts: 2
- Joined: 02 Jan 2017, 11:42
Re: Is handleInternalMessage Synchronous?
Hi,
Yes, it is synchronous.
Well, if you have DB or HTTP calls they will hold the current thread for as long as they need to run and the process of repeating it 2000 times will take quite a while.
Imagine each call takes 300ms x 2000 = 600K msec => 10 minutes!
I think there are better ways to do this, but I might not be able to see the full picture here, so I might be wrong.
Cheers
harish2992 wrote:As of now, I'm iterating over room list and sending commands via handleInternalMessage of room extension to all the rooms. But it seems to be a synchronous activity as I can return data from room extension and can read from where I called.
Yes, it is synchronous.
Is it the good way to implement this or any other way through which I can send commands to all the rooms in every 1 second simultaneously.
Well, if you have DB or HTTP calls they will hold the current thread for as long as they need to run and the process of repeating it 2000 times will take quite a while.
Imagine each call takes 300ms x 2000 = 600K msec => 10 minutes!
I think there are better ways to do this, but I might not be able to see the full picture here, so I might be wrong.
Cheers
Who is online
Users browsing this forum: heroumi and 47 guests