Software Optimization: A Systematic Approach
jeffknupp.com
jeffknupp.com
However in this case case the bottleneck is IO and not CPU. And hence the optimization in this case would be to minimize file access, rereading information that was already present at prior steps of the process chains. I would love to learn efficient methods to measure in such architectures what are the spots to optimize.
Of course, the first thing to do is determine if increased performance is actually required. No sense in making something fast if no one benefits.
Why are you sure that these would be faster than reading and writing a file?
There is a key truth to be mindful of while doing optimization work: programmers are, as a rule, terrible at anticipating at the cause of slowness in their application. This is counterintuitive but almost always true.
Another advantage to this, which people mostly overlook, is the fact that you have a dump of intermediate data at no (additional) cost -- which makes it very helpful when you debug, and more than pays for itself when you want to redo some parts of the processing chain -- request/reply based processing (e.g. pulling from a database) that doesn't post intermediate results, would have to start from the beginning.
Furthermore, if you have enough ram, Linux is extremely good about managing the buffer caches (both read and writeback), so in the common case you get memory performance and disk durability.
It looks arcane, but communicating through files is a good, unappreciated way to communicate.