如何避免Arangodb集合锁 [英] How to avoid arangodb collection locks

查看:436
本文介绍了如何避免Arangodb集合锁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我启用了跟踪,并且看到以下消息在一秒钟内被打印出了大约1万次.

I have trace enabled and I see following message being printed out like 10k times with in a second.

2016-03-12T18:14:56Z [31136]跟踪[C:\ b \ ArangoDB-2.8.4 \ arangod \ Wal \ CollectorThread.cpp:750] wal收集器无法获取集合'39659811的写锁'

2016-03-12T18:14:56Z [31136] TRACE [C:\b\ArangoDB-2.8.4\arangod\Wal\CollectorThread.cpp:750] wal collector couldn't acquire write lock for collection '39659811'

以下是该系列的照片.

类型计数大小信息 数据文件57 1.79 GB 期刊1 32 MB
压实机0 0 B 形状文件0 0 B 索引3 890.2 MB
类型计数信息 形状239 属性77
未收集221145
参考文献1
类型计数大小删除信息 活着4398864 930.54 MB-
无效的4487771 918.31 MB 0

Type Count Size Info Datafiles 57 1.79 GB Journals 1 32 MB
Compactors 0 0 B Shape files 0 0 B Indexes 3 890.2 MB
Type Count Info Shapes 239 Attributes 77
Uncollected 221145
References 1
Type Count Size Deletion Info Alive 4398864 930.54 MB -
Dead 4484771 918.31 MB 0

推荐答案

ArangoDB有两种用于收集的数据文件:

ArangoDB has two kinds of datafiles for collections:

  • WAL文件(提前写入日志);如果创建了新的(-版本)文档,则可以直接使用它们来确保尽快将数据持久地写入磁盘.该文件线性增长.
  • 收集文件;每个集合一个;这里有(较旧的)永久数据.

因此,如果您插入或更新文档,它们将立即以滚动的WAL文件结尾.这很好,因为旋转磁盘不喜欢搜索.因此,将突发数据线性写入一个WAL文件,无论它们处于哪个集合中.磁盘都可以通过在物理上狭窄的区域中对写入操作进行分组来有效地执行其写入突发数据,并且无需在文件之间跳转(物理位置在磁盘上)磁盘).

So if you insert or update documents, they instantly end up in the rolling WAL-files. This is good since spinning disks don't like seeks; so the bursts are written linear into one WAL-file, regardless of which collection they're in. Disks can effectively do their write bursts by grouping write operations in physically narrow areas, and don't need to jump between files (physical places on disk).

文档由引用它们的索引管理,无论它们是在数据文件中还是在WAL文件中.在ArangoDB重新启动后,它也可以完美地工作.

Documents are managed by indices that reference them, be they in the data file or the WAL-files. It will also work flawlessly across ArangoDB restarts.

现在您要询问的WAL-Collector线程.该线程在这里用于将文档从wal文件转换为它们各自的收集文件.由于您的查询可能正在其他线程中处理这些文档,因此它不能在无法确保它们空闲时移动它们.因此,它需要尝试获取打算为其迁移文档的收集锁.这可能并不总是可行的,并且由于在开发ArangoDB期间可能会很有趣,因此它为此编写了一个跟踪日志条目.但是,迟早应该找到这样做的时间,并且一旦迁移了WAL文件的所有文档,就可以删除该文件.

Now to the WAL-Collector thread you're asking about. This thread is here to do the transitions of documents from the wal files into their respective collection files. Since your queries may be working with these documents in other threads, it mustn't move them while it can't make shure they're idle. Therefore it needs to try to get the collection lock for which it intends to migrate the documents for. This may not always work out, and as this may be interesting during the development of ArangoDB it then writes a trace log entry for that. However, sooner or later it should find the time to do so, and once all documents of a WAL-file are migrated, the file can be dropped.

由于这是ArangoDB的常规业务- TL; DR: 除非停止使用跟踪日志级别,并且您不必担心它,只要早晚清除WAL文件,就不必担心.

Since this is regular business of ArangoDB - TL;DR: You can't avoid these messages unless you stop using the trace loglevel and you don't need to wory about it as long as the WAL-files are cleaned up sooner or later.

这篇关于如何避免Arangodb集合锁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