shell909090 / influx-proxy

Other
486 stars 272 forks source link

使用vegeta进行压测,5000次每秒,持续1分钟,最后数据库里面只有120条,这是为什么,新手 #37

Closed frontdog closed 6 years ago

frontdog commented 6 years ago

是因为配置interval为1000的原因吗,一秒只能写入1次,我这里一次两条,所以是120?

frontdog commented 6 years ago

测试报告是100%的成功率

pingliu commented 6 years ago

时间相同?覆盖数据?

pingliu commented 6 years ago

请使用influxdb自带的influx stress压测

shell909090 commented 6 years ago

influxdb的写入特征是,先把数据收下来,然后返回写入成功。随后再向后写入。如果不成功就予以丢弃。这潜藏了可能因为种种因素导致部分数据无法写入成功的可能,但我们认为监控数据可以接受这样的小概率事件。 但是这么大比例的数据消失是不正常的。即便是时间相同也不能解释(因为时间相同一般是1rec/s,应当是60r,而不是120)。 请观察一下influx-proxy向后发起的write请求,看看数据是不是真实被写出了。如果写出了,那么可能是数据库的问题(例如时间相同)。如果没写出,那么需要调试一下问题环节。 能公开测试配置和方法么?

frontdog commented 6 years ago

不好意思,之前忙业务忘记来回复了,我详细描述下我本地的压测:

首先,在config.py中的部分配置如下:

BACKENDS = {
    'local': {
        'url': 'http://localhost:8086',
        'db': 'stress',
        'user': 'root',
        'password': 'root',
        'zone':'local',
        'interval': 1000,
        'timeout': 10000,
        'timeoutquery':600000,
        'maxrowlimit':30000,
        'checkinterval':1000,
        'rewriteinterval':1000,
    },
}

KEYMAPS = {
    'heap': ['local'],
}

NODES = {
    'l1': {
        'listenaddr': ':6666',
        'db': 'stress',
        'zone': 'local',
        'interval':10,
        'idletimeout':10,
        'writetracing':0,
        'querytracing':0,
    }
}

# the influxdb default cluster node
DEFAULT_NODE = {
    'listenaddr': ':6666'
}

启动influx-proxy后,使用vegeta进行压测(这个只是发送http请求,感觉和测试工具无关) vegeta的脚本如下:

POST http://127.0.0.1:6666/write?db=stress&u=root&p=root
@post1.txt
POST http://127.0.0.1:6666/write?db=stress&u=root&p=root
@post2.txt

post1.txt

heap,host=server01,region=uswest value=1

post2.txt

heap,host=server02,region=uswest value=2

然后以每秒执行一次脚本的频率执行5秒 这样: 每执行一次脚本,理论应该产生两个数据(post1和post2),所以总共应该是10条数据 但实际结果是:

> select * from heap
name: heap
time                host     region value
----                ----     ------ -----
1534153887362162330 server01 uswest 1
1534153887362162330 server02 uswest 2
1534153889361883536 server01 uswest 1
1534153889361883536 server02 uswest 2
1534153891364973552 server01 uswest 1

只写入了5条,正如我标题写的,表现就是每秒只能写入一条数据

frontdog commented 6 years ago

是不是我的理解和使用有误,从数据时间上看,时间都是间隔1秒左右,中间的数据被吞了

frontdog commented 6 years ago

interval参数变小数据就变多,和这个有关?意思是interval限定了接受的间隔?

frontdog commented 6 years ago

应该还是和压测工具有关,时间相同,tag相同,所以数据覆盖了

shell909090 commented 6 years ago

@frontdog 刘老师说的是对的。由于你的时间相同,所以引起了覆盖。