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

feature: 轻量化部署优化 #2643 #2663

Merged
merged 3 commits into from
Feb 2, 2024

Conversation

wangyu096
Copy link
Collaborator

@wangyu096 wangyu096 commented Dec 11, 2023

  1. 解决 AOP execution PointCut 扫描 Jooq DefaultDslContext导致的微服务启动时间长的问题(可减少 30s)
    jOOQ,spring-boot and aop. jOOQ/jOOQ#5902

AOP 编写参考:
https://docs.spring.io/spring-framework/docs/5.3.9/reference/html/core.html#writing-good-pointcuts
image

  1. 自定义 JobTransaction 注解。该注解transactionManager 参数为必选。避免使用 spring @transaction,如果没有配置默transactionManager,导致在轻量化部署场景下,多个transactionManager无法确定选择哪一个,导致微服务失败的问题。

@wangyu096 wangyu096 requested a review from jsonwan December 11, 2023 02:47
@@ -24,15 +24,18 @@ public IamAppTransferAspect(AppScopeMappingService appScopeMappingService) {
this.appScopeMappingService = appScopeMappingService;
}

@Pointcut("execution (* com.tencent.bk.job.common.iam.service.impl.BusinessAuthServiceImpl.auth*(..))")
@Pointcut("within(com.tencent.bk.job..*) " +
"&& execution (* com.tencent.bk.job.common.iam.service.impl.BusinessAuthServiceImpl.auth*(..))")
public void processAuthBusinessAction() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

搜索范围可以进一步细化到com.tencent.bk.job.common.iam.service.impl.BusinessAuthServiceImpl

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

搜索范围可以进一步细化到com.tencent.bk.job.common.iam.service.impl.BusinessAuthServiceImpl

fix

@@ -17,11 +17,13 @@
@Aspect
public class IamExceptionHandleAspect {

@Pointcut("execution (* com.tencent.bk.sdk.iam.service.impl.PolicyServiceImpl.*(..))")
@Pointcut("within(com.tencent.bk.job..*) " +
"&& execution (* com.tencent.bk.sdk.iam.service.impl.PolicyServiceImpl.*(..))")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

搜索范围可以进一步细化到com.tencent.bk.sdk.iam.service.impl.PolicyServiceImpl

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

public void processPolicyServiceAction() {
}

@Pointcut("execution (* com.tencent.bk.sdk.iam.helper.AuthHelper.isAllowed(..))")
@Pointcut("within(com.tencent.bk.job..*) " +
"&& execution (* com.tencent.bk.sdk.iam.helper.AuthHelper.isAllowed(..))")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

搜索范围可以进一步细化到com.tencent.bk.sdk.iam.helper.AuthHelper

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

Copy link
Collaborator

@jsonwan jsonwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

搜索范围可以看看能否继续优化

@wangyu096 wangyu096 merged commit e1e13c1 into TencentBlueKing:master Feb 2, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants