Mobile Edge Computing architecture is one of the most promising architectures that can satisfy different quality of Services required by various applications. In this paper, we model mobile edge computing architecture with queue-length thresholds at user equipments and edges to determine whether the task is offloaded or not in federated cloud and edge computing systems. We propose two models as vertical default & vertical (VDV) model and vertical default & horizontal shortest (VDHS) model. The former only does vertical offloading, meaning that the edge can offload tasks to the cloud, while the latter does vertical offloading and horizontal offloading, meaning that the edge can offload tasks to other edges. However, it is very difficult to directly derive the performance metrics in our models, so we approximate them. Based on these approximations, we determine the optimal queue-length thresholds of UEs and edges. Experiment results show that analytical and simulation results match very well. Also VDHS can reduce the mean task sojourn time by 30% at most and increase delay satisfaction ratio by 11% at most compared with VDV.