Skip to content

Instantly share code, notes, and snippets.

@jhubert
Last active July 21, 2016 00:16
Show Gist options
  • Select an option

  • Save jhubert/2a5a1889a77693d4c1c62a0e145dcea5 to your computer and use it in GitHub Desktop.

Select an option

Save jhubert/2a5a1889a77693d4c1c62a0e145dcea5 to your computer and use it in GitHub Desktop.

Revisions

  1. jhubert revised this gist Jul 21, 2016. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion benchmark-caches-from-heroku.markdown
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,6 @@ Benchmark.ips do |x|
    dc_networked.fetch(rand(KEY_SIZE)) { :value }
    end


    redis_networked = ActiveSupport::Cache::RedisStore.new(ENV['REDISCLOUD_URL'])
    redis_networked.clear
    x.report("#{redis_networked.class} at #{URI.parse(ENV['REDISCLOUD_URL']).host}") do
  2. jhubert revised this gist Jul 21, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion benchmark-caches-from-heroku.markdown
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    I did some performance testing from heroku to memcachier and redis-cloud to check the iterations per second. Here is how I did it, based on the work that @nateberkop did:
    I did some performance testing from heroku to memcachier and redis-cloud to check the iterations per second. Here is how I did it, based on [the work that @nateberkopec did](https://gist.github.com/nateberkopec/14d6a2fb7fe5da06a1f6):

    From `heroku run bash -r production` run the following:

  3. jhubert created this gist Jul 21, 2016.
    54 changes: 54 additions & 0 deletions benchmark-caches-from-heroku.markdown
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,54 @@
    I did some performance testing from heroku to memcachier and redis-cloud to check the iterations per second. Here is how I did it, based on the work that @nateberkop did:

    From `heroku run bash -r production` run the following:

    ```bash
    gem install benchmark-ips --no-doc --no-ri
    gem install redis-activesupport --no-doc --no-ri
    # the other gems are already installed because they're included in our app's gemfile, but you may need:
    # gem install dalli --no-doc --no-ri
    # gem install rails --no-doc --no-ri
    ```

    and then paste this script into an `irb` console:

    ```ruby
    require 'active_support'
    require 'benchmark/ips'
    require 'dalli'
    require 'active_support/cache/dalli_store'
    require 'active_support/cache/redis_store'

    KEY_SIZE = 2_000

    Benchmark.ips do |x|
    dc_networked = ActiveSupport::Cache::DalliStore.new(ENV['MEMCACHIER_SERVERS'], username: ENV['MEMCACHIER_USERNAME'], password: ENV['MEMCACHIER_PASSWORD'])
    dc_networked.clear
    x.report("#{dc_networked.class} at #{ENV['MEMCACHIER_SERVERS']}") do
    dc_networked.fetch(rand(KEY_SIZE)) { :value }
    end


    redis_networked = ActiveSupport::Cache::RedisStore.new(ENV['REDISCLOUD_URL'])
    redis_networked.clear
    x.report("#{redis_networked.class} at #{URI.parse(ENV['REDISCLOUD_URL']).host}") do
    redis_networked.fetch(rand(KEY_SIZE)) { :value }
    end
    end
    ```

    Here are the results:

    ```
    Warming up --------------------------------------
    ActiveSupport::Cache::DalliStore at mc2.dev.ec2.memcachier.com:11211
    40.000 i/100ms
    ActiveSupport::Cache::RedisStore at pub-redis-16974.us-east-1-4.1.ec2.garantiadata.com
    37.000 i/100ms
    Calculating -------------------------------------
    ActiveSupport::Cache::DalliStore at mc2.dev.ec2.memcachier.com:11211
    451.147 (±21.9%) i/s - 2.120k in 5.034654s
    ActiveSupport::Cache::RedisStore at pub-redis-16974.us-east-1-4.1.ec2.garantiadata.com
    553.988 (±14.6%) i/s - 2.738k in 5.059287s
    ```