默认情况下使用uuid时的Cassandra TimeUUID泛洪文件描述符 [英] Cassandra TimeUUID flood file descriptor when use uuid in default

查看:150
本文介绍了默认情况下使用uuid时的Cassandra TimeUUID泛洪文件描述符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Cassandra模型作为

I have Cassandra model as

import uuid
from cassandra.cqlengine import columns
from cassandra.cqlengine.models import Model

class MyModel(Model):
    ...
    ...
    created_at = columns.TimeUUID(primary_key=True,
                         clustering_order='DESC',
                         default=uuid.uuid1)
    ...
    ...

最近,应用程序点击 uuid1创建不会关闭文件-达到文件描述符限制.我尝试找到解决方案,但似乎我认为哪些选项可能行不通

Recentrly app hit the uuid1 creation doesn't close files - hits file descriptor limit. I try to find the solution, but seems what options I think might be not work

  • 默认情况下将uuid1替换为uuid4,但是TimeUUID需要时间部分,只有uuid1可以提供.
  • 带有cassandra.util.uuid_from_time(time.time())的种族uuid1,当检查两个 uuid1
  • Replace uuid1 in default with uuid4, but TimeUUID need time part in it, and only uuid1 provide that.
  • Relace uuid1 with cassandra.util.uuid_from_time(time.time()), when check the code for both uuid1 and uuid_from_time, both are looks same, so that also not solve the problem.

最后的选择是将TimeUUID替换为Timestamp类型,但是此created_at列是primary_keyclustering_order,所以不知道我能否做到这一点.

Last option is to replace TimeUUID with Timestamp type, but this created_at column is primary_key and clustering_order, so dont know I can do that or not.

我的列族已经有1,000,000+数据,所以我不能只删除它们.

My column family has already 1,000,000+ data, so I cant just drop them.

我还想知道,使用TimeUUID代替timestamp有什么好处?

I also want to know, what is the advantage of using TimeUUID instead of timestamp ?

推荐答案

您确定要解决链接的libuuid问题吗?您的代码段显示了标准库uuid,它可能没有这个问题.程序中是否可能存在其他文件描述符泄漏?

Are you certain you're hitting the libuuid issue you linked? Your code snippet shows the standard library uuid, which probably doesn't have that issue. Is it possible there's a different file descriptor leak in your program?

如果是libuuid,最简单的方法是使用标准库实现.如果您最关心速度,则可以考虑构建供python-libuuid使用的其他版本的libuuid.我迅速尝试了一下,没有发现任何文件描述符泄漏: http://www. ossp.org/pkg/lib/uuid/

If it is libuuid, the easiest course would be to use the standard library implementation. If speed is a major concern for you, you might look into building a different version of libuuid to use with python-libuuid. I tried this one quickly and didn't notice any file descriptors leaking: http://www.ossp.org/pkg/lib/uuid/

我还想知道,使用TimeUUID代替时间戳有什么好处?

I also want to know, what is the advantage of using TimeUUID instead of timestamp ?

您将无法更改现有表上列的类型,但要回答您的问题:TimeUUID通常用于避免可能在同一时间戳记值中写入多个事件的冲突.

You won't be able to change the type of the column on your existing table, but to answer your question: TimeUUID is usually used to avoid collisions where multiple events could be written in the same timestamp value.

这篇关于默认情况下使用uuid时的Cassandra TimeUUID泛洪文件描述符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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