Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server load issue #62

Closed
ssdbkey opened this issue Aug 27, 2020 · 8 comments
Closed

Server load issue #62

ssdbkey opened this issue Aug 27, 2020 · 8 comments

Comments

@ssdbkey
Copy link

ssdbkey commented Aug 27, 2020

I'm not sure if this is actually related with server load but please check this one.
I'm a fan of this project so forked and customized it.
Now before move to production, we are testing in local. It works really great when have less than 300 users.
But after that, auto-logout issue is happening, chat freezing issue is happening.
And also even though some users sending message but it isn't shown on the other user's side.
Is this related with socket.io concurrent issue? I applied all approaches introduced in google to fix this issue.
But it only increased from 300 to 350 users.
I have nginx server behind the node server.
Would be great if someone gives me a hint how to solve it or ghchat is only for small amount of users?
it can't support large amount of users?

@aermin
Copy link
Owner

aermin commented Aug 27, 2020

Could you pls test this method?

Socket.io would use used long polling first for compatibility which some platforms couldn't support WebSocket.

image

https://stackoverflow.com/questions/15872788/maximum-concurrent-socket-io-connections

@ssdbkey
Copy link
Author

ssdbkey commented Aug 27, 2020

I already tried it but it doesn't work. Is it related with data amount which is transferred by socket?

@aermin
Copy link
Owner

aermin commented Aug 28, 2020

@sarawut11 when happening this issue, could server-side receive the socket emit from client-side? Such as

 socket.on('sendPrivateMsg', async (data, cbFn) => {
 // here could server-side receive the socket emit from client-side at that time?
  ......
}

Check the server status find is it too busy to handle incoming socket events at that time. If it is, could use some method to do server optimization, such as load balancing, cache technology to prevent operating database immediately, and so on. I am so sorry I have no experience on server optimization.

@aermin
Copy link
Owner

aermin commented Aug 31, 2020

Hi @sarawut11 , are there any updates?

@ssdbkey
Copy link
Author

ssdbkey commented Aug 31, 2020

@aermin I splitted the server into two servers - one for main node server, another one for socket only server.
And run 1 main node server and 5 socket servers, in a word, applying load balancer in nginx.
Let me see how it goes and let you know.
Note sure if this can be a solution tho but I believe it can improve something at least.

@aermin
Copy link
Owner

aermin commented Aug 31, 2020

@aermin I splitted the server into two servers - one for main node server, another one for socket only server.
And run 1 main node server and 5 socket servers, in a word, applying load balancer in nginx.
Let me see how it goes and let you know.
Note sure if this can be a solution tho but I believe it can improve something at least.

Thanks let me know. I hope this project could really help you. Welcome to discuss with me about some performance optimization at least on the code level if you need.

@ssdbkey
Copy link
Author

ssdbkey commented Sep 10, 2020

I could resolve the issue @aermin by refactoring the code architecture.
Thank you.
Anyway, I think, it's worth to discuss with you via live chat.
Can you provide me your contact info?(skype or telegram or discord id?)
You can email me sanit.sa@outlook.com

@ssdbkey ssdbkey closed this as completed Sep 10, 2020
@aermin
Copy link
Owner

aermin commented Sep 11, 2020

@sarawut11 you are very cool ! !

I create a telegram group and will invite other people who have server-side optimization experience, who got this issue, or who are interesting in it.

telegram group link: https://t.me/joinchat/Kabe8hReKws36vfLhHsY6Q

Look forward to taking some discussion with you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants