Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Question

...

I'm getting an error that says 'too many new instances created: 503". Does anyone know what I can do to resolve this?
I I'm doing a lot of lookups in this logic element so I think this has something to do with it.

Answer

...

503 is the number of instances created
the . The number comes from app's xml the application XML config file:

Code Block
<formulaEngine>

...


    <script>

...


      <maxInstances>500</maxInstances>

...


      <timeoutInSec>5</timeoutInSec>      

...


      <findMaxResults>200</findMaxResults>      

...


    </script>

...


  </formulaEngine>

500 in by default

 

Q:

Do you think it would fix the problem to call some of the lookups in a different element?
Is 500 the max number of instances for one element or the entire logic?

A:It seems that it is per formula (just guessing from the fact that those variables lives in instences of class named FormulaSandbox)

Q: Is there any way to increase or remove this limit?

A: We've allowed ourselves quite a bit of leeway in dedicated instances, but in In a shared instance we do have need to limit the resource usage in a formula.
The  The limit is per script, i.e. formula element, so spreading out logic would help.  
The first thing to do would be to review the code though.workaround = as a workaround, try to spread out the logic between more elements

If you encounter many instances of a Date, you can consider trying these code replacements:

  • api.parseDate(strdate)Date.parse(DATE_FORMAT, strDate)

  • def formatter = new SimpleDateFormat(DATE_FORMAT); formatter.format(date) -> date.format(DATE_FORMAT)

Optimization Segmentation Logics

Note

If you are working with Optimization – segmentation tree, the maximum number of instances is defined within the net.pricefx.formulaengine.optimization.ModelFilterTreesContextReadWrite.NodeSpec parameter:

Code Block
  <maxInstancesOverrides>
    <net.pricefx.formulaengine.optimization.ModelFilterTreesContextReadWrite.NodeSpec
    >100000</net.pricefx.formulaengine.optimization.ModelFilterTreesContextReadWrite.NodeSpec>
  </maxInstancesOverrides>
Info

See also: