ligato / vpp-agent

⚡️ Control plane management agent for FD.io's VPP
https://docs.ligato.io/
Apache License 2.0
252 stars 126 forks source link

Config update with wait done takes ~500ms #1739

Closed ondrej-fabry closed 3 years ago

ondrej-fabry commented 4 years ago

Related issue: #1732

Problem

Updating config via Configurator Update with WaitDone enabled takes almost 500ms which seems to be too long making booting into functional state take much longer than acceptable, causing connection issues or dropped packets.

original report from Ed Warnicke > Question… in prep to checkout the new ‘return when done’ stuff, I was measuring some timing for the existing ‘return before done’ stuff. Any idea why the following takes slighly over 1s for the GRPC to return: https://gist.github.com/edwarnicke/ae3ee6f1509f2272935632bdc7d5fd49 > It is sent with the fullResync flag BTW > But 1s feels long > (especially since its in the ‘return before done’ mode) > commitServer time for vppagent update: 1.028992136s > I’ve been testing your new WaitTillDone and that bumps it up to 3s… which feels really really high > OK… so looking through the logs, it looked like part of the delay might have been waiting for vppagent to connect to vpp. So I put a sleep between starting vppagent and vpp and trying my request… that reduced the time down to 613ms for the update with WaitDone == true, and 150ms in with WaitDone == false. Any idea why its taking ~500ms to complete a super super super simple transaction? > or for that matter, why writing 13 keys to a memory local data store is taking 150ms? > By way of comparison, the non-vppagent time in the chain, which involves going from Client -> Forwarder -> NSE (two GRPC calls) and a fair bit of processing in Client and a fair bit of processing (including connection establishment and TLS authentication) in each is only 40ms.

Details

The total execution of 4 transactions is just ~250ms, so the rest must be time it takes for notification to come ~or perhaps some sleeps in loops~.

