From bbbe318a6cdc8690c670d5cee931d59372dcd724 Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Sun, 9 Mar 2014 14:59:55 -0700 Subject: [PATCH] Lots of cleanup --- Contributing.md | 4 +- README.md | 4 +- examples/config.yml | 4 +- examples/monitrc.conf | 6 +- examples/por.rb | 4 +- examples/sidekiq | 100 ---------------------- examples/upstart/manage-many/README.md | 2 +- examples/upstart/manage-many/sidekiq.conf | 4 +- 8 files changed, 14 insertions(+), 114 deletions(-) delete mode 100644 examples/sidekiq diff --git a/Contributing.md b/Contributing.md index 1055b149..7a434da8 100644 --- a/Contributing.md +++ b/Contributing.md @@ -1,7 +1,6 @@ # Contributing -First of all, thank you for even opening this file up! I hope you find -it worthwhile to help out with Sidekiq. +First of all, thank you! I hope you find it worthwhile to help out with Sidekiq. ## Issues @@ -21,7 +20,6 @@ fix or new functionality. Functionality must meet my design goals and vision for the project to be accepted; I would be happy to discuss how your idea can best fit into Sidekiq. - ## Sponsorship If you've got more money than time and want to sponsor Sidekiq's continued support, your company can buy [Sidekiq Pro](http://sidekiq.org/pro). You get great functionality, I continue to fix bugs and enhance Sidekiq for years to come. diff --git a/README.md b/README.md index 95d05daa..3ccd6e6c 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,14 @@ use the Resque client to enqueue jobs in Redis to be processed by Sidekiq. At the same time, Sidekiq uses multithreading so it is much more memory efficient than Resque (which forks a new process for every job). You'll find that you might need -50 200MB resque processes to peg your CPU whereas one 300MB Sidekiq process will peg +10 200MB resque processes to peg your CPU whereas one 300MB Sidekiq process will peg the same CPU and perform the same amount of work. Requirements ----------------- -I test with the latest Ruby (2.0) and JRuby versions (1.7). Other versions/VMs +I test with the latest Ruby (2.1, 2.0) and JRuby versions (1.7). Other versions/VMs are untested but might work fine. The last two major Rails releases (3.2 and 4.0) are officially supported, other diff --git a/examples/config.yml b/examples/config.yml index 8afd0b1f..6c0fea49 100644 --- a/examples/config.yml +++ b/examples/config.yml @@ -4,7 +4,9 @@ --- :verbose: false :pidfile: ./tmp/pids/sidekiq.pid -:concurrency: 25 +:concurrency: 25 +# Set timeout to 8 on Heroku, longer if you manage your own systems. +:timeout: 30 :queues: - [often, 7] - [default, 5] diff --git a/examples/monitrc.conf b/examples/monitrc.conf index 5520096c..8f6a6d53 100644 --- a/examples/monitrc.conf +++ b/examples/monitrc.conf @@ -1,6 +1,6 @@ check process sidekiq_myapp with pidfile /path/to/sidekiq.pid - start program = "bundle exec sidekiq -C /path/to/sidekiq_conf.yml -P /path/to/sidekiq.pid" with timeout 90 seconds - stop program = "kill -s TERM `cat /path/to/sidekiq.pid`" with timeout 90 seconds - if totalmem is greater than 500 MB for 2 cycles then restart # eating up memory? + start program = "bundle exec sidekiq -C /path/to/sidekiq_conf.yml -P /path/to/sidekiq.pid" with timeout 30 seconds + stop program = "kill -s TERM `cat /path/to/sidekiq.pid`" with timeout 30 seconds + if totalmem is greater than 500 MB for 2 cycles then restart # VM bloat is common in Rails apps group myapp_sidekiq diff --git a/examples/por.rb b/examples/por.rb index f3b53803..782edc90 100644 --- a/examples/por.rb +++ b/examples/por.rb @@ -2,12 +2,12 @@ require 'sidekiq' # If your client is single-threaded, we just need a single connection in our Redis connection pool Sidekiq.configure_client do |config| - config.redis = { :namespace => 'x', :size => 1, :url => 'redis://redis.host:1234/14' } + config.redis = { :namespace => 'x', :size => 1 } end # Sidekiq server is multi-threaded so our Redis connection pool size defaults to concurrency (-c) Sidekiq.configure_server do |config| - config.redis = { :namespace => 'x', :url => 'redis://redis.host:1234/14' } + config.redis = { :namespace => 'x' } end # Start up sidekiq via diff --git a/examples/sidekiq b/examples/sidekiq deleted file mode 100644 index 95403ecc..00000000 --- a/examples/sidekiq +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/bash -# sidekiq Init script for Sidekiq -# chkconfig: 345 100 75 -# -# Description: Starts and Stops Sidekiq message processor for Stratus application. -# -# User-specified exit parameters used in this script: -# -# Exit Code 5 - Incorrect User ID -# Exit Code 6 - Directory not found - - -#Variable Set -APP="stratus" -APP_DIR="/opt/railsapps/${APP}" -APP_CONFIG="${APP_DIR}/config" -LOG_FILE="$APP_DIR/log/sidekiq.log" -LOCK_FILE="$APP_DIR/${APP}-lock" -PID_FILE="$APP_DIR/${APP}.pid" -GEMFILE="$APP_DIR/Gemfile" -SIDEKIQ="sidekiq" -APP_ENV="production" -BUNDLE="bundle" - -START_CMD="$BUNDLE exec $SIDEKIQ -e $APP_ENV -P $PID_FILE" -RETVAL=0 - - -start() { - - status - if [ $? -eq 1 ]; then - - [ `id -u` == '0' ] || (echo "$SIDEKIQ runs as root only .."; exit 5) - [ -d $APP_DIR ] || (echo "$APP_DIR not found!.. Exiting"; exit 6) - cd $APP_DIR - echo "Starting $SIDEKIQ message processor .. " - $START_CMD >> $LOG_FILE 2>&1 & - RETVAL=$? - #Sleeping for 8 seconds for process to be precisely visible in process table - See status () - sleep 8 - [ $RETVAL -eq 0 ] && touch $LOCK_FILE - return $RETVAL - else - echo "$SIDEKIQ message processor is already running .. " - fi - - -} - -stop() { - - echo "Stopping $SIDEKIQ message processor .." - SIG="INT" - kill -$SIG `cat $PID_FILE` - RETVAL=$? - [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE - return $RETVAL -} - - -status() { - - ps -ef | egrep 'sidekiq [0-9]+.[0-9]+.[0-9]+' | grep -v grep - return $? -} - - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - while status > /dev/null - do - sleep 0.5 - done - start - ;; - status) - status - - if [ $? -eq 0 ]; then - echo "$SIDEKIQ message processor is running .." - RETVAL=0 - else - echo "$SIDEKIQ message processor is stopped .." - RETVAL=1 - fi - ;; - *) - echo "Usage: $0 {start|stop|restart|status}" - exit 0 - ;; -esac -exit $RETVAL diff --git a/examples/upstart/manage-many/README.md b/examples/upstart/manage-many/README.md index 097bcf6d..2589b2dd 100644 --- a/examples/upstart/manage-many/README.md +++ b/examples/upstart/manage-many/README.md @@ -43,7 +43,7 @@ Each sidekiq instance is named after its directory, so for an app called `/home/ * The script expects: * a config file to exist under `config/sidekiq.yml` in your app. E.g.: `/home/apps/my-app/config/sidekiq.yml`. - * a temporary folder to put the processes PIDs exists called `tmp/sidekiq`. E.g.: `/home/apps/my-app/tmp/sidekiq`. + * a temporary folder to put the processes PIDs exists called `tmp/pids`. E.g.: `/home/apps/my-app/tmp/pids`. You can always change those defaults by editing the scripts. diff --git a/examples/upstart/manage-many/sidekiq.conf b/examples/upstart/manage-many/sidekiq.conf index 8af6e1ed..4b2d4a9c 100644 --- a/examples/upstart/manage-many/sidekiq.conf +++ b/examples/upstart/manage-many/sidekiq.conf @@ -55,7 +55,7 @@ exec /bin/bash <