What's an effective way to sort data objects by creation time after aggregating them from separate machines?

一笑奈何 提交于 2019-12-11 07:49:57

问题


I am creating data on several machines, processing the data in parallel, and then aggregating to a separate machine. What is the best way to sort the aggregated data by creation time, accurate to say, +/- 5 seconds? If all of the machines have their system time synchronized via NTP, is tacking on an integer timestamp, from the UNIX epoch, on each source machine, going to be reliable enough?


回答1:


After puzzling over this for a very short time, the best technique I can think of so far would be to maintain a monotonic clock on the source machines, and rather than adding an absolute(ish) timestamp to the data, add "age since creation" to each processed element, as calculated by ticks of the monotonic clock, and sort by this age on the aggregating machine. This leaves room for error due to network delay, so I'm open to more suggestions (barring reimplementing NTP, as in this answer.)



来源:https://stackoverflow.com/questions/57278471/whats-an-effective-way-to-sort-data-objects-by-creation-time-after-aggregating

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!