The invention relates to a virtual network function deployment optimization algorithm based on deep reinforcement learning, and belongs to the technical field of mobile communication. According to themethod, VNF sharing is considered under the constraint of a physical layer CPU, bandwidth resources and SFC end-to-end time delay, and the total cost of a service provider and the SFC end-to-end timedelay are jointly optimized by deploying VNF and allocating CPU resources; secondly, since the state space and the action space of the scheme are continuous value sets, a VNF intelligent deployment algorithm based on deep reinforcement learning is provided, and thus an approximately optimal VNF deployment and resource allocation strategy is obtained. And on each discrete time slot, the VNF is deployed to a proper destination server according to the arrival rate of the SFC, the remaining CPU resources of the universal server and the remaining bandwidth resources of the physical link, and the VNF is allocated to the CPU resources of the destination server. According to the VNF deployment optimization algorithm provided by the invention, the compromise between the total cost of the service provider and the end-to-end delay of the SFC can be realized, and the resource utilization of the physical network is improved.