The application of the virtual synchronous generator (VSG) control technology to engage the inertia response of renewable energy generation systems is an effective means of coping with the problem of weak inertia in power systems. To deal with the problem of small-signal stability in the weak inertia power system, this paper studies how the strength of virtual inertia and damping affect the small-signal stability, and proposes an optimal allocation strategy of virtual inertia and damping for improving the small-signal stability. The optimal allocation model of virtual inertia is constructed to minimize the energy imbalance of the system under small-signal by selecting the virtual inertia and damping as optimization variables. Regarding the aforementioned model, the evolutionary algorithm is used to obtain the optimal allocation of virtual inertia and damping. Simulations on a virtual synchronized microgrid system show the effectiveness of the proposed strategy in improving small-signal stability.