阅读Redis信息(Reading Redis Info)

我的笔记本电脑只有8GB内存,我试着对我的应用程序进行压力测试,该应用程序大量使用Redis。 当我查看INFO输出时,我无法弄清楚如何使用内存为31.83GB。 Rdb转储只有300 MB。

# Memory
used_memory:34177666096
used_memory_human:31.83G
used_memory_rss:412901376
used_memory_peak:34175483600
used_memory_peak_human:31.83G
used_memory_lua:31744
mem_fragmentation_ratio:0.01
mem_allocator:libc

问题:

为什么Rdb转储如此之小且used_memory_human如此之大? 如何识别实际内存使用情况(INFO显示不同的内容)?


My laptop has only 8GB RAM, I tried to stress test my app, which uses Redis heavily. When I looked at INFO output I couldn't figure out how used memory can be 31.83GB. Rdb dump is only 300 mb.

# Memory
used_memory:34177666096
used_memory_human:31.83G
used_memory_rss:412901376
used_memory_peak:34175483600
used_memory_peak_human:31.83G
used_memory_lua:31744
mem_fragmentation_ratio:0.01
mem_allocator:libc

Questions:

Why Rdb dump is so small and used_memory_human is so big? How to identify actual memory usage (INFO shows something different)?


原文:
2023-01-10 08:01

满意答案

你需要forceDelete方法

Model::where('condition')->where('may be other condition')->forceDelete();

或特定的模型实例:

$modelInstance = Model::find($id);
$modelInstance->forceDelete();

You need forceDelete method

Model::where('condition')->where('may be other condition')->forceDelete();

or on particular model instance:

$modelInstance = Model::find($id);
$modelInstance->forceDelete();

相关问答

更多

如何确定模型是否在Laravel 4.2中使用软删除(How to determine if a model uses soft deletes in Laravel 4.2)

如果您想以编程方式检查模型是否使用软删除,可以使用PHP函数class_uses来确定您的模型是否使用SoftDeletingTrait // You can use a string of the class name $traits = class_uses('Model'); // Or you can pass an instance $traits = class_uses($instanceOfModel); if (in_array('SoftDeletingTrait', $tr...

在laravel中使用自定义软删除列(Use custom soft deleted column in laravel)

SoftDeletes trait使用此代码“删除”一行: protected function runSoftDelete() { $query = $this->newQueryWithoutScopes()->where($this->getKeyName(), $this->getKey()); $this->{$this->getDeletedAtColumn()} = $time = $this->freshTimestamp(); $q...

禁止软删除的用户在laravel 4中使用Auth登录(Disallow Soft deleted User to log in using Auth in laravel 4)

您可以使用Laravel文档中提供的代码,您可以使用deleted_at => null替换active => 1 http://laravel.com/docs/4.2/security#authenticating-users if (Auth::attempt(array('email' => $email, 'password' => $password, 'active' => 1))) { // The user is active, not suspended, and ex...

Laravel 5.2软删除不起作用(Laravel 5.2 soft delete does not work)

您需要在模型中使用SoftDeletes特质,如下所示: <?php namespace App; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; class Post extends Model { use SoftDeletes; protected $table = 'post'; protected $dates = ['deleted_a...

定义模型的构造函数时,Laravel 5.3软删除不起作用(Laravel 5.3 soft deletes not working when defining a constructor for the model)

我认为问题可能是您覆盖了Illuminate\Database\Eloquent\Model设置的构造函数。 你有没有尝试过 public function __construct(array $attributes = []) { parent::__construct($attributes); if (!\App::environment('production')) { $this->table='test_stage'; ...

Laravel 4:表上的软删除是否也适用于它的关系(Laravel 4: Will a soft delete on a table also apply to it relationships)

它没有。 你也必须在关系上应用softDeletes(参见doc ) 它不能使用ON DELETE CASCADE传播,因为软删除是Laravel的属性,而不是MySQL或其他东西。 但是当您加载模型时,Laravel将不会加载软删除的模型及其关系。 所以一个独特的软删除就足够了。 It doesn't. You have to apply softDeletes on relations too (see the doc) It can't be propagated with a ON DEL...

覆盖模型的软删除表列(Overwriting soft delete table column for a model)

查看Illuminate\Database\Eloquent\SoftDeletes特征并覆盖runSoftDelete()和getDeletedAtColumn方法。 在runSoftDelete()使用boolean而不是timestamp,而在getDeletedAtColumn()使用DELETED而不是DELETED_AT 另一种解决方案是添加全局范围或本地范围以使用软删除数据。 Look into the Illuminate\Database\Eloquent\SoftDeletes...

如何在postgres上强制执行软删除?(How to enforce soft deletes on postgres?)

以下作品: CREATE OR REPLACE FUNCTION enforce_soft_delete() RETURNS VOID AS $$ BEGIN RAISE EXCEPTION 'only soft deletes allowed'; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE RULE prevent_account_deletion AS ON DELETE TO account DO INSTEAD SELECT e...

laravel 5:软删除(laravel 5: soft delete)

你是怎么添加这个专栏的? 如果在迁移中使用Laravels Schema ,则会有一个默认为null的softDeletes()列(当然,您也可以直接在数据库中执行此操作)。 How did you add the column? If you use Laravels Schema within a migrations there is a softDeletes() column which defaults to null (you could also do this in your d...

如何覆盖laravel中的软删除(How do I override soft deletes within laravel)

你需要forceDelete方法 Model::where('condition')->where('may be other condition')->forceDelete(); 或特定的模型实例: $modelInstance = Model::find($id); $modelInstance->forceDelete(); You need forceDelete method Model::where('condition')->where('may be other condit...

相关文章

更多

redis主从从架构搭建-redis集群管理

主从从架构 [root@master redis-master-slave]# vim 6382/re ...

redis sentinel(哨兵) 配置详解-redis集群管理

1. redis sentinel(哨兵) redis sentinel(哨兵)是对Redis系统的 ...

redis 集群环境搭建-redis集群管理

集群架构 (1)所有的redis节点彼此互联(PING-PONG机制),内部使用二进制协议优化传输速度 ...

Redis Cookbook

Two years since its initial release, Redis already ...

Redis概述

什么是Redis Redis是Remote Dictionary Server的缩写, Redis是一 ...

redis主从复制(读写分离)-redis集群管理

主从复制的好处: 1、 避免redis单点故障 2、 构建读写分离架构,满足读多写少的应用场景 主 ...

redis安装-redis集群管理

安装redis [root@master opt]# mkdir /opt/redis [root ...

基于linux下redis安装与配置

编译源程序:make install,复制可执行文件,Redis的启动,Redis随机启动

基于window安装redis

1、下载redis的window版本 下载地址: https://github.com/Service ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本