2012-03-02 83 views
2

我試圖環繞機架我的大腦::緩存,Rails的3.2,內存緩存,以及Heroku的。我想我已經把它們合在一起,如下所示:http://myownpirateradio.com/2012/01/01/getting-heroku-cedar-and-rails-3-1-asset-pipeline-to-play-nicely-together/的Heroku /內存緩存/機架::緩存統計

所有這一切說,我不確定Memcached是否真的在做它應該做的。有沒有辦法在Memcached上獲取統計信息,或者查看是否有Memcached緩存請求?我將當前時間放在一個頁面上,並且可以看到它正在緩存(標題看起來不錯),但是我怎麼知道它是與Memcached一起工作的,而不是文件存儲?

謝謝。

回答

9

您可以通過執行獲得memcached的統計:

$ heroku run console 
Running console attached to terminal... up, run.1 
Loading production environment (Rails 3.1.3) 
irb(main):001:0> Rails.cache.stats 
Dalli/SASL authenticating as app590983%40heroku.com 
Dalli/SASL: Authenticated 
=> {"mc5.ec2.northscale.net:11211"=>{"evictions"=>"0", "curr_items"=>"627", 
    "total_items"=>"1257", "bytes"=>"2294318", "reclaimed"=>"0", 
    "engine_maxbytes"=>"5242880", "bucket_conns"=>"2", "pid"=>"319", 
    "uptime"=>"6710022", "time"=>"1330731177", "version"=>"1.4.4_207_g19c6b9e", 
    "libevent"=>"1.4.11-stable", "pointer_size"=>"64", 
    "rusage_user"=>"34354.590000", "rusage_system"=>"31381.520000", 
    "daemon_connections"=>"10", "curr_connections"=>"1211", 
    "total_connections"=>"14127919", "connection_structures"=>"1764", 
    "cmd_get"=>"9476", "cmd_set"=>"1257", "cmd_flush"=>"0", "auth_cmds"=>"24", 
    "auth_errors"=>"0", "get_hits"=>"8093", "get_misses"=>"1383", 
    "delete_misses"=>"0", "delete_hits"=>"0", "incr_misses"=>"0", 
    "incr_hits"=>"0", "decr_misses"=>"0", "decr_hits"=>"0", "cas_misses"=>"0", 
    "cas_hits"=>"0", "cas_badval"=>"0", "bytes_read"=>"21983909", 
    "bytes_written"=>"85267718", "limit_maxbytes"=>"67108864", 
    "rejected_conns"=>"0", "threads"=>"4", "conn_yields"=>"0"}} 

PS:我想你可能需要使用寶石達利這個工作,但這是推薦客戶呢。

您還可以運行Rails.cache.class看到哪個後端是使用Rails。

+0

謝謝!瞭解用於理解Rails.cache.stats輸出的任何資源? – 2012-03-02 23:38:28

+0

不是,大部分的關鍵看起來都很自我描述。如果有什麼具體的,你想知道,你可以發佈一個問題。 – 2012-03-03 00:16:16

+0

我有一個類似的問題(http://stackoverflow.com/questions/10115187/what-exactly-does-the-memcached-size-limit-represent-with-file-system-entitystor) - 這並沒有完全得到我來一個答案...任何幫助將不勝感激! @的Jakub-hampl – Brandon 2012-04-12 03:56:35