A computer system for distributed processing using drift-based dynamic clustering of Internet of Things (IoT) devices, the computer system comprising one or more processors, one or more computer-readable memories, and one or more computer-readable storage devices, and program instructions stored on at least one of the one or more storage devices for execution by at least one of the one or more processors via at least one of the one or more memories, the stored program instructions comprising:
- program instructions to determine, using a processor and a memory at a central IoT device, a data source that is to be used for processing a workload;
- program instructions to select a set of IoT devices that are operating within a threshold distance from the data source at a first time;
- program instructions to select, at the central IoT device, to form a cluster of IoT devices, a first subset of the set of IoT devices, wherein each IoT device in the first subset satisfies a clustering condition, and with the cluster including a first IoT device and a second IoT device;
- program instructions to select the first IoT device as a current designated device for processing the workload, the program instructions to select the first IoT device including:
- program instructions to configure a lightweight application to set the first IoT device as the current designated device for processing the workload;
- program instructions to process a portion of the workload, but less than the entirety of the workload, by the first IoT device;
- program instructions to discover, subsequent to processing a portion of the first workload by the first IoT device, by performing a performance check on the first IoT device, a change in a performance metric of the first IoT device, the change in performance metric being indicative of an increased demand for a computing resource at the first IoT device;
- program instructions to select, responsive to the in the performance metric, the second IoT device as a current designated device for processing the workload, the program instructions to select the second IoT device including:
- program instructions to re-configure the lightweight application to set the second IoT device as the current designated device for processing the workload;
- program instructions to, subsequent to the processing of the portion of the workload by the first IoT device, process another portion of the workload by the second IoT device;
- program instructions to drop, responsive to determining at a second time that the first IoT device has moved to a distance greater than the threshold distance from the data source;
- program instructions to join a third IoT device to the cluster, wherein the third IoT device has moved within the threshold distance from the data source at the second time, and wherein the third IoT device satisfies the clustering condition;
- and
- program instructions to transfer the processing of the workload from the first IoT device to the third IoT device.