gpt4 book ai didi

ruby-on-rails - Heroku/Memcache/Rack::缓存统计

转载 作者:数据小太阳 更新时间:2023-10-29 08:18:58 27 4
gpt4 key购买 nike

我正在努力思考 Rack::Cache、Rails 3.2、Memcache 和 Heroku。我想我已经把所有这些都协同工作了,如下所述:http://myownpirateradio.com/2012/01/01/getting-heroku-cedar-and-rails-3-1-asset-pipeline-to-play-nicely-together/

综上所述,我不确定 Memcached 是否真的在做它应该做的事情。有什么方法可以获取有关 Memcached 的统计信息或查看 Memcached 是否缓存了请求?我将当前时间放在页面上,并且可以看到它正在被缓存(标题看起来也不错),但我怎么知道它全部使用 Memcached,而不是文件存储?

谢谢。

最佳答案

您可以通过以下方式获取 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:我认为您可能需要使用 Dalli gem 才能工作,但无论如何这是推荐的客户端。

您还可以运行 Rails.cache.class 来查看 Rails 使用的是哪个后端。

关于ruby-on-rails - Heroku/Memcache/Rack::缓存统计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9541817/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com