Mule batch processing vs foreach vs splitter-aggregator -


in mule, have quite many records process, processing includes calculations, going , forth database etc.. can process collections of records these options

  1. batch processing
  2. foreach
  3. splitter-aggregator

    so main differences between them? when should prefer 1 others?

mule batch processing option not seem have batch job scope variable definition, example. or, if want benefit multithreading fasten overall task? or, better if want modify payload during processing?

when write "quite many" assume it's main memory, rules out spliter/aggregator because has collect records return them list.

i assume have records in stream or iterator, otherwise have memory problem...

so when use for-each , when use batch?

for each

the simple solution, has drawbacks:

  1. it single threaded (so may slow use case)
  2. it "fire , forget": can't collect within loop, e.g. record count
  3. there not support handling "broken" records

within loop, can have several steps (message processors) process records (e.g. mentioned database lookup).

may drawback, may advantage: loop synchronous. (if want process asynchronous, wrap in async-scope.)

batch

a little more stuff / understand, more features:

  1. when called flow, asynchronous (this may drawback).
  2. can standalone (e.g. poll inside starting)
  3. when data generated in loading phase big, automatically offloaded disk.
  4. multithreading free (number of threads configurable)
  5. handling "broken records": batch steps may executed good/broken records only.
  6. you statitstics @ end (number of records, number of successful records etc.)

so looks better use batch.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -