With advances in virtualization technology, cloud computing has become the most powerful and promising platform for business, academia, public and government organizations. Scheduling these workflows and load balancing to get better success rate becomes a challenging issue in cloud computing. In this paper, we used Cats and Dragonfly Optimization (CSO-DA) algorithm to balance the Load in the process of allocating resources to virtual machines in cloud computing in order to improve the speed and accuracy of scheduling. The proposed method consists of the following steps: initialization of the algorithm and cloud computing, determining the number of virtual machines and the number of tasks, implementing a dragonfly optimization algorithm for choosing the best host and implementing a cat collapse algorithm for balancing the load and Schedule tasks between virtual machines. Our experiments show that as far as run time, response time, task immigration and significant load balances are concerned, our proposed model combining cat and dragonfly optimization algorithms achieved better performance in allocating resources and load balance between virtual machines than other methods.