finished waiting for pending keys to be done (took 464.108466ms)
Transaction log ``` Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] +======================================================================================================================+ Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] | #0 - NB Transaction FullResync | Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] +======================================================================================================================+ Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] * transaction arguments: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - seqNum: 0 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - type: NB Transaction, Full Resync Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - values: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/linux/interfaces/v2/interface/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: { name:"client-196a9529-38ae-4a0a-bc6c-ed4e81c03887" type:VETH namespace: host_if_name:"testns-196a9529" enabled:true ip_addresses:"10.0.0.0/32" veth: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/linux/interfaces/v2/interface/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887-veth Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: { name:"client-196a9529-38ae-4a0a-bc6c-ed4e81c03887-veth" type:VETH host_if_name:"client-196a9529" enabled:true veth: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/linux/interfaces/v2/interface/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: { name:"server-196a9529-38ae-4a0a-bc6c-ed4e81c03887" type:VETH namespace: host_if_name:"testns-196a9529" enabled:true ip_addresses:"10.0.0.1/32" veth: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/linux/interfaces/v2/interface/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887-veth Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: { name:"server-196a9529-38ae-4a0a-bc6c-ed4e81c03887-veth" type:VETH host_if_name:"server-196a9529" enabled:true veth: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/linux/l3/v2/route/10.0.0.0/32/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: { outgoing_interface:"server-196a9529-38ae-4a0a-bc6c-ed4e81c03887" scope:LINK dst_network:"10.0.0.0/32" } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/linux/l3/v2/route/10.0.0.1/32/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: { outgoing_interface:"client-196a9529-38ae-4a0a-bc6c-ed4e81c03887" scope:LINK dst_network:"10.0.0.1/32" } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/acls/v2/acl/eth0 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: { name:"eth0" rules: udp: source_port_range: > > > interfaces: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/l2/v2/xconnect/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: { receive_interface:"client-196a9529-38ae-4a0a-bc6c-ed4e81c03887" transmit_interface:"server-196a9529-38ae-4a0a-bc6c-ed4e81c03887" } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/l2/v2/xconnect/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: { receive_interface:"server-196a9529-38ae-4a0a-bc6c-ed4e81c03887" transmit_interface:"client-196a9529-38ae-4a0a-bc6c-ed4e81c03887" } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/v2/interfaces/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: { name:"client-196a9529-38ae-4a0a-bc6c-ed4e81c03887" type:AF_PACKET enabled:true afpacket: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/v2/interfaces/eth0 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: { name:"eth0" type:AF_PACKET enabled:true phys_address:"02:42:ac:11:00:02" ip_addresses:"172.17.0.2/16" afpacket: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/v2/interfaces/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: { name:"server-196a9529-38ae-4a0a-bc6c-ed4e81c03887" type:AF_PACKET enabled:true afpacket: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/v2/route/if/eth0/vrf/0/dst/0.0.0.0/0/gw/172.17.0.1 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: { type:INTER_VRF dst_network:"0.0.0.0/0" next_hop_addr:"172.17.0.1" outgoing_interface:"eth0" weight:1 } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] o----------------------------------------------------------------------------------------------------------------------o Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] * executed operations (2020-10-08 14:34:27.198 +0000 UTC -> 2020-10-08 14:34:27.396 +0000 UTC, dur: 198ms): Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 1. CREATE: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/linux/interfaces/v2/interface/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887-veth Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: { name:"client-196a9529-38ae-4a0a-bc6c-ed4e81c03887-veth" type:VETH host_if_name:"client-196a9529" enabled:true veth: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 2. CREATE: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/linux/interfaces/v2/interface/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: { name:"client-196a9529-38ae-4a0a-bc6c-ed4e81c03887" type:VETH namespace: host_if_name:"testns-196a9529" enabled:true ip_addresses:"10.0.0.0/32" veth: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 3. CREATE [DERIVED]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: linux/interface/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887/address/static/10.0.0.0/32 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 4. CREATE [PROPERTY]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: linux/interface/state/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887/UP Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 5. CREATE [PROPERTY]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: linux/interface/state/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887-veth/UP Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 6. CREATE: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/linux/interfaces/v2/interface/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887-veth Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: { name:"server-196a9529-38ae-4a0a-bc6c-ed4e81c03887-veth" type:VETH host_if_name:"server-196a9529" enabled:true veth: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 7. CREATE: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/linux/interfaces/v2/interface/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: { name:"server-196a9529-38ae-4a0a-bc6c-ed4e81c03887" type:VETH namespace: host_if_name:"testns-196a9529" enabled:true ip_addresses:"10.0.0.1/32" veth: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 8. CREATE [DERIVED]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: linux/interface/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887/address/static/10.0.0.1/32 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 9. CREATE [PROPERTY]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: linux/interface/state/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887/UP Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 10. CREATE [PROPERTY]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: linux/interface/state/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887-veth/UP Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 11. CREATE: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/linux/l3/v2/route/10.0.0.0/32/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: { outgoing_interface:"server-196a9529-38ae-4a0a-bc6c-ed4e81c03887" scope:LINK dst_network:"10.0.0.0/32" } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 12. CREATE [PROPERTY]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: linux/link-local-route/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887/dest-address/10.0.0.0/32 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 13. CREATE: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/linux/l3/v2/route/10.0.0.1/32/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: { outgoing_interface:"client-196a9529-38ae-4a0a-bc6c-ed4e81c03887" scope:LINK dst_network:"10.0.0.1/32" } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 14. CREATE [PROPERTY]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: linux/link-local-route/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887/dest-address/10.0.0.1/32 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 15. CREATE: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/acls/v2/acl/eth0 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: { name:"eth0" rules: udp: source_port_range: > > > interfaces: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 16. CREATE [NOOP IS-PENDING]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/l2/v2/xconnect/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: { receive_interface:"client-196a9529-38ae-4a0a-bc6c-ed4e81c03887" transmit_interface:"server-196a9529-38ae-4a0a-bc6c-ed4e81c03887" } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 17. CREATE [NOOP IS-PENDING]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/l2/v2/xconnect/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: { receive_interface:"server-196a9529-38ae-4a0a-bc6c-ed4e81c03887" transmit_interface:"client-196a9529-38ae-4a0a-bc6c-ed4e81c03887" } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 18. CREATE [NOOP IS-PENDING]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/v2/interfaces/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: { name:"client-196a9529-38ae-4a0a-bc6c-ed4e81c03887" type:AF_PACKET enabled:true afpacket: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 19. CREATE: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/v2/interfaces/eth0 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: { name:"eth0" type:AF_PACKET enabled:true phys_address:"02:42:ac:11:00:02" ip_addresses:"172.17.0.2/16" afpacket: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 20. CREATE [DERIVED]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: vpp/acl/eth0/interface/ingress/eth0 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 21. CREATE [DERIVED]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: vpp/interface/eth0/vrf/0/ip-version/v4 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 22. CREATE [DERIVED]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: vpp/interface/eth0/address/static/172.17.0.2/16 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 23. CREATE [DERIVED]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: vpp/interface/eth0/has-IP-address Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 24. CREATE [NOOP IS-PENDING]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/v2/interfaces/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: { name:"server-196a9529-38ae-4a0a-bc6c-ed4e81c03887" type:AF_PACKET enabled:true afpacket: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 25. CREATE: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/v2/route/if/eth0/vrf/0/dst/0.0.0.0/0/gw/172.17.0.1 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: { type:INTER_VRF dst_network:"0.0.0.0/0" next_hop_addr:"172.17.0.1" outgoing_interface:"eth0" weight:1 } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] x----------------------------------------------------------------------------------------------------------------------x Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] | #0 - NB Transaction took 198.2ms | Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] x----------------------------------------------------------------------------------------------------------------------x Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] +======================================================================================================================+ Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] | #1 - SB Notification | Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] +======================================================================================================================+ Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] * transaction arguments: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - seqNum: 1 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - type: SB Notification Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - values: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: vpp/interface/eth0/link-state/DOWN Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] o----------------------------------------------------------------------------------------------------------------------o Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] * executed operations (2020-10-08 14:34:27.397 +0000 UTC -> 2020-10-08 14:34:27.397 +0000 UTC, dur: 0s): Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 1. CREATE [OBTAINED]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: vpp/interface/eth0/link-state/DOWN Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] x----------------------------------------------------------------------------------------------------------------------x Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] | #1 - SB Notification took 100µs | Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] x----------------------------------------------------------------------------------------------------------------------x Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] +======================================================================================================================+ Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] | #2 - SB Notification | Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] +======================================================================================================================+ Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] * transaction arguments: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - seqNum: 2 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - type: SB Notification Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - values: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: linux/interface/host-name/client-196a9529 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] o----------------------------------------------------------------------------------------------------------------------o Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] * executed operations (2020-10-08 14:34:27.783 +0000 UTC -> 2020-10-08 14:34:27.81 +0000 UTC, dur: 27ms): Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 1. CREATE [OBTAINED]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: linux/interface/host-name/client-196a9529 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 2. CREATE [WAS-PENDING]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/v2/interfaces/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: { name:"client-196a9529-38ae-4a0a-bc6c-ed4e81c03887" type:AF_PACKET enabled:true afpacket: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] x----------------------------------------------------------------------------------------------------------------------x Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] | #2 - SB Notification took 26.9ms | Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] x----------------------------------------------------------------------------------------------------------------------x Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] +======================================================================================================================+ Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] | #3 - SB Notification | Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] +======================================================================================================================+ Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] * transaction arguments: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - seqNum: 3 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - type: SB Notification Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - values: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: vpp/interface/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887/link-state/DOWN Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] o----------------------------------------------------------------------------------------------------------------------o Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] * executed operations (2020-10-08 14:34:27.81 +0000 UTC -> 2020-10-08 14:34:27.811 +0000 UTC, dur: 0s): Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 1. CREATE [OBTAINED]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: vpp/interface/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887/link-state/DOWN Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] x----------------------------------------------------------------------------------------------------------------------x Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] | #3 - SB Notification took 100µs | Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] x----------------------------------------------------------------------------------------------------------------------x Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] +======================================================================================================================+ Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] | #4 - SB Notification | Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] +======================================================================================================================+ Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] * transaction arguments: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - seqNum: 4 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - type: SB Notification Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - values: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: linux/interface/host-name/server-196a9529 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] o----------------------------------------------------------------------------------------------------------------------o Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] * executed operations (2020-10-08 14:34:27.828 +0000 UTC -> 2020-10-08 14:34:27.859 +0000 UTC, dur: 31ms): Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 1. CREATE [OBTAINED]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: linux/interface/host-name/server-196a9529 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 2. CREATE [WAS-PENDING]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/v2/interfaces/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: { name:"server-196a9529-38ae-4a0a-bc6c-ed4e81c03887" type:AF_PACKET enabled:true afpacket: } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 3. CREATE [WAS-PENDING]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/l2/v2/xconnect/client-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: { receive_interface:"client-196a9529-38ae-4a0a-bc6c-ed4e81c03887" transmit_interface:"server-196a9529-38ae-4a0a-bc6c-ed4e81c03887" } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 4. CREATE [WAS-PENDING]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: config/vpp/l2/v2/xconnect/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: { receive_interface:"server-196a9529-38ae-4a0a-bc6c-ed4e81c03887" transmit_interface:"client-196a9529-38ae-4a0a-bc6c-ed4e81c03887" } Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] x----------------------------------------------------------------------------------------------------------------------x Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] | #4 - SB Notification took 30.9ms | Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] x----------------------------------------------------------------------------------------------------------------------x Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] +======================================================================================================================+ Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] | #5 - SB Notification | Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] +======================================================================================================================+ Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] * transaction arguments: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - seqNum: 5 Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - type: SB Notification Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - values: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: vpp/interface/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887/link-state/DOWN Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] val: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] o----------------------------------------------------------------------------------------------------------------------o Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] * executed operations (2020-10-08 14:34:27.859 +0000 UTC -> 2020-10-08 14:34:27.859 +0000 UTC, dur: 0s): Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] 1. CREATE [OBTAINED]: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - key: vpp/interface/server-196a9529-38ae-4a0a-bc6c-ed4e81c03887/link-state/DOWN Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] - value: Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] x----------------------------------------------------------------------------------------------------------------------x Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] | #5 - SB Notification took 100µs | Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] x----------------------------------------------------------------------------------------------------------------------x Oct 8 14:34:26.189 [INFO] [cmd:vpp-agent] ```

