Git Product home page Git Product logo

Comments (2)

loganb avatar loganb commented on June 28, 2024

FWIW,

I use Dynamoid with passenger and warm it up before forking and have not had this problem. If you track it down, I'd like to hear about the root cause.

Sent from my iPhone

On Apr 10, 2013, at 5:26 AM, Ryan Conway [email protected] wrote:

Hey there,

We're looking into using Unicorn's 'preload_app' option, which speeds up app startup and reduces memory usage by spawning a single instance of your application, and then forking that several times for each worker.

The only downside is that you need to make sure you re-initiate all external connections in an 'after_fork' block. We've set up ours to do the following:

after_fork do |server, worker|
Dynamoid::Adapter.reconnect!
end
Unfortunately, this doesn't seem to work as expected, as running under Unicorn with 'preload_app true' we sometimes get responses back that appear to be for a different request, which causes problems. If we set 'preload_app false' this issue goes away.

We're not 100% certain the issue is in Dynamoid itself, but figured you'd be a good person to ask :D

If you have any advice for using Dynamoid within an environment such as Unicorn preload, or Passenger when set to spawning mode, I welcome it!

Thanks!
Ryan


Reply to this email directly or view it on GitHub.

from dynamoid.

Rylon avatar Rylon commented on June 28, 2024

I wasn't able to get to the bottom of it unfortunately, so I took a different approach, and moved our DB connection code into a separate file, which is only included in the Unicorn.rb, in the 'after_fork' block. This guarantees that no existing DB connection remains, and the issues have now been resolved.

from dynamoid.

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.