To address the serious problem of delay and energy consumption increase and service quality degradation caused by complex network status and huge amounts of computing data in the scenario of vehicle-to-everything (V2X),a vehicular network architecture combining mobile edge computing (MEC) and software defined network (SDN) was constructed.MEC sinks cloud serviced to the edge of the wireless network to compensate for the delay fluctuation caused by remote cloud computing.The SDN controller could sense network information from a global perspective,flexibly schedule resources,and control offload traffic.To further reduce the system overhead,a joint task offloading and resource allocation scheme was proposed.By modeling the MEC-based V2X offloading and resource allocation,the optimal offloading decision,communication and computing resource allocation scheme were derived.Considering the NP-hard attribute of the problem,Agglomerative Clustering was used to select the initial offloading node,and Q-learning was used for resource allocation.The offloading decision was modeled as an exact potential game,and the existence of Nash equilibrium was proved by the potential function structure.The simulation results show that,as compared to other mechanisms,the proposed mechanism can effectively reduce the system overhead.