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

Memory problem in Socket.IO #181

Closed
arenstar opened this issue Mar 31, 2011 · 13 comments
Closed

Memory problem in Socket.IO #181

arenstar opened this issue Mar 31, 2011 · 13 comments

Comments

@arenstar
Copy link

Basically, every request that Socket.IO handles increases my Resident Memory by roughly 1Mb..
Memory problem in Socket.IO...
This is not a Node problem, as the same test situation leaves the Resident Memory at the same value..

As far as i can see, using Node-0.4.4 and the latest Socket.IO-node, there is a huge problem with either Websockets or XHR which doesnt clean connections from memory..
I also dont understand why 1 socket.io client connection requires roughly 1Mb... ???
Regardless if i close the connection and reopen it, or keep the connection open and create a new one.. Memory Increases and never ever decreases :(

Can someone please take a look at this.. perhaps im missing something..
I was hoping to use socket.io to maintain 30k + connections on 8gb Ram..
at this rate, ill be lucky to get 8k...

@pyrostrex
Copy link

I was experiencing this too since v0.6.16. When I deactivate socket.io in the middle of running my application, the system maintain in 7% of 2gb memory usage and it was about 100+ downloads / second. But, when I activate the socket.io back, It will keep on rising until it reaches 100% and crashes my server. This is a very critical problem and not to mention that my application depends on Socket.IO so much. I hope it can be fixed. (at this time, my application detects there's only 9 connection astablished through socket.io).

@3rd-Eden
Copy link
Contributor

Could you give us some more details? I have been trying to reproduce this issue, but I'm unable to do so.

I'm using wsbench to overload Socket.IO with connections:

node wsbench -c 200 -r 50 -t 20000 ws://127.0.0.1:8080/socket.io/websocket

( note the -t a custom option that i added, it's the timeout or the amount of time it should stay connected to the server )

What the line above does is create 200 Websockets to the socket.io websocket end point at a rate of 50 connections per second.

During the connection sequence it spiked up to 50mb memory usage, when all handshakes where established the memory level dropped back at 19mb. Disconnecting also spiked the memory 50mb.. and than the memory went back to 13.8~ the same state the server was initially.

@arenstar
Copy link
Author

I will definitely try this
using
https://github.com/pgriess/wsbench
and report back

Cheers

@3rd-Eden
Copy link
Contributor

Oh yeah, small note: I was using the latest version of Socket.IO-node
On Mar 31, 2011, at 9:05 PM, arenstar wrote:

I will definitely try this
using
https://github.com/pgriess/wsbench
and report back

Cheers

Reply to this email directly or view it on GitHub:
https://github.com/LearnBoost/Socket.IO-node/issues/181#comment_942561

@arenstar
Copy link
Author

ohh i also am using the Latest version..

How can i use wsbench with SSL???

do you know??

@pyrostrex
Copy link

Well, maybe It was because I was using www.github.com/substack/dnode for my development. I will try it again later using ordinary socket.io and the latest version.

@arenstar
Copy link
Author

Why is this issue closed???

@pyrostrex
Copy link

maybe he thought it was the same person.

@arenstar
Copy link
Author

arenstar commented Apr 1, 2011

This has seems to have fixed the problem!!!

nodejs/node-v0.x-archive@5c35dff

@3rd-Eden
Copy link
Contributor

3rd-Eden commented Apr 1, 2011

I'm glad you found the issue.

@arenstar
Copy link
Author

arenstar commented Apr 1, 2011

Yeah me too :D

Which wsbench are you using??
i dont have "time" -t available..

Cheers

@3rd-Eden
Copy link
Contributor

3rd-Eden commented Apr 1, 2011

Under the command I listed "( note the -t a custom option that i added, it's the timeout or the amount of time it should stay connected to the server )"

So I added it manually to test long living connections for Socket.IO. You can basically emulate it your self, by creating a new "session" file for wsbench, add close the websocket connection using a setTimeout.

@arenstar
Copy link
Author

arenstar commented Apr 1, 2011

Can you umm.. perhaps give me an example.. :D

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

3 participants