2012-03-02 81 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