Mourad gh
Mourad gh

Reputation: 23

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

Upvotes: 1

Views: 902

Answers (1)

Simon Martinelli
Simon Martinelli

Reputation: 36223

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

Upvotes: 0

Related Questions