A multi-cube mapping-based resource allocation method in network function virtualization uses a multi-cube model to abstract resources, uses a mathematical vector theory as a main research tool, uses virtual machine mapping as a principal line, considers server energy consumption, takes a minimum usage amount of servers as a research objective, and aims to improve the utilization rate of resources in network function virtualization. The method provided by the invention uses vectors of three dimensions, i.e., CPU, Memory and IO, to represent quantity of resources, adopts a multi-cube resource model, according to a virtual machine resource request vector and a server residual resource vector, first adopts an optimal adaptive method to select a target server set, and then takes a minimum unbalanced degree of resource utilization as a criterion to select an optimal server, and finally migrates virtual machines, and shuts down low-load servers to reduce energy consumption.