Cloudant

时间:2018-03-09 03:44:05

标签: python-3.x performance couchdb cloudant

我需要一些时间来看看我们是否可以提高cloudant数据库的并发写入次数/秒。 IBM建议将Cloudant中的并发性从默认值提高到50或100,看看它是否对性能有所帮助。以下是IBM文档的链接,该文档讨论了这些settings

所以我在python中编写了一个脚本,它在Cloudant中创建了一个文档,并针对不同数量的线程针对我们的两个开发Cloudant集群运行它。结果如下:

DEV

Number of records : 10000
Number of client threads : 4
Total Time : 3.47 mins
Number of writes/sec : ~ 49 records/sec
Concurrency : Default

Number of records : 10000
Number of client threads : 20
Total Time : 3.53
Number of writes/sec : ~ 47 records/sec
Concurrency : Default

Number of records : 10000
Number of client threads : 20
Total Time : 3.38
Number of writes/sec : ~ 49 records/sec
Concurrency : 50

Number of records : 10000
Number of client threads : 20
Total Time : 3.38
Number of writes/sec : ~ 49 records/sec
Concurrency : 100

DEV2

Number of records : 10000
Number of client threads : 4
Total Time : 2.82 mins
Number of writes/sec : ~ 59 records/sec
Concurrency : 50

Number of records : 10000
Number of client threads : 4
Total Time : 3.32 mins
Number of writes/sec : ~ 50 records/sec
Concurrency : 50
IOQ Bypass : interactive

Number of records : 10000
Number of client threads : 4
Total Time : 2.82 mins
Number of writes/sec : ~ 59 records/sec
Concurrency : 50
IOQ Bypass : None

Number of records : 10000
Number of client threads : 4
Total Time : 2.88 mins
Number of writes/sec : ~ 58 records/sec
Concurrency : 50
IOQ Bypass : db_update

Number of records : 10000
Number of client threads : 20
Total Time : 2.89 mins
Number of writes/sec : ~ 58 records/sec
Concurrency : 50
IOQ Bypass : db_update

可以看出,无论客户端线程数,并发数或IOQ旁路数如何,两个集群似乎都有每秒可写入的记录数量的阈值限制。对于Dev1,它似乎永远不会超过50次写入/秒,对于Dev2来说,它的59次写入/秒。现在这些集群甚至没有被使用那么多,因此我只希望看到这个数字进一步下降,如果我们在繁忙的集群中运行它。(如stg,prod)

所以问题是,为了获得更好的性能,我们可以考虑其他任何设置吗?

谢谢 - 阿克沙伊

1 个答案:

答案 0 :(得分:1)

我不知道IOQ调整,但我想说实现更高文档写入吞吐量的最简单方法是使用bulk APIPOST /db/_bulk_docs端点应允许您在单个API调用中一次上传数十,数百或数千个文档。这将比单独的零碎写作更有效率。

然后,您可以提高一次运行的批量写入请求的并发性,以提高吞吐量。