[CP] limit the maxmum of net_thread_count
This commit is contained in:
4
deps/oblib/src/rpc/pnio/interface/group.c
vendored
4
deps/oblib/src/rpc/pnio/interface/group.c
vendored
@ -247,6 +247,10 @@ PN_API int pn_provision(int listen_id, int gid, int thread_count)
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
pn_grp_t* pn_grp = ensure_grp(gid);
|
pn_grp_t* pn_grp = ensure_grp(gid);
|
||||||
ef(pn_grp == NULL);
|
ef(pn_grp == NULL);
|
||||||
|
if (thread_count > MAX_PN_PER_GRP) {
|
||||||
|
err = -EINVAL;
|
||||||
|
rk_error("thread count is too large, thread_count=%d, MAX_PN_PER_GRP=%d", thread_count, MAX_PN_PER_GRP);
|
||||||
|
}
|
||||||
count = pn_grp->count;
|
count = pn_grp->count;
|
||||||
while(0 == err && count < thread_count) {
|
while(0 == err && count < thread_count) {
|
||||||
pn_t* pn = pn_create(listen_id, gid, count);
|
pn_t* pn = pn_create(listen_id, gid, count);
|
||||||
|
|||||||
@ -132,6 +132,7 @@ static int get_default_net_thread_count()
|
|||||||
cnt = 7;
|
cnt = 7;
|
||||||
} else {
|
} else {
|
||||||
cnt = max(8, cpu_num / 6);
|
cnt = max(8, cpu_num / 6);
|
||||||
|
cnt = min(cnt, 64);
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user