Computation offloading is one of the most important problems in edge computing. Devices can transmit computation tasks to servers to be executed through computation offloading. However, not all the computation tasks can be offloaded to servers with the limitation of network conditions. Therefore, it is very important to decide quickly how many tasks should be executed on servers and how many should be executed locally. Only computation tasks that are properly offloaded can improve the Quality of Service (QoS). Some existing methods only focus on a single objection, and of the others some have high computational complexity. There still have no method that could balance the targets and complexity for universal application. In this study, a Multi-Objective Whale Optimization Algorithm (MOWOA) based on time and energy consumption is proposed to solve the optimal offloading mechanism of computation offloading in mobile edge computing. It is the first time that MOWOA has been applied in this area. For improving the quality of the solution set, crowding degrees are introduced and all solutions are sorted by crowding degrees. Additionally, an improved MOWOA (MOWOA2) by using the gravity reference point method is proposed to obtain better diversity of the solution set. Compared with some typical approaches, such as the Grid-Based Evolutionary Algorithm (GrEA), Cluster-Gradient-based Artificial Immune System Algorithm (CGbAIS), Non-dominated Sorting Genetic Algorithm III (NSGA-III), etc., the MOWOA2 performs better in terms of the quality of the final solutions.