Skip to content

Commit

Permalink
zbatery use least memory.
Browse files Browse the repository at this point in the history
  • Loading branch information
robbin committed May 8, 2013
1 parent 2de0f44 commit fd62691
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ gem 'sanitize'
gem 'carrierwave', :require => ['carrierwave', 'carrierwave/orm/activerecord']
gem 'mini_magick'
gem 'rest-client'
gem 'puma'
gem 'zbatery'

# Production requirements
# group :production do
Expand Down
15 changes: 12 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,16 @@ GEM
slop (~> 3.4)
pry-padrino (0.1.2)
pry (>= 0.8)
puma (2.0.1)
rack (>= 1.1, < 2.0)
rack (1.5.2)
rack-protection (1.5.0)
rack
rack-test (0.6.2)
rack (>= 1.0)
rainbows (4.5.0)
kgio (~> 2.5)
rack (~> 1.1)
unicorn (~> 4.6, >= 4.6.2)
raindrops (0.11.0)
rake (10.0.4)
rest-client (1.6.7)
mime-types (>= 1.16)
Expand All @@ -92,9 +95,15 @@ GEM
thor (0.17.0)
tilt (1.3.7)
tzinfo (0.3.37)
unicorn (4.6.2)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
url_mount (0.2.1)
rack
will_paginate (3.0.4)
zbatery (4.1.2)
rainbows (~> 4.3)

PLATFORMS
ruby
Expand All @@ -117,11 +126,11 @@ DEPENDENCIES
padrino-gen (~> 0.11)
padrino-helpers (~> 0.11)
pry-padrino
puma
rack-test
rake
rest-client
sanitize
second_level_cache!
tilt (~> 1.3.7)
will_paginate
zbatery
2 changes: 1 addition & 1 deletion config/rainbows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# Use at least one worker per core if you're on a dedicated server,
# more will usually help for _short_ waits on databases/caches.
worker_processes 1
worker_processes 2

# If running the master process as root and the workers as an unprivileged
# user, do this to switch euid/egid in the workers (also chowns logs):
Expand Down
2 changes: 1 addition & 1 deletion puma.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ case "$1" in
bundle exec pumactl -S $state_file stop
;;
restart)
bundle exec pumactl -S $state_file restart
bundle exec pumactl -S $state_file restart
;;
status)
bundle exec pumactl -S $state_file status
Expand Down
File renamed without changes.
32 changes: 32 additions & 0 deletions zbatery.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

# set ruby GC parameters
RUBY_HEAP_MIN_SLOTS=600000
RUBY_FREE_MIN=200000
RUBY_GC_MALLOC_LIMIT=60000000
export RUBY_HEAP_MIN_SLOTS RUBY_FREE_MIN RUBY_GC_MALLOC_LIMIT

pid="log/rainbows.pid"

case "$1" in
start)
bundle exec zbatery -c config/rainbows.rb -E production -D
;;
stop)
kill `cat $pid`
;;
force-stop)
kill -9 `cat $pid`
;;
restart)
$0 stop
sleep 2
$0 start
;;
reload)
kill -USR2 `cat $pid`
;;
*)
echo $"Usage: $0 {start|stop|force-stop|restart|reload}"
;;
esac

0 comments on commit fd62691

Please sign in to comment.