Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Performance #263

Closed
Karafs opened this issue Oct 1, 2019 · 10 comments
Closed

Performance #263

Karafs opened this issue Oct 1, 2019 · 10 comments
Labels

Comments

@Karafs
Copy link

Karafs commented Oct 1, 2019

Hi. I'm a beginner in Golang and wrote a server application with this library.
My problem is that when just one user connects to the server with socket, the CPU performance of the server is going upper than 100%. Do you have any idea?
I registered about 35 events on the server socket.
Also when I send an event from the client to the server, It’s taking a too long time to call event on the server. The server state and ping time is OK.

@Karafs Karafs added the bug label Oct 1, 2019
@sshaplygin
Copy link
Collaborator

@Karafs Hi!
Tell about you os and hardware parameters. We need more informations

@Karafs
Copy link
Author

Karafs commented Oct 2, 2019

@Karafs Hi!
Tell about you os and hardware parameters. We need more informations
I'm in the test and debug state. So I set up a simple and minimum server with 2 Gig ram and 2 core at CPU and 25 Gig hardDrive and my os is ubuntu 18.04.
I know my hardware is low, but my problem is with one socket pet time, not oo much socket and process.

@Karafs
Copy link
Author

Karafs commented Oct 2, 2019

image

@Karafs
Copy link
Author

Karafs commented Oct 2, 2019

My mongodb version is 4.2 and I'm using globalsign library. I think the problem is the mongo library that I use.

@sshaplygin
Copy link
Collaborator

sshaplygin commented Oct 4, 2019

@Karafs if your graph is true. bottlenecks is mongodb library.
Notice: you will wanna approve performance, you should rewrite broadcast.go.
Because "Deffer" construction is overhead on 10-20 ns.
But if you use sync.Mutex have problem you can face the problem about - "Cache contention problem". It is problem resolved on Golang 1.9 by sync.Map. sync.Mutex is faster as sync.Map on lower cpu machines but if you use machine upper 4 cores, sync.Map is faster as sync.Mutex.

Graph by performance sync.Mutex and sync.Map

@Karafs If your question is not actual yet. please close issue.

@Karafs
Copy link
Author

Karafs commented Oct 5, 2019

Thanks for your reply. I used a mongo package that doesn't support mongo 4.2. So I changed that library with mongo official library. But the problem is consists. I'm working on that.

@Karafs
Copy link
Author

Karafs commented Oct 5, 2019

I tested more.
I disabled any sending event to the server socket. Right now I just connect to server socket and nothing more. after connect with just one user, My server ram usage is going up from 300 to 1 Gig. And when I disconnect from the client before Ram reaches 1 Gig, the ram is not going up anymore. My CPU is the same as my ram. It's going up. Do you have any idea? Am I wrong somewhere? Is there any configuration that I missed?
My actual problem is sending an event to the server. After connect, some initial events reach the server and after a few seconds, events do not reach to server. So I test some more and observed the above issue.
@mrfoe7

@Karafs
Copy link
Author

Karafs commented Oct 5, 2019

image
image

@Karafs Karafs closed this as completed Oct 6, 2019
@sshaplygin
Copy link
Collaborator

Thanks for your reply. I used a mongo package that doesn't support mongo 4.2. So I changed that library with mongo official library. But the problem is consists. I'm working on that.

Not problem. It is so interesting theme.

@sshaplygin
Copy link
Collaborator

I tested more.
I disabled any sending event to the server socket. Right now I just connect to server socket and nothing more. after connect with just one user, My server ram usage is going up from 300 to 1 Gig. And when I disconnect from the client before Ram reaches 1 Gig, the ram is not going up anymore. My CPU is the same as my ram. It's going up. Do you have any idea? Am I wrong somewhere? Is there any configuration that I missed?
My actual problem is sending an event to the server. After connect, some initial events reach the server and after a few seconds, events do not reach to server. So I test some more and observed the above issue.
@mrfoe7

Thanks for you research.
I think it is same problem by go-engine but not go-socket.io. I know what go-engine need some engineers contributors! link
If you have some free time, we need you help

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

No branches or pull requests

2 participants