如何测试MongoDB聚合性能?
How to test MongoDB aggregation performance?
我在MongoDB有聚合操作,想测试1000以上的并发执行性能
MongoDB已提供benchRun,但未找到聚合语法。
我的代码如下,代码无关紧要:
db.category.aggregate([
{ $match: {city:'010'} },
{
$project: {
"geometric_mean": {
$pow: [ $val, 2]
}
}
},
{ $sort: {'geometric_mean': -1} }
],{ "allowDiskUse": true } );
如何使用 benchRun 进行聚合,或者有什么工具可以做到这一点?
我的期望是你不应该直接测试数据库,表现良好 load test must mimic real System Under Test usage as close as possible so instead of hammering MongoDB with one query using 1000+ threads (which is not the best approach as well due to results caching) 你应该模拟 1000 多个用户使用你的应用程序。我相信除了特定的查询性能之外,您还会发现更多需要担心的事情。
如果您仍在寻找使用任意代码对 MongoDB 数据库进行负载测试的方法 - 如果需要,您可以查看 Apache JMeter, it provides relatively easy ways of configuring a MongoDB connection and executing queries. Check out How to Load Test MongoDB with JMeter 文章以获得全面的说明。
我在MongoDB有聚合操作,想测试1000以上的并发执行性能
MongoDB已提供benchRun,但未找到聚合语法。 我的代码如下,代码无关紧要:
db.category.aggregate([
{ $match: {city:'010'} },
{
$project: {
"geometric_mean": {
$pow: [ $val, 2]
}
}
},
{ $sort: {'geometric_mean': -1} }
],{ "allowDiskUse": true } );
如何使用 benchRun 进行聚合,或者有什么工具可以做到这一点?
我的期望是你不应该直接测试数据库,表现良好 load test must mimic real System Under Test usage as close as possible so instead of hammering MongoDB with one query using 1000+ threads (which is not the best approach as well due to results caching) 你应该模拟 1000 多个用户使用你的应用程序。我相信除了特定的查询性能之外,您还会发现更多需要担心的事情。
如果您仍在寻找使用任意代码对 MongoDB 数据库进行负载测试的方法 - 如果需要,您可以查看 Apache JMeter, it provides relatively easy ways of configuring a MongoDB connection and executing queries. Check out How to Load Test MongoDB with JMeter 文章以获得全面的说明。