linyimin0812 / spring-startup-analyzer

spring-startup-analyzer generates an interactive spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it.🚀
Apache License 2.0
1.55k stars 121 forks source link

Async Bean not initialized as expected. #51

Open MingningShao opened 1 year ago

MingningShao commented 1 year ago

Async bean init

Platform: Windows 10

According to the usage, no log like "async-init-bean, beanName: ${beanName}, async init method: ${initMethodName}" found.

# name of bean to async init
spring-startup-analyzer.boost.spring.async.bean-names=subLabelService,cdcEsService,distributeIdService
# init bean thread pool core size
spring-startup-analyzer.boost.spring.async.init-bean-thread-pool-core-size=4
# init bean thread pool max size
spring-startup-analyzer.boost.spring.async.init-bean-thread-pool-max-size=8

Well, if async enable with multi threads, and those beans have no dependency, should they init at same time ?

linyimin0812 commented 1 year ago

Have you imported the dependency, and configured the option spring-startup-analyzer.boost.spring.async.bean-priority-load-enable=true

<dependency>
    <groupId>io.github.linyimin0812</groupId>
    <artifactId>spring-async-bean-starter</artifactId>
    <version>2.0.7</version>
</dependency>
MingningShao commented 1 year ago

Yeah, dependency added with the configurations. Also test spring-startup-analyzer.boost.spring.async.bean-priority-load-enable=false works more worse.

MingningShao commented 1 year ago

Have you imported the dependency, and configured the option spring-startup-analyzer.boost.spring.async.bean-priority-load-enable=true

<dependency>
    <groupId>io.github.linyimin0812</groupId>
    <artifactId>spring-async-bean-starter</artifactId>
    <version>2.0.7</version>
</dependency>

Do you have chat group, like Slack, QQ or WeChat? It will be much more convenient and fast。

linyimin0812 commented 1 year ago

Yeah, dependency added with the configurations. Also test spring-startup-analyzer.boost.spring.async.bean-priority-load-enable=false works more worse.

Only support bean with @Bean and @PostConstruct, make sure your time-consuming logic is in these methods

image

linyimin0812 commented 1 year ago

Have you imported the dependency, and configured the option spring-startup-analyzer.boost.spring.async.bean-priority-load-enable=true

<dependency>
    <groupId>io.github.linyimin0812</groupId>
    <artifactId>spring-async-bean-starter</artifactId>
    <version>2.0.7</version>
</dependency>

Do you have chat group, like Slack, QQ or WeChat? It will be much more convenient and fast。

I create a slack channel: https://springstartup-bjh3264.slack.com/join/shared_invite/zt-20o76nhf5-82LV6rfk8N118G6rBghKgQ

MingningShao commented 1 year ago

Have you imported the dependency, and configured the option spring-startup-analyzer.boost.spring.async.bean-priority-load-enable=true

<dependency>
    <groupId>io.github.linyimin0812</groupId>
    <artifactId>spring-async-bean-starter</artifactId>
    <version>2.0.7</version>
</dependency>

Do you have chat group, like Slack, QQ or WeChat? It will be much more convenient and fast。

I create a slack channel: https://springstartup-bjh3264.slack.com/join/shared_invite/zt-20o76nhf5-82LV6rfk8N118G6rBghKgQ

Great, we will discuss this issue on slack.