Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

分页写法不对,导致服务响应慢 #77

Open
yangyaqiao opened this issue Oct 30, 2020 · 2 comments
Open

分页写法不对,导致服务响应慢 #77

yangyaqiao opened this issue Oct 30, 2020 · 2 comments

Comments

@yangyaqiao
Copy link

1、结果转换写在分页之后
// 设置分页信息
run pageQuery.setPageInfo({
"pageSize" : ${pageSize},
"currentPage" : ${currentPage}
});

var result =pageQuery.data() =>[
{
"zl":ZL,
"qlr":QLR,
"xzId":XZ_ID
}
];

return {
"total": pageQuery.pageInfo(),
"result": result
}

2、结果转换写在分页之前
var result =pageQuery.data() =>[
{
"zl":ZL,
"qlr":QLR,
"xzId":XZ_ID
}
];

// 设置分页信息
run pageQuery.setPageInfo({
"pageSize" : ${pageSize},
"currentPage" : ${currentPage}
});

return {
"total": pageQuery.pageInfo(),
"result": result
}

使用第二种写法,当查询的数据库数据量大时,会导致服务器CPU使用过高
我查询的库数据量在 90W , 执行,页面一直 loading
cpu 持续 300%
服务打印错误日志:
net.hasor.dataql.runtime.InstructRuntimeException: [line 14:22~14:28 ,QIL 0:28] GC overhead limit exceeded
at net.hasor.dataql.runtime.mem.RefCall.lambda$invokeMethod$0(RefCall.java:63) ~[hasor-dataql-4.2.0.jar!/:na]
at net.hasor.utils.ExceptionUtils.toRuntimeException(ExceptionUtils.java:40) ~[hasor-commons-4.2.0.jar!/:na]
at net.hasor.dataql.runtime.mem.RefCall.invokeMethod(RefCall.java:62) ~[hasor-dataql-4.2.0.jar!/:na]
at net.hasor.dataql.runtime.inset.CALL.doWork(CALL.java:57) ~[hasor-dataql-4.2.0.jar!/:na]
at net.hasor.dataql.runtime.inset.OpcodesPool.doWork(OpcodesPool.java:45) ~[hasor-dataql-4.2.0.jar!/:na]
at net.hasor.dataql.runtime.QueryImpl.execute(QueryImpl.java:83) ~[hasor-dataql-4.2.0.jar!/:na]
at net.hasor.dataql.runtime.QueryImpl.execute(QueryImpl.java:37) ~[hasor-dataql-4.2.0.jar!/:na]
at net.hasor.dataql.Query.execute(Query.java:50) ~[hasor-dataql-4.2.0.jar!/:na]
at net.hasor.dataway.service.ApiCallService._doCall(ApiCallService.java:143) [hasor-dataway-4.2.0.jar!/:na]
at net.hasor.dataway.service.ApiCallService.doCallWithoutError(ApiCallService.java:54) [hasor-dataway-4.2.0.jar!/:na]
at net.hasor.dataway.web.PerformController.doPerform(PerformController.java:78) [hasor-dataway-4.2.0.jar!/:na]
at net.hasor.dataway.web.PerformController$Auto$6.aop$doPerform(Unknown Source) [na:na]
。。。。。。。

@zycgit
Copy link
Collaborator

zycgit commented Nov 10, 2020

呃, 肯定是要写在分页之前的。

这个 issue 很有讨论意义。我在想要不要设置一个 参数让 查询返回的数据具有一个上限。 而不是 全捞出来。
比如 这个case 如果使用了第一种错误的用法,查询至多返回 1万条数据。 至少能避免 oom 之类的问题。

@yangyaqiao
Copy link
Author

少量的数据不会影响,数据量大了就不行了,至于这个具体数量估计的多测试几次

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants