How to execute many workflows at the same time?

I am performing load testing in the cadence cluster.
I am using version 3.12.0 in a Spring Boot Application.

My load tests consist of two groups of requests:

  1. 100 delayed requests, something between 0.5-1 second per request
  2. 100 parallel requests

The delayed requests are working perfectly, but the parallel requests are not.

The workflow has just one type of activity that is used n times, where n is the size of a list of Process. These Process are configured in the application.properties and there are 4 types of lists.

The whole idea of the workflow is:

  1. an endpoint triggers the workflow to start

  2. then it captures the list of processes and then the workflow awaits a signal

  3. an external application triggers the signal and then the loop of size n begins.

  4. inside the loop, a message is sent to a queue and awaits a signal to send another message.

    1. an external application will process the message and then send the signal for the workflow to continue.
  5. after the list is fully processed, the workflow ends.

Here it is some samples of the Activity and Workflow:

// activity interface
public interface ISendMessageActivity {
    @ActivityMethod(scheduleToCloseTimeoutSeconds = 60 * 60)
    void sendMessage(Params params);
}

// activity implementation
@RequiredArgsConstructor
@Component
@Scope("prototype")
@Slf4j
public class SendMessageActivityImpl implements ISendMessageActivity {
    private final QueueService queueService;

    @Override
    public void sendMessage(Params params) {
                var messageParams = new MessageParams();
        messageParams.setId(String.valueOf(Instant.now().getNano()));
        messageParams.setParams(params);
        queueService.requestProcess(params);
    }
}

// workflow interface
public interface IPublishingWorkflow {
    @WorkflowMethod(executionStartToCloseTimeoutSeconds = 60 * 60)
    void startWorkflow(Params params);
    
    @SignalMethod
    void continueWorkflow();
}

// workflow implementation
@Component
@Scope("request")
@Slf4j
public class PublishingWorkflowImpl implements IPublishingWorkflow {    
    @Getter @Setter
    private int processNumber = 0;
    @Getter @Setter
    private int before;

    private final ProcessConfiguration processConfiguration;
    private final ISendMessageActivity sendMessageActivities;

    public PublishingWorkflowImpl() {
        this.processConfiguration = SpringContext.getBeans(ProcessConfiguration.class);
        this.sendMessageActivities = Workflow.newActivityStub(ISendMessageActivity.class);
    }

    @Override
    public void startWorkflow(Params params) {
        List<Process> processes = getProcesses(params);
        
        processNumber++;
        setBefore(processNumber);

        Workflow.await(() -> processNumber > before);

        for (Process process : processes) {
            params.setProcess(process);
            sendMessageActivities.sendMessage(params);
            
            before = processNumber;
            Workflow.await(() -> processNumber > before);
        }
        log.info("Workflow finished. {}", params.getPublishId());
    }

    @Override
    public void continueWorkflow() {
        setProcessNumber(getProcessNumber() + 1);
    }

    private List<Process> getProcesses(Params params) {
        //
    }
}

I isolated the creation of the WorkflowClient so that there is only one instance while the application is active. This reduced CPU and memory consumption, but did not solve the issue of parallel requests.

I changed the scope of the workflow implementation to “singleton” but it led to other problems.

Am I missing some uber-cadence concept?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật