This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEFORE: | |
sam@ubuntu discourse % rm -fr tmp/cache | |
sam@ubuntu discourse % rm -fr public/assets | |
sam@ubuntu discourse % time RAILS_ENV=production bin/rake assets:precompile | |
58.55s user 1.79s system 100% cpu 1:00.02 total | |
AFTER: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GC STATS: | |
count: 1191 | |
heap_used: 1422 | |
heap_length: 1422 | |
heap_increment: 0 | |
heap_live_num: 389339 | |
heap_free_num: 189144 | |
heap_final_num: 0 | |
total_allocated_object: 133699466 | |
total_freed_object: 133310127 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before patch: | |
--- | |
topic_admin: | |
50: 24 | |
75: 25 | |
90: 27 | |
99: 46 | |
home_admin: | |
50: 66 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sam@bench:~/discourse$ chruby 2.0.0-p353 | |
sam@bench:~/discourse$ ruby script/bench.rb -m | |
--- | |
categories_admin: | |
50: 109 | |
75: 175 | |
90: 179 | |
99: 207 | |
home_admin: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEFORE | |
--- | |
categories_admin: | |
50: 106 | |
75: 112 | |
90: 143 | |
99: 205 | |
home_admin: | |
50: 64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Object | |
@@acts_like_cache = {} | |
# A duck-type assistant method. For example, Active Support extends Date | |
# to define an <tt>acts_like_date?</tt> method, and extends Time to define | |
# <tt>acts_like_time?</tt>. As a result, we can do <tt>x.acts_like?(:time)</tt> and | |
# <tt>x.acts_like?(:date)</tt> to do duck-type-safe comparisons, since classes that | |
# we want to act like Time simply need to define an <tt>acts_like_time?</tt> method. | |
def acts_like?(duck) | |
respond_to? (@@acts_like_cache[duck] ||= :"acts_like_#{duck}?") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@retained = [] | |
MAX_STRING_SIZE = 100 | |
def stress(allocate_count, retain_count, chunk_size) | |
chunk = [] | |
while retain_count > 0 || allocate_count > 0 | |
if retain_count == 0 || (Random.rand < 0.5 && allocate_count > 0) | |
chunk << " " * (Random.rand * MAX_STRING_SIZE).to_i | |
allocate_count -= 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Running in ruby-42105 | |
Duration: 6.152866841 | |
sam 18719 88.0 0.7 226236 197432 pts/1 Sl+ 22:46 0:06 ruby mem.rb | |
Running in ruby-42110 | |
Duration: 5.485298626 | |
sam 18728 110 1.3 351912 322304 pts/1 Sl+ 22:46 0:05 ruby mem.rb | |
Running in ruby-42563 | |
Duration: 5.216104843 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@retained = [] | |
@rand = Random.new(1) | |
MAX_STRING_SIZE = 100 | |
def stress(allocate_count, retain_count, chunk_size) | |
chunk = [] | |
while retain_count > 0 || allocate_count > 0 | |
if retain_count == 0 || (@rand.rand < 0.5 && allocate_count > 0) | |
chunk << " " * (@rand.rand * MAX_STRING_SIZE).to_i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sam@ubuntu discourse_docker % ./launcher ssh standalone | |
Welcome to Discourse Docker | |
Use: rails, rake or discourse to execute commands in production | |
root@ubuntu-standalone:~# discourse | |
Commands: | |
discourse backup # Backup a discourse forum |
OlderNewer