The WorkloadAnalyzer uses a DataTable to write the data to the database in bulk. It also uses the DataTable to keep data in memory while it is being collected in the internal queue (a plain Queue of WorkloadEvents). The result is that events are held in memory briefly in the queue and moved to the DataTable, but that is a poor choice in terms of memory footprint.
It would be wiser to use a BinarySerializedBufferedEventQueue, write to a temporary table in batches and perform the aggregations on the database side. This would mean a significant rewrite of the aggregation logic client side but it would introduce significant benefits. Also, the DataTable is not used to write the data to the destination table directly, but it is queried from Linq to create the aggregated dataset, so any IEnumerable would do.
The WorkloadAnalyzer uses a DataTable to write the data to the database in bulk. It also uses the DataTable to keep data in memory while it is being collected in the internal queue (a plain Queue of WorkloadEvents). The result is that events are held in memory briefly in the queue and moved to the DataTable, but that is a poor choice in terms of memory footprint.
It would be wiser to use a
BinarySerializedBufferedEventQueue
, write to a temporary table in batches and perform the aggregations on the database side. This would mean a significant rewrite of the aggregation logic client side but it would introduce significant benefits. Also, the DataTable is not used to write the data to the destination table directly, but it is queried from Linq to create the aggregated dataset, so any IEnumerable would do.