Skip to content

Memory problem in Socket.IO #181

Closed
Closed

Description

@arenstar

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...

Activity

  1. pyrostrex commented on Mar 31, 2011

    @pyrostrex

    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).

  2. 3rd-Eden commented on Mar 31, 2011

    @3rd-Eden
    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.

  3. arenstar commented on Mar 31, 2011

    @arenstar
    Author

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

    Cheers

  4. 3rd-Eden commented on Mar 31, 2011

    @3rd-Eden
    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

  5. arenstar commented on Mar 31, 2011

    @arenstar
    Author

    ohh i also am using the Latest version..

    How can i use wsbench with SSL???

    do you know??

  6. pyrostrex commented on Mar 31, 2011

    @pyrostrex

    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.

  7. arenstar commented on Mar 31, 2011

    @arenstar
    Author

    Why is this issue closed???

  8. pyrostrex commented on Apr 1, 2011

    @pyrostrex

    maybe he thought it was the same person.

  9. arenstar commented on Apr 1, 2011

    @arenstar
    Author

    This has seems to have fixed the problem!!!

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

  10. 3rd-Eden commented on Apr 1, 2011

    @3rd-Eden
    Contributor

    I'm glad you found the issue.

  11. arenstar commented on Apr 1, 2011

    @arenstar
    Author

    Yeah me too :D

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

    Cheers

  12. 3rd-Eden commented on Apr 1, 2011

    @3rd-Eden
    Contributor

    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.

  13. arenstar commented on Apr 1, 2011

    @arenstar
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions