# Confd 7.1 performance issue with JNC API

**URL:** <https://dmap-community.ductus.global/t/confd-7-1-performance-issue-with-jnc-api/4170>\
**Category:** NETCONF\
**Created:** [August 23, 2022, 6:07am UTC](https://dmap-community.ductus.global/t/confd-7-1-performance-issue-with-jnc-api/4170 "2022-08-23T06:07:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sairamp](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@Sairamp](https://dmap-community.ductus.global/u/Sairamp)\
**Post date:** [August 23, 2022, 6:07am UTC](https://dmap-community.ductus.global/t/confd-7-1-performance-issue-with-jnc-api/4170/1 "2022-08-23T06:07:42Z")

</div>

We are facing issue with confd 7.1, performance is slow for loading config data XML with \>2.5 MB file. Below is the code snippet for RPC request with edit-config.

```auto
String topXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                    + "<rpc xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"1\">" + "<edit-config>" + "<target>" + "<running/>"
                    + "</target>" + 
                    "<default-operation>"+operationType+"</default-operation>\r\n" +
                    "<config>";
            String endXml = " </config>" + "</edit-config>" + "</rpc>";

            String rpc = topXml + snapshot + endXml;
            rpc = rpc.replaceAll("\\s*xmlns\\s*=\"\"", "");
            
            device = getDevice();
            if (device == null) {
                device = getDevice();
                closeDevice = true;
            }
            String reply;           
            NetconfSession netSession = device.getSession(confdIp + "_" + "RPC_SESSION");
            Element rpcData = netSession.rpc(rpc);
	    reply = rpcData.toXMLString();

               <dependency>
			<groupId>org.onosproject</groupId>
			<artifactId>jnc</artifactId>
			<version>1.0</version>
		</dependency>

```

We have enabled trace to the check the request time and resposne time:

```auto
<INFO> 23-Aug-2022::06:42:43.019 confd[58381]: netconf id=21 new ssh session for user "admin" from 127.0.0.1
<INFO> 23-Aug-2022::06:42:43.028 confd[58381]: netconf id=22 new ssh session for user "admin" from 127.0.0.1
<INFO> 23-Aug-2022::06:42:43.042 confd[58381]: netconf id=21 got rpc: {urn:ietf:params:xml:ns:netconf:base:1.0}edit-config attrs: message-id="1"
<INFO> **23-Aug-2022::06:42:54.536** confd[58381]: netconf id=21 edit-config target=running attrs: message-id="1"
<INFO> **23-Aug-2022::06:45:04.592** confd[58381]: netconf id=21 sending rpc-reply, attrs: message-id="1"
<INFO> 23-Aug-2022::06:45:04.615 confd[58381]: netconf id=21 ssh transport closed
<INFO> 23-Aug-2022::06:45:04.616 confd[58381]: netconf id=22 ssh transport closed

```

Please suggest how to improve the config XML load performance.

---

<div class="post-metadata">

**Author:** ![josephm](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@josephm](https://dmap-community.ductus.global/u/josephm)\
**Post date:** [August 23, 2022, 1:25pm UTC](https://dmap-community.ductus.global/t/confd-7-1-performance-issue-with-jnc-api/4170/2 "2022-08-23T13:25:26Z")

</div>

Could be many different things imho, that depends on the managed YANG modules.

Do you have some `must` or `when` statements used? Those, depending on structure can cause long processing time depending on big-O scale of the expressions.

Is there some external db or callpoints/transforms on the managed config nodes?  
Same goes for validation callpoints that you might have etc.

---

<div class="post-metadata">

**Author:** ![Sairamp](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@Sairamp](https://dmap-community.ductus.global/u/Sairamp)\
**Post date:** [August 24, 2022, 11:23am UTC](https://dmap-community.ductus.global/t/confd-7-1-performance-issue-with-jnc-api/4170/3 "2022-08-24T11:23:00Z")

</div>

@josephm Thanks for the reply.

We observed this issue in 7.1 confd version only after upgrading from 6.2.1 with no changes in client code.

Though as you mentioned, for testing i have removed fk refrences in config xml and found that “edit-config” took very less time. But this referenced data can’t be removed at live site.

Can you please suggest how can we improve performance at confd for this scenario.

---

<div class="post-metadata">

**Author:** ![josephm](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@josephm](https://dmap-community.ductus.global/u/josephm)\
**Post date:** [August 24, 2022, 2:57pm UTC](https://dmap-community.ductus.global/t/confd-7-1-performance-issue-with-jnc-api/4170/4 "2022-08-24T14:57:38Z")

</div>

Can you try your scenario with more recent ConfD version?  
There have been some performance updates & fixes since then, and this might be related to one of them.

Not sure if following from ConfD 7.3 fits your YANG models scenario, but it mentions 7.1 explicitly as one having lower perf. (quote from ConfD `CHANGES` file):

```nohighlight
  - confd: The performance of ConfD, when dumping out a big configuration,
    e.g. with NETCONF get-config, on a system with many 'when' statements
    and many top-level nodes, was low in ConfD-7.1 compared to older ConfD
    versions. The performance has now been improved, and expected to be on
    par with older versions.

```
