With the increasingly widespread use of networks and end devices, more and more data and computations must be processed. With processing constrained by the limited resources of the end device, edge computing plays an important role. Edge computing offloads computation to surrounding edge nodes with corresponding computing capabilities so that the end device can get a response within a reasonable latency to meet the user's needs. Since these edge nodes are composed of multiple heterogeneous computing units, any system's task-offloading strategy must necessarily affect the system's load balance and execution time. This study proposes a real-time, two-stage ant colony algorithm (RTACO) with the following goals: 1) the algorithm requires low latency; 2) the algorithm minimizes the makespan of all tasks; 3) the algorithm optimizes the system load and reduces the burden of the task-offloading algorithm, thereby providing a stable and high-performance edge computing system. Experiments show that RTACO requires low execution time, and can still effectively achieve good results even when the system has limited resources.