Abstract Mobile edge computing(MEC) has already shown its powerful computing ability in mobile device which can broaden the capacity of computing. However, in view of mobile edge computing system, due to the varying network conditions and limitation of the wireless channel, the problem of long delay and high energy consumption maybe increase in the industrial production line. Therefore, computing offloading was proposed to reduce delay and energy consumption in mobile edge computing but the task allocation of offloading decision still can be improved by using different optimization algorithms. In this paper, we improved computation offloading method by an improved glowworm swarm optimization(GSO) algorithm to solve this problem for multi-user-multi-MEC in mobile edge computing. Compared with existing improved algorithms of computation offloading, the experimental results show that our proposal can reduce the system cost a lot(to 25%) which has a better performance of saving energy and reducing delay in the mobile edge computing environment.