Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot 卡夫卡同步生成器在第一次请求时需要更长的时间_Spring Boot_Apache Kafka_Spring Cloud Stream_Spring Kafka - Fatal编程技术网

Spring boot 卡夫卡同步生成器在第一次请求时需要更长的时间

Spring boot 卡夫卡同步生成器在第一次请求时需要更长的时间,spring-boot,apache-kafka,spring-cloud-stream,spring-kafka,Spring Boot,Apache Kafka,Spring Cloud Stream,Spring Kafka,我正在SpringBoot微服务中使用SpringCloudStreamKafka同步生成器。每次我们部署服务时,对kafka的第一次调用都会花费超过20秒的时间将消息发布到Topic。但随后的所有通话几乎不需要3到4毫秒。此问题也会随机发生,并且是间歇性的,但大多数情况下会在重新启动服务时发生。 我们正在使用卡夫卡版本0.9.0.1和gradle依赖项,如下所示 依赖关系{ compile('org.springframework.cloud:spring-cloud-starter-stre

我正在SpringBoot微服务中使用SpringCloudStreamKafka同步生成器。每次我们部署服务时,对kafka的第一次调用都会花费超过20秒的时间将消息发布到Topic。但随后的所有通话几乎不需要3到4毫秒。此问题也会随机发生,并且是间歇性的,但大多数情况下会在重新启动服务时发生。 我们正在使用卡夫卡版本0.9.0.1和gradle依赖项,如下所示 依赖关系{

compile('org.springframework.cloud:spring-cloud-starter-stream-kafka')
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.SR3"
}
}
这是应用程序。yml


我使用org.springframework.cloud.stream.messaging.Source作为输出通道,这是用于发布消息的方法

public void publish(Message event) {
    try {
        boolean result = source.output().send(event, orderEventConfig.getTimeoutMs());
        logger.log(LoggingEventType.INFORMATION, "MESSAGE SENT TO KAFKA : " + result);
    } catch (Exception publishingExceptionMessage) {
        logger.log(LoggingEventType.ERROR, "publish event to kafka failed!", publishingExceptionMessage);
        throw new PublishEventException("publish event to kafka failed for eventPayload: " + event.getPayload(),
                ThreadVariables.getTenantId());
    }
}

我知道sync producer在性能方面比较慢,因为它保证了消息的顺序和持久性,但为什么只有第一个请求需要这么长时间?这个问题是已知的问题吗?它在最新的卡夫卡版本中已经修复了吗?有人可以建议一下吗。谢谢。

看起来spring cloud stream down的版本有问题使用下面的依赖项加载

imports { 
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.SR3"
     }
尝试升级spring云流并检查。它应该修复springboot服务启动后kafka服务器上第一次发布调用的延迟

dependencies {  
    compile('org.springframework.cloud:spring-cloud-stream-binder-kafka')
}


     ext { springCloudVersion = 'Dalston.RELEASE' }

   dependencyManagement {   
        imports { 
                        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 
                }
            }

使用以下依赖项下载的spring cloud stream版本似乎存在问题

imports { 
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.SR3"
     }
尝试升级spring云流并检查。它应该修复springboot服务启动后kafka服务器上第一次发布调用的延迟

dependencies {  
    compile('org.springframework.cloud:spring-cloud-stream-binder-kafka')
}


     ext { springCloudVersion = 'Dalston.RELEASE' }

   dependencyManagement {   
        imports { 
                        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 
                }
            }

20秒是否不包括实际应用程序启动时间?是,它不包括服务启动时间?20秒是否不包括实际应用程序启动时间?是,它不包括服务启动时间