Skip to content

Use of HTTPAPI Plugin takes more execution time (DCNE-299) #718

Open
@jordiasla

Description

@jordiasla

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

  • Use of HTTPAPI Plugin takes more execution time

Affected Module Name(s):

  • aci_bd (but I guess it also apply on all modules)

APIC version and APIC Platform

  • V 6.0(7e) and on-prem

Collection versions

  • cisco.aci 2.10.1

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

---
lab_fabric:
  hosts:
    lab_fabric_apic_1:
      apic_host: x.x.x.1
    lab_fabric_apic_2:
      apic_host: x.x.x.2
    lab_fabric_apic_3:
      apic_host: x.x.x.3
  vars:
    apic_validate_certs: false
    apic_username: username
    apic_password: password

Playbook

- name: Manage BDs
  hosts: all
  gather_facts: true
  connection: local
  any_errors_fatal: true
  ignore_errors: false
  run_once: true


  roles:
    - role: roles/manage-bds

Role

- name: Declare aci_login
  ansible.builtin.set_fact:
    aci_login: &aci_login
      hostname: '{{ apic_host }}'
      username: '{{ apic_username }}'
      password: '{{ apic_password }}'
      use_ssl: true
      validate_certs: '{{ apic_validate_certs }}'
      output_path: "{{ playbook_dir }}/../files/aci_data_bds_{{ ansible_date_time.iso8601_basic_short }}.json"

- name: Manage BDs
  cisco.aci.aci_bd:
    <<: *aci_login
    bd: '{{ item.name }}'
    description: '{{ item.description | default(omit) }}'
    tenant: '{{ item.tenant }}'
    vrf: '{{ item.vrf }}'
    l2_unknown_unicast: '{{ item.l2_unknown_unicast | default("flood") }}'
    l3_unknown_multicast: '{{ item.l3_unknown_multicast | default(omit) }}'
    multi_dest: '{{ item.multi_dest_flood | default(omit) }}'
    arp_flooding: '{{ item.arp_flood | default("yes") }}'
    enable_routing: '{{ item.unicast_routing | default("no") }}'
    mac: '{{ item.mac | default(omit) }}'
    name_alias: '{{ item.name_alias | default(omit) }}'
    state: '{{ item.status }}'
  loop: '{{ bds }}'
  loop_control:
    pause: 0.05

With ACI HTTPAPI plugin

Inventory

---
lab_fabric:
  hosts:
    cluster_apic:
      ansible_host: x.x.x.1,x.x.x.2,x.x.x.3
  vars:
    apic_validate_certs: false
    ansible_user: username
    ansible_password: password
    ansible_connection: ansible.netcommon.httpapi
    ansible_network_os: cisco.aci.aci

Playbook

- name: Manage BDs
  hosts: all
  gather_facts: true
  connection: local
  any_errors_fatal: true
  ignore_errors: false
  run_once: true


  roles:
    - role: roles/manage-bds

Role

- name: Manage BDs
  cisco.aci.aci_bd:
    validate_certs: '{{ apic_validate_certs }}'
    output_path: '{{ playbook_dir }}/../files/aci_data_bds_{{ ansible_date_time.iso8601_basic_short }}.json'
    use_ssl: true
    bd: '{{ item.name }}'
    description: '{{ item.description | default(omit) }}'
    tenant: '{{ item.tenant }}'
    vrf: '{{ item.vrf }}'
    l2_unknown_unicast: '{{ item.l2_unknown_unicast | default("flood") }}'
    l3_unknown_multicast: '{{ item.l3_unknown_multicast | default(omit) }}'
    multi_dest: '{{ item.multi_dest_flood | default(omit) }}'
    arp_flooding: '{{ item.arp_flood | default("yes") }}'
    enable_routing: '{{ item.unicast_routing | default("no") }}'
    mac: '{{ item.mac | default(omit) }}'
    name_alias: '{{ item.name_alias | default(omit) }}'
    state: '{{ item.status }}'
  loop: '{{ bds }}'

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingjira-syncSync this issue to Jira

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions