Coder Social home page Coder Social logo

Comments (5)

trowski avatar trowski commented on July 18, 2024

I just replaced the pool implementation in v0.3.0, but this is still an issue in the new implementation. I'll look into adding a timer that closes connections after a period of time. Same in the postgres library.

from mysql.

rdlowrey avatar rdlowrey commented on July 18, 2024

Y'all probably already know this but sharing for general info and posterity here ...

The approach that's works well for this kind of thing in aerys is having each connection carry its own "state" object with a lastUsedAt timestamp (or equivalent). Then there's a single timer watcher for the pool that triggers once per second to iterate over all open connections that aren't awaiting a response from the other party to check if (now - lastUsedAt) > configurableClientLevelIdlenessTimeout ...

In general it's important to avoid individual per-connection timers because: overhead.

from mysql.

trowski avatar trowski commented on July 18, 2024

@rdlowrey Yeah, that's the approach I was going to take. The pool implementation has a queue of idle connections where the most recently used goes at the end, so I should be able to just iterate from the front, removing connections as necessary. A busy pool would only need to examine a single connection.

from mysql.

kelunik avatar kelunik commented on July 18, 2024

@rdlowrey it's an optimization, it's not actually important. A userland MySQL client has other bottlenecks.

from mysql.

brstgt avatar brstgt commented on July 18, 2024

That's done, right?

from mysql.

Related Issues (20)

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.