简体   繁体   中英

How can I do Performance & Load Testing for Spring @Scheduled task

I want to run Performance & Load Test for a Spring @Scheduled task using Apache JMeter if possible.

  1. Does it support this?
  2. And how can I achieve it?

I'm using Spring 5 (non boot) and JMeter 5.4.1

Thank you

Edit 1: My scheduled task is configured as below

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
    }
}

You should extract the code inside of the method synchronizeNotificationUploadDocument to a service and then load test this service.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM