草庐IT

redis - redis 中 used_memory_rss 太高

coder 2023-11-07 原文

我有一个 Redis 实例,其最大内存设置为 45GB,已用内存约为 40GB,峰值内存使用量为 42GB,但 RSS 太高了 80GB。 有什么办法可以释放这段内存。

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
76829 root 20 0 95.3g 80g 1328 R 56.4 63.8 29424:59 redis-server

Memory

used_memory:41960888496
used_memory_human:39.08G
used_memory_rss:86287454208
used_memory_rss_human:80.36G
used_memory_peak:46040101560
used_memory_peak_human:42.88G
total_system_memory:135211622400
total_system_memory_human:125.93G
used_memory_lua:37888
used_memory_lua_human:37.00K
maxmemory:48318382080
maxmemory_human:45.00G
maxmemory_policy:allkeys-lru
mem_fragmentation_ratio:2.06
mem_allocator:jemalloc-4.0.3

最佳答案

你有非常大的值(大于 4k)吗?这是一个可能的原因,因为众所周知 jemalloc 在这种情况下会浪费大量内存。

长期以来,这一直是redis的问题,因为redis实际上无法分配内存。

重启可以释放内存,但这当然不是一个好办法。

关于redis - redis 中 used_memory_rss 太高,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44581393/

有关redis - redis 中 used_memory_rss 太高的更多相关文章

  1. ruby-on-rails - Rails 应用程序中的 Rails : How are you using application_controller. rb 是新手吗? - 2

    刚入门rails,开始慢慢理解。有人可以解释或给我一些关于在application_controller中编码的好处或时间和原因的想法吗?有哪些用例。您如何为Rails应用程序使用应用程序Controller?我不想在那里放太多代码,因为据我了解,每个请求都会调用此Controller。这是真的? 最佳答案 ApplicationController实际上是您应用程序中的每个其他Controller都将从中继承的类(尽管这不是强制性的)。我同意不要用太多代码弄乱它并保持干净整洁的态度,尽管在某些情况下ApplicationContr

  2. ruby - Chef : Read variable from file and use it in one converge - 2

    我有以下代码,它下载一个文件,然后将文件的内容读入一个变量。使用该变量,它执行一个命令。这个配方不会收敛,因为/root/foo在编译阶段不存在。我可以通过多个聚合和一个来解决这个问题ifFile.exist但我想用一个收敛来完成它。关于如何做到这一点有什么想法吗?execute'download_joiner'docommand"awss3cps3://bucket/foo/root/foo"not_if{::File.exist?('/root/foo')}endpassword=::File.read('/root/foo').chompexecute'join_domain'd

  3. ruby-on-rails - 语法错误 : unexpected $end when using if/else if? - 2

    我从我的一个Controller类中收到一个错误,我不知道为什么。错误是:SyntaxErrorinTermsController#show,syntaxerror,unexpected$end,expectingkeyword_end这是terms_controller.rb:classTermsController我的展示页面目前只包含:这可能是我遗漏的一些小东西-感谢您的帮助! 最佳答案 问题是end关键字不够,它在它之前找到了$end(代表文件结尾的标记)可以找到它要找的东西——另一个end。(end关键字的解析器标记是“k

  4. ruby HTTPClient : How to use persistent connections? - 2

    如何通过HTTPClient使用持久HTTP连接?发送HTTP请求时是否只是设置KeepAlive的问题?文档指出支持持久连接,但没有告诉我们如何使用它们。 最佳答案 是availableinNet::HTTP如文档中所写,Net::HTTP.startimmediatelycreatesaconnectiontoanHTTPserverwhichiskeptopenforthedurationoftheblock.Theconnectionwillremainopenformultiplerequestsintheblockift

  5. ruby - Rubocop 规则 : Never use 'do' with multi-line 'while - 2

    我有以下代码#coloursarandomcellwithacorrectcolourdefcolour_random!whiletruedocol,row=rand(columns),rand(rows)cell=self[row,col]ifcell.empty?thencell.should_be_filled??cell.colour!(1):cell.colour!(0)breakendendend做什么并不重要,尽管它应该很明显。关键是Rubocop给了我一个警告Neveruse'do'withmulti-line'while为什么我不应该那样做?那我该怎么办呢?

  6. ruby : How can I detect/intelligently guess the delimiter used in a CSV file? - 2

    我需要能够确定我的Ruby项目中的csv文件中使用了哪个分隔符(逗号、空格或分号)。我知道,csv模块中的Python中有一个Sniffer类,可用于猜测给定文件的分隔符。Ruby中有类似的东西吗?非常感谢任何形式的帮助或想法。 最佳答案 看起来py实现只检查几种方言:excel或excel_tab。因此,仅检查","或"\t"的简单实现是:COMMON_DELIMITERS=['","',"\"\t\""].freezedefsniff(path)first_line=File.open(path).firstreturnunle

  7. ruby - Chef Ohai : how to use newly installed Ruby with gem_package - 2

    使用chef我有一个安装gem的简单方法,例如:gem_package"passenger"doversionnode['passenger']['version']end我还想用另一本说明书安装ruby​​,对于某些服务器可能是Ruby1.9.3,对于其他服务器可能是RubyEnterprise1.8.7。所以我想我可以使用gem_binary和ohai来做到这一点,就像这样:gem_package"passenger"doversionnode['passenger']['version']gem_binary"#{languages['ruby']['bin_dir']/gem}

  8. ruby-on-rails - 活跃商家 : How to authorise cards when using gateways that do not support the void operation? - 2

    我正在使用ActiveMerchant开发RubyonRails应用程序的计费组件。我们选择的支付网关是PaymentExpress.我看到的代码示例如下所示,使用authorize()和void()来测试卡的有效性:deftest_card!auth_response=gateway.authorize(100,card)gateway.void(auth_response.authorization)ifauth_response.success?raiseAuthorizationFailed.new(auth_response)unlessauth_response.succe

  9. ruby-on-rails - rails : How can you access session variables using multiple controllers? - 2

    我在使用session变量时遇到问题。我有两个名为“graduate_students_controller”和“current_students_controller”的Controller。这些Controller中的每一个都控制不同的View文件。我在这两个Controller中使用session变量来存储session信息。问题来了。假设我有两个View文件“reports/current_students_list”、“reports/graduate_students_list”,每个文件都由上述Controller单独控制。现在,如果我尝试从同一浏览器中打开这两个网页并尝

  10. ruby - 为什么在 IRB 中使用 Refinement 时得到 "main.using is permitted only at toplevel"? - 2

    我尝试在IRB(v0.9.6,Ruby2.3.0)中使用Refinement:moduleFoorefineObjectdodeffoo()"foo"endendendusingFoo#=>RuntimeError:main.usingispermittedonlyattoplevel这基本上是theexactsetupfromthedocumentation(这会导致相同的错误)。出了什么问题?我该如何解决这个问题? 最佳答案 这可能是IRb的错误或功能不当。众所周知,由于IRb的实现方式非常骇人听闻,因此它无法在所有极端情况下正

随机推荐