spring - springboot 应用程序需要很长时间来处理 GET 请求。DispatcherServlet.ProcessHandlerException() 花费的时间
问题描述
我有一个身份验证服务和一些控制器方法来获取基于 id、用户名等的用户详细信息。所有这些 HTTP.GET 方法都需要很长时间来处理,并且 New relic 监控显示 DispatcherServlet.ProcessHandlerException() 占了大约 70%时间。我正在使用 Spring 的 4.2.1.RELEASE 版本。任何帮助,将不胜感激。
@ApiOperation(value = "Get User Details From Id",
notes = "Get the UserDetails object that describes the user", tags = {"/user"})
@ApiImplicitParams({@ApiImplicitParam(dataType = "String", name = "Authorization", paramType = "header")})
@GetMapping(value = "/users/realm/{realm}/user/{userName}", produces = Versions.V1_0)
@Log(level = Log.Level.TRACE)
public UserDetails getUserDetailsFromUserId(
@ApiParam(value = "The user's details", required = true) @PathVariable(name = "realm") String realm,
@ApiParam(value = "Include profiles in user's details") @RequestParam(name = "includeProfiles", required = false) Boolean includeProfiles,
@PathVariable(name = "userName") String userName) {
LOGGER.traceEntry(userName, realm, includeProfiles);
com.nextiva.authentication.model.UserDetails result = userManagementService.getUserDetails(userName, realm, includeProfiles);
if (includeProfiles != null && includeProfiles) {
result.setProfiles(result.getProfiles().stream().filter(p -> NumberUtils.isDigits(p.getCorpAcctNbr()) || StringUtils.isBlank(p.getCorpAcctNbr())).collect(Collectors.toList()));
}
LOGGER.traceExit();
return userDetailsConverter.convertFromModelToV1(result);
}
示例控制器代码已附加。
解决方案
推荐阅读
- arrays - 使用 Laravel 从数据库中返回嵌套的 Json 作为数组
- javascript - TypeError: undefined is not a function ('...data.map...' 附近)
- networking - route print 命令显示几乎所有 On-link 网关
- javascript - 如何将用户分配到组并使用 Firestore 引用字段类型对其进行排序
- r - 使用 purrr 和 modelr 从剂量反应模型 (drm) 进行预测
- oracle - 为什么 Oracle Apex 在从 4 迁移到 19 后停止使用 Google 验证码?
- python - 带有特殊字符和文本的正则表达式
- javascript - 宜家带引导程序的画布菜单
- vb.net - 使用 ASP.NET Core MVC 将多行插入数据库
- flutter - 如何使用轮播导航到其他屏幕