如何对spring@scheduled task进行性能和负载测试

3wabscal  于 2021-07-15  发布在  Java
关注(0)|答案(1)|浏览(383)

如果可能的话,我想使用apachejmeter为spring@scheduled任务运行性能和负载测试。
它支持这一点吗?
我怎样才能做到呢?
我使用的是Spring5(非引导)和JMeter5.4.1
谢谢您
编辑1:我的计划任务配置如下

package com.mypackage.impl;

import com.mypackage.service.NotificationBatchService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class NotificationBatchServiceImpl implements NotificationBatchService {

    @Override
    @Scheduled(cron = "0 0 */2 * * *")
    public void synchronizeNotificationUploadDocument() {
        // database transactions
        // HTTP requests
    }
}
plicqrtu

plicqrtu1#

应该提取方法内部的代码 synchronizeNotificationUploadDocument 然后对该服务进行负载测试。

相关问题