यूनिकॉर्न ऑन हेरोकू का उपयोग करते समय। स्केलिंग, समस्याएं होंगी, क्योंकि नव स्केल किए गए वेब डिनो को अनुरोध के द्वारा एक्सेस किया जा सकता है जब यह अभी भी ऐप लोड कर रहा है। जो ज्यादातर टाइमआउट त्रुटि में परिणाम देता है।क्या मैं हेरोोकू + यूनिकॉर्न में ऐप को प्रीलोड कर रहा हूं?
मैं http://codelevy.com/2010/02/09/getting-started-with-unicorn.html और https://github.com/blog/517-unicorn
दो लेख पर पढ़ने का एक सा preload_app true
का उपयोग कर सुझाव दिया था। और after_fork
और before_fork
ब्लॉक।
रेल 3+ में, before_block
में कोड अभी भी आवश्यक है? मैंने कहीं और पढ़ा, अन्यथा। कोई भी जिसने इसे पहले स्थापित करने का अनुभव किया है और साझा करना चाहते हैं?
क्या मुझे कुछ और याद आ रही है? क्या मैं ऐप को सही ढंग से लोड कर रहा हूं?
# config/initializers/unicorn.rb
# Read from:
# http://michaelvanrooijen.com/articles/2011/06/01-more-concurrency-on-a-single-heroku-dyno-with-the-new-celadon-cedar-stack/
worker_processes 3 # amount of unicorn workers to spin up
timeout 30 # restarts workers that hang for 90 seconds
# Noted from http://codelevy.com/2010/02/09/getting-started-with-unicorn.html
# and https://github.com/blog/517-unicorn
preload_app true
after_fork do |server, worker|
ActiveRecord::Base.establish_connection
end
before_fork do |server, worker|
##
# When sent a USR2, Unicorn will suffix its pidfile with .oldbin and
# immediately start loading up a new version of itself (loaded with a new
# version of our app). When this new Unicorn is completely loaded
# it will begin spawning workers. The first worker spawned will check to
# see if an .oldbin pidfile exists. If so, this means we've just booted up
# a new Unicorn and need to tell the old one that it can now die. To do so
# we send it a QUIT.
#
# Using this method we get 0 downtime deploys.
old_pid = Rails.root + '/tmp/pids/unicorn.pid.oldbin'
if File.exists?(old_pid) && server.pid != old_pid
begin
Process.kill("QUIT", File.read(old_pid).to_i)
rescue Errno::ENOENT, Errno::ESRCH
# someone else did our job for us
end
end
end
हाय नील। समाधान ऐप को प्रीलोड करना है, जब तक डिनो (यूनिकॉर्न मास्टर) ऐप को पूरी तरह लोड नहीं करता है, तब तक आने वाले अनुरोधों को रोकने के लिए। मेरी चिंता यह है कि क्या मुझे 'pre_fork' ब्लॉक में कोड चाहिए? –
आपका पहले_फर्क कुछ भी प्राप्त नहीं करेगा। जैसा कि मैंने पहले कहा था, समस्या इस तथ्य में निहित है कि हेरोकू रूटिंग जाल आपके यूनिकॉर्न शुरू होने से पहले आपको अनुरोध भेज देगा। एप्लिकेशन को प्रीलोड करने से यह हल नहीं होगा। –
यदि ऐसा है तो। हेरोोकू पर नए वेब डायनो को कताई/स्केलिंग करते समय कोई टाइमआउट त्रुटियों को कैसे रोकता है? –