-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use of HTTPAPI Plugin takes more execution time (DCNE-299) #718
Comments
Hi @jordiasla, Thank you for raising this issue. Could you elaborate a bit more how your benchmarking was done and provide some of the logs / outputs of the results? We would need to have a look into recreation too see the actual result and what exactly is causing this. Also are you sure you are using the httpapi plugin, because in your playbook your connection is set to local. |
Hi @jordiasla, I ran a few tests already locally with the plugin and without and getting consistently same results: WITH HTTPAPI PLUGIN
WITHOUT HTTPAPI PLUGIN
|
Hi @akinross , thanks a lot for reaching out. As I said, I hope the whole issue is not a matter of my misinterpretation of benefits coming from the use of HTTPAPI plugin. The whole execution of the playbook I sent is wrapped in an invoke script. Within this script I use the python 'time' library to note the start and end time of the task, hence I calculate the total runtime. It may not be super accurate but as a magnitude, the time difference is consistent for all the times I executed it. I saw your results and indeed there is no difference, so I am doing something wrong... Do you see anything strange in my inventory and role definition? |
Hi @jordiasla, Are you sure you are using the httpapi plugin, because in your playbook your connection is set to local. Precendence order of ansible might overwrite the connection to local in this case. Furthermore you could leverage validate_certs and ssl from inventory, by setting ansible_httpapi_use_ssl, and Could you share your invoke script and your entire ansible playbook / role setup to my email? I can take a look at it. Also could you run your tests again with the following https://docs.ansible.com/ansible/latest/collections/ansible/posix/profile_tasks_callback.html and provide the output? Finally from my results i would argue that there is a slight difference, with the plugin enabled it is roughly 20% faster. Which I think would make sense also because the login is only executed when the cookie is invalid. |
Hi @akinross , I have isolated my code just for this execution, again with and without HTTPAPI. I have sent you an e-mail with the details, the behavior more or less remained the same even though I incorporated your suggestions. Without HTTPAPI
With HTTPAPI
It looks like I am clearly missing something :( I really appreciate your time on this. |
@jordiasla I agree with Akini (@akinross). Can you please run your playbook using the HTTPAPI plugin with the following modifications made to your playbook? Setting connection=local enforces Ansible to NOT use the plugin. I would also decrease the number of BDs to a few to save time and make sure the below config is using the plugin first.
|
Thanks a lot @shrsr for the recommendation. I actually removed the connection=local before my last post, but the behavior was the same. Also, I use a big number of BDs, to take advantage of the optimization for bulk deployments, where I guess the difference will be more evident. I need to support a preparation for migrations with more that 600 objects in every maintenance window so I really need to speed up things as it takes more than 30 minutes. |
Hi @jordiasla, I ran your playbooks toward my apic ( single apic cluster for testing ) and still see roughly same results as I had before. I did not run it from your python script. WITH
WITHOUT
Could you run your tests again without python but invoking directly with |
This is really frustrating... I did it as @akinross proposed and results did not change WITHOUT
WITH
I will try to repeat it in a different host and come back. |
I did some additional testing and I am getting closer results, still HTTPAPI being faster but way less than before:
The difference for me between this test run and the ones before is location of the APIC, where in this run the APIC is closer compared to the lab in US. I am suspecting that there is a turning point where the API call is faster compared to the initialisation and overhead of the connection object. I had a compare of my API requests ( averages of running multiple requests ) between the two APIC locations which is the following: US Post to login: Status: 200 OK Size: 1.75 KB Time: 714 ms AMS Post to login: Status: 200 OK Size: 2.47 KB Time: 129 ms Could you do a check on the API request times via Postman or Thunder Client or any other tool? |
Hi @jordiasla, did you get a chance to look at the above answer? |
Hi all, first of all allow me to apologize on "ghosting" this thread. I had some urgent, work-related issues, so I had to step back from this testing. What I further did was to check on two additional setups (as localhost) and one more fabric, The results did not change anyhow
Also, the first and last set of tests was against the same ACI fabric. It looks like WSL somehow impacts the execution, but I can still not understand why HTTPAPI is so mush worse in the first set. I will try to check with postman and come back. thanks |
Community Note
Description
Affected Module Name(s):
APIC version and APIC Platform
Collection versions
Expected Behavior
To my understanding the ACI HTTPAPI plugin minimizes the time execution of the playbooks since it no longer requires login for every API call. I have used it with a role that creates multiple BDs over a loop and measured the time required for the execution.
Actual Behavior
In reality, when looping over 190 BDs, it took more than 3 minutes to execute whereas it took a bit more that one minute when executing without the ACI HTTPAPI plugin. There is a big chance that I am not using the plugin as required so the playbooks can be found below.
Playbook tasks to Reproduce
The scenario is with one APIC cluster as host and a playbook using a role.
Without ACI HTTPAPI plugin
Inventory
Playbook
Role
With ACI HTTPAPI plugin
Inventory
Playbook
Role
Important Factoids
The reason I used loop control for non HTTPAPI was to overcome the throttling behavior of the APIC controller which returned connection timeout from NGINX. Even so, the task, once completed was three times faster than using HTTPAPI plugin.
The text was updated successfully, but these errors were encountered: