java - 如何对 Spring @Scheduled 任务进行性能和负载测试
问题描述
如果可能,我想使用 Apache JMeter 为 Spring @Scheduled 任务运行性能和负载测试。
- 它支持这个吗?
- 我怎样才能实现它?
我正在使用 Spring 5(非启动)和 JMeter 5.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
}
}
解决方案
您应该将方法内的代码提取synchronizeNotificationUploadDocument
到服务中,然后对该服务进行负载测试。
推荐阅读
- couchdb - 自定义 CouchDb SSL 证书验证
- reactjs - 理解组件反应
- python - 如何在 Keras 中实现 CRelu?
- c# - 使用 html 敏捷包提取 html 元素属性值
- amazon-web-services - 根据数据类型将来自 AWS Kinesis 的数据放入不同的存储桶中
- laravel - 将数据传递给 laravel 自定义验证规则
- bigtable - Bigtable:在行键上使用时间戳时避免热点
- java - 使用春季计划清除缓存?
- python - 在列表中查找替换字符串匹配 Python 3
- r - Plugging edited Datatable values in a shiny app