Optimal aggregation algorithms for middleware | Synapse