# Workflow flowload history size issue

**URL:** <https://community.temporal.io/t/workflow-flowload-history-size-issue/2001>\
**Category:** Community Support\
**Tags:** history\
**Created:** [April 25, 2021, 4:16pm UTC](https://community.temporal.io/t/workflow-flowload-history-size-issue/2001 "2021-04-25T16:16:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ramprasad\_Indarapu](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/ramprasad_indarapu/32/718_2.png) [@Ramprasad\_Indarapu](https://community.temporal.io/u/Ramprasad_Indarapu)\
**Post date:** [April 25, 2021, 4:16pm UTC](https://community.temporal.io/t/workflow-flowload-history-size-issue/2001/1 "2021-04-25T16:16:31Z")

</div>

I have a usecase and need to validate the implementation logic.  
The payload for the workflow is below

```auto
main:
foreach

    call subflow1 100 times

subflow1:
steps:
step1
step2

    call subflow2
    step3

subflow2:
steps:
step1

```

Current implementation  
Payload is sent to main flow execution  
When the subflow is invoked the complete payload is again sent to subflow, as the nested subflows are possible  
This is the main reason I guess for the history size increase.

Thinking of the below solution. Can you please validate the following solution?

Solution1  
Maintain the complete payload in the main workflow.  
Implement a query method in the main flow to return by taking a subflow name as an argument and return subflow payload and cache it as one of the flow instance variable  
When a child flow requires subflow payload, use the query method of the main workflow to get the same.  
We have a case where the subflow1 can be executed in parallel(using child flows) where the work is distributed say 10 child flows each handles 10 iterations). I am using the promise to complete the child flow as below.

JiffyWorkflow workflow = WorkFlowUtils.buildChildWorkFlowObject();  
executions.add(Async.function(workflow::execute, flowInput));  
Promise.allOf(executions).get();

One question I have is “will this work in case of child flow crashes also”?

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [April 25, 2021, 6:26pm UTC](https://community.temporal.io/t/workflow-flowload-history-size-issue/2001/2 "2021-04-25T18:26:59Z")

</div>

Duplicate of [Workflow history size / count exceeds limit - #6 by Ramprasad\_Indarapu](https://community.temporal.io/t/workflow-history-size-count-exceeds-limit/1999/6)
