Giter VIP home page Giter VIP logo

Comments (8)

jchip avatar jchip commented on July 4, 2024

Hi, thanks for reporting this. Since you filed it under this module only does that mean you added only this module? Is it possible for you to show me the code snippet from your app that uses this module?

Also, from the graph I am not very clear on the memory leak. Do you see a memory usage in your app using electrode that trends up continuously?

from electrode-keepalive.

jchip avatar jchip commented on July 4, 2024

ok, it's available memory. I see.

from electrode-keepalive.

jchip avatar jchip commented on July 4, 2024

this module by nature keeps connections and sockets alive, so the more there are the more memory will be used. It doesn't actually implement the keep alive logic. It just change the logic to lookup idle sockets for reused. The actual implementation is from NodeJS's keep alive agent.

from electrode-keepalive.

jchip avatar jchip commented on July 4, 2024

could you let me know what you use this module for? we use it to keep connections to our internal servers alive so the server IPs remain mostly unchanged and it's just NodeJS keepalive agent that's managing sockets.

I will do some testing to make sure idle sockets get freed.

from electrode-keepalive.

RobGraham avatar RobGraham commented on July 4, 2024

This module was recommended because of the way you implement DNS caching.
Originally we did want to keep sockets alive by passing keepAlive: true, but then we decided to let them get killed off automatically. This belief comes from your readme example. You're passing keepAlive: true which gets passed into the Agent constructor. Node's agent by default does NOT keep the sockets open so removing this option we believed was all that was necessary. Regardless of the option, we still saw memory issues.

Our application in production gets about 30rps and makes 2 downstream calls per request. We believed that DNS resolution would be taken care of by the module while still opening a new socket then killing it on end

from electrode-keepalive.

RobGraham avatar RobGraham commented on July 4, 2024

As far as how we were using it here's a dumbed down version with private info removed:

const ElectrodeKeepAlive = require("electrode-keepalive");
const httpRequest = require("request-promise");

const keepAlive = new ElectrodeKeepAlive();

httpRequest({
    uri: ...,
    agent: keepAlive.agent
})

from electrode-keepalive.

jchip avatar jchip commented on July 4, 2024

Thanks for the info. I will look into them. I will also double check our prod servers. We are using this in a few thousand prod servers and so far I haven't received any reports on unusual memory usage.

I do notice that our code doesn't clean up the DNS pre-fetch record though.

from electrode-keepalive.

jchip avatar jchip commented on July 4, 2024

Were you using any kind of keep alive agent before? This module doesn't add any functionality to the keep alive part. It's just to alter how the keep alive code in NodeJS does idle socket lookup. We need this because our data centers uses Global DNS to do DC balancing and failover, but if you don't have such need, you can just use the regular NodeJS http keep alive agent as is. I wonder if you would have memory issue with that.

from electrode-keepalive.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.