ansible Batch Execution Command slow solution

Source: Internet
Author: User

Do operation and maintenance of the classmate many have used Ansible bar, open Source Batch deployment tool ranked top three: puppet, Saltstack, Ansible.

Ansible is characterized by the absence of agents, the use of SSH protocol to communicate, lightweight, written in Python, can write playbook, can also do some ad-hoc batch command execution operations.

The recent execution of the ansible command on two ansible hosts found that the same command was performed on the same client, with a significant time difference, with both Ansible host configuration performance. I felt very strange, so I tried to find out.

Of course, the first is to use the time command to see the exact timing consumption.

Result:on host1
Real 150.42
User 27.80
SYS 11.97

Result on Host2
Real 59.40
User 31.80
SYS 12.96

From real time you can see that it's nearly 3 times times worse.

Using top to look at the machine's CPU and memory are relatively empty, and then think of whether it may be an IO problem, with the following command to view

Iostat-x 5 3

found that the IO footprint is also very small, so I would like to be who adjusted the system parameters caused by the problem, so with the time command to output a lot of detailed parameters

/usr/bin/time-f ' number of waits%w \nnumber of file system inputs by the process%I \nnumber of the file system outputs by T He process%O \nnumber of socket messages received by the process%r \nnumber of sockets messages sent by the process%s \ n System ' s page size%Z \npercentage of the CPU that this job got%P \naverage Total (data+stack+text) memory use of the Pro Cess, in Kbytes%K \nmaximum resident set size of the process during it lifetime, in Kbytes%M \nnumber of Major page FAU Lts that occurred while the process is running%F \nnumber of times the process was swapped out of main memory%W \nreal %e \nuser%u \nsys%s \ n ' ansible-i hosts/cluster regionservers-kk-u root-u username-m command-a "uptime"-F 100


After comparison, we found that there was no big problem, and finally focused on the ansible itself.

Look at the Ansible profile/etc/ansible/ansible.cfg, and the comparison found that one line was being watched.

host_key_checking = False

After the change, in the Run ansible command, speed up!

This solves the problem.

This article provides a general idea to solve the problem, of course, there may be a network of questions , step by step troubleshooting.

What are the questions you can leave a message to discuss.

This article from "Linux operation and Maintenance" blog, declined reprint!

ansible Batch Execution Command slow solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.