Full agent log

Cause

There seems to be hard-coded delay for pushing the linux notifications to the kv scheduler: https://github.com/ligato/vpp-agent/blob/master/plugins/linux/ifplugin/descriptor/watcher.go#L42

Solution

Remove forced delay for linux interface notifications.

edwarnicke commented 4 years ago

Actually that's 500ms with WaitDone off. Its 3s with WaitDone on.

edwarnicke commented 4 years ago

Also... I am dumbfounded that it takes 150ms to write 13 keys into the keystore in memory...

ondrej-fabry commented 4 years ago

Also... I am dumbfounded that it takes 150ms to write 13 keys into the keystore in memory...

Why do you assume it's only writing to memory? I see VPP interfaces, routes.. being configured there. Basically all the non-PENDING CREATE operations are doing some action in the dataplane.

edwarnicke commented 4 years ago

0 - NBTransaction took 147ms

The reported time for the NB Transaction is 147ms

I presumed since we have a host of SB transactions configuring actual things, that the NB transaction is simply writing to the key store for desired config.

I think you are telling me that the

CREATE:

are doing actual work SB as part of the NB transaction in that 147ms?

Presumably the CREATE [NOOP IS-PENDING] and CREATE [PROPERTY] are not doing work as part of the NB transaction (though presumably the IS-PENDING will later).

