void *test(void *ptr) {
auto& session = *(nebula::Session*)ptr;
auto t0 = get_current_ms();
auto result = session.execute("GO FROM \"1\" OVER follow reversely where $$.user.last_active_ts > 1612180980");
if (result.errorCode() != nebula::ErrorCode::SUCCEEDED) {
std::cout << "Exit with error code: " << static_cast<int>(result.errorCode()) << std::endl;
return nullptr;;
}
auto t1 = get_current_ms();
//std::cout << *result.data();
std::cout << "time cost " << t1-t0 << "\n";
return nullptr;
}
for(int i = 0; i < n; ++i){
pthread_create(&tid,NULL,test, & session);
}
通过上面的代码模拟并发查询,发现越到后面,查询耗时越大。
一个session的多次查询是串行排队的吗?
高并发查询应该如何实现?