What about the CREATE [DERIVED] ?

ondrej-fabry commented 4 years ago

What about the CREATE [DERIVED] ?

Those are likely doing some dataplane requests as well that is DERIVED from some NB model, e.g. setting VRF table for interface, adding IPs to interface, adding interface to bridge domain.. etc.

More detailed info in docs: Understanding the KV Scheduler transaction log

ondrej-fabry commented 4 years ago

I presumed since we have a host of SB transactions configuring actual things, that the NB transaction is simply writing to the key store for desired config.

edwarnicke commented 4 years ago

Slightly cleaner gist: https://gist.github.com/edwarnicke/bb7c65e20d870036a2c9b3df8226b0a0 (suppressed the line prefixes with the info about it being vppagent logs so its just showing the actual logs from vppagent)

edwarnicke commented 4 years ago
  • NB transactions are done from clients (gRPC, KVDB..)
  • SB transactions are simply events/notifications from the dataplane

OK... got it.

So when I read a line like:

1 - SBNotification took 100µs

Is that 100µs from when? From when the config request was made?

ondrej-fabry commented 4 years ago

Is that 100µs from when? From when the config request was made?

It's always since start of transaction, so when KVScheduler started processing it.

edwarnicke commented 4 years ago

OK... so the vpp related notifications are pretty quick (order of a low hundreds of µs) and the kernel transactions are slow (order of 24ms), and the initial sending of configs (NB#0) is running slow (order of 147ms).

The things I can't reconcile are:

  1. Why if NB#0 in the WaitDone == false case is 147ms but its still taking ~500ms for me to get a GRPC return
  2. Why if the NB#0+All the SB Notifications are order ~200ms its taking 3 seconds for me to get a GRPC return in the case where WaitDone == true.
ondrej-fabry commented 4 years ago

OK... so the vpp related notifications are pretty quick (order of a low hundreds of µs) and the kernel transactions are slow (order of 24ms), and the initial sending of configs (NB#0) is running slow (order of 147ms).

Not really.. it's not about vpp/kernel notifications and actually not about the input values of transactions at all. This is about the executed operations in the transactions:

The things I can't reconcile are:

Why if NB#0 in the WaitDone == false case is 147ms but its still taking ~500ms for me to get a GRPC return Why if the NB#0+All the SB Notifications are order ~200ms its taking 3 seconds for me to get a GRPC return in the case where WaitDone == true.

Yes, this is same observation as I summarized in the original post and from a quick look into a code I have not noticed anything weird so will need to do further investigation and test this locally...

edwarnicke commented 4 years ago

Incidently... if you are interested in recreating what I'm working with, you can simply checkout:

https://github.com/networkservicemesh/cmd-forwarder-vppagent

and run

docker run --privileged --rm $(docker build -q --target test .)

edwarnicke commented 4 years ago

(note: the above is just doing the older v3.1.0 (ie, without WaitDone even available).

ondrej-fabry commented 4 years ago

From this part of the log it seems that the most of time was until the linux hostifname event was received.

time="2020-10-08 20:02:09.55478" level=info msg="Transaction 1 successful!" loc="kvscheduler/txn_process.go(405)" logger=kvscheduler
+======================================================================================================================+
| #2 - SBNotification                                                                                                  |
+======================================================================================================================+
  * transaction arguments:
      - seqNum: 2
      - type: SB Notification
      - values:
          - key: linux/interface/host-name/client-b0518374
            val: <EMPTY>

time="2020-10-08 20:02:09.97031" level=debug msg="publish add to ifplugin_ifstate{{client-b0518374-ba46-402b-9aba-5d37cd6f8584 false false vpp-interface-index} 0xc00087d310}" loc="mem/inmemory_name_mapping.go(277)" logger=vpp-ifplugin.if-descriptor
o----------------------------------------------------------------------------------------------------------------------o
  * executed operations (2020-10-08 20:02:09.947 +0000 UTC -> 2020-10-08 20:02:09.97 +0000 UTC, dur: 24ms):
      1. CREATE [OBTAINED]:
          - key: linux/interface/host-name/client-b0518374
          - value: <EMPTY> 
      2. CREATE [WAS-PENDING]:
          - key: config/vpp/v2/interfaces/client-b0518374-ba46-402b-9aba-5d37cd6f8584
          - value: { name:"client-b0518374-ba46-402b-9aba-5d37cd6f8584"  type:AF_PACKET  enabled:true  rx_modes:{mode:ADAPTIVE}  afpacket:{host_if_name:"client-b0518374"} } 
      3. CREATE [DERIVED NOOP IS-PENDING]:
          - key: vpp/interface/client-b0518374-ba46-402b-9aba-5d37cd6f8584/rx-modes
          - value: { name:"client-b0518374-ba46-402b-9aba-5d37cd6f8584"  type:AF_PACKET  rx_modes:{mode:ADAPTIVE} } 
x----------------------------------------------------------------------------------------------------------------------x
| #2 - SBNotification                                                                                        took 24ms |
x----------------------------------------------------------------------------------------------------------------------x

time="2020-10-08 20:02:09.97063" level=info msg="Transaction 2 successful!" loc="kvscheduler/txn_process.go(405)" logger=kvscheduler

EDIT: Okay, I think I found the cause... 💥 there is some forced delay for linux notifications: https://github.com/ligato/vpp-agent/blob/master/plugins/linux/ifplugin/descriptor/watcher.go#L42

I will figure out how to get rid of it, either by ignoring the inter-stages or something, but not today.. getting too late for me. I will let you know next week.

edwarnicke commented 4 years ago

Interesting... for my own edification... how do I reconcile the 426ms difference between:

time="2020-10-08 20:02:09.55478" level=info msg="Transaction 1 successful!" loc="kvscheduler/txn_process.go(405)" logger=kvscheduler

and

time="2020-10-08 20:02:09.97063" level=info msg="Transaction 2 successful!" loc="kvscheduler/txn_process.go(405)" logger=kvscheduler

With

x----------------------------------------------------------------------------------------------------------------------x
| #2 - SBNotification                                                                                        took 24ms |
x----------------------------------------------------------------------------------------------------------------------x
ondrej-fabry commented 4 years ago

@edwarnicke because there is time between transactions.. and if there is no transaction in the queue.. there is nothing to do..

edwarnicke commented 4 years ago

EDIT: Okay, I think I found the cause... 💥 there is some forced delay for linux notifications: https://github.com/ligato/vpp-agent/blob/master/plugins/linux/ifplugin/descriptor/watcher.go#L42

Woohoo! That looks like exactly the thing :)

I will figure out how to get rid of it, either by ignoring the inter-stages or something, but not today.. getting too late for me. I will let you know next week.

I appreciate your patience working through this with me. Enjoy a well deserved rest :)

ondrej-fabry commented 4 years ago

@edwarnicke Just merged PR #1742 that should fix this, please test the latest image and let me know the outcome.

ondrej-fabry commented 3 years ago

Closing due inactivity. Issue has been fixed already. If you continue to have some problems please open new issue.