<div style="font-family: arial; font-size: 12px;"><div>Sorry for the top post here.</div><div><br></div><div>Joshua, Thanks for the info. I can confirm adding</div><div><br>identify/cache = memory_cache,object_lifetime_stale=600,object_lifetime_maximum=1800,expire_on_reload=yes,full_backend_cache=yes </div><div><br></div><div>ABOVE</div><div><br></div><div>identify = realtime,ps_endpoint_id_ips</div><div><br></div><div>in Sorcery.conf has resolved this issue. I can also confirm that simple memory_cache was not enough. full_backend_cache=yes was indeed required as you suspected. Thanks!</div><div><br></div><div contenteditable="false"><div><strong>Nick Olsen</strong></div><div>Network Engineer</div><div>Office: 321-408-5000</div><div>Mobile: 321-794-0763<br><img src="http://dl.floridavirtualsolutions.com/emaillogo/logo.png" class="fr-fic fr-dii fr-fil"></div></div><div><br></div><hr id="previousmessagehr"><div><span><strong>From</strong>: "Joshua C. Colp" <jcolp@digium.com><br><strong>Sent</strong>: 5/16/19 1:59 PM<br><strong>To</strong>: asterisk-users@lists.digium.com<br><strong>Subject</strong>: Re: [asterisk-users] PJSIP call Delay DNS/Realtime</span></div><div>On Thu, May 16, 2019, at 2:57 PM, Joshua C. Colp wrote:</div><div>> On Thu, May 16, 2019, at 2:54 PM, Nick Olsen wrote:</div><div>> > Hello all,</div><div>> ></div><div>> > I'm migrating a box from PJSIP with normal Flatfiles to ODBC/Realtime,</div><div>> > Also 16.0.1 to 16.3.0. After adding a few peers to the new RT box, I</div><div>> > noticed a delay in call processing. All I had done thus far is added a</div><div>> > few endpoints for upstream carriers, And one downstream for the legacy</div><div>> > PBX it was replacing. After a bit of troubleshooting I found the issue</div><div>> > to be related to having the identify section matching a domain name</div><div>> > (Instead of an IP). Each endpoint with match=domain.name.here (The</div><div>> > specific name didn't really matter) added a bit of noticeable latency.</div><div>> > Once you were up to 4-5 of them, It was a ~5 second delay from the time</div><div>> > the invite came in until the time the call was routed and stood up with</div><div>> > audio. Even when you were routing between unrelated (non-dns matched)</div><div>> > endpoints. Looking at the debug logs, It seems like Asterisk looks</div><div>> > these peers up on some kind of time interval. As well as during _every_</div><div>> > inbound call. This also explains why the delay increased with every</div><div>> > single DNS based endpoint I added. Each extra peer means another DNS</div><div>> > lookup and process.</div><div>> ></div><div>> > To further test my theory, I stood up a local caching DNS resolver and</div><div>> > this significantly improved the delay. But it was still ~1 second with</div><div>> > 5 DNS based endpoints. Even with a caching resolver, This doesn't</div><div>> > scale. Doing a large number (and growing with scale) of DNS lookups for</div><div>> > every call (Maybe even every packet) just doesn't fly.</div><div>> ></div><div>> > So my questions are:</div><div>> > 1. Anyone have any idea why asterisk does this when using realtime but</div><div>> > NOT when using flatfiles?</div><div>></div><div>> Unless you configure caching for the objects[1] then every time the</div><div>> identify object is pulled from the database it has to be looked up and</div><div>> resolved.</div><div><br></div><div>Oh, and it would need to be full backend caching. Just per-object caching doesn't do the trick because in order to iterate over all the identifies, you need all of them including any uncached ones. The full backend caching on the other hand caches everything so if I recall it doesn't hit the backend in that case.</div><div><br></div><div>--</div><div>Joshua C. Colp</div><div>Digium - A Sangoma Company | Senior Software Developer</div><div>445 Jan Davis Drive NW - Huntsville, AL 35806 - US</div><div>Check us out at: <a href="http://www.digium.com" target="_blank"><a target="_blank" href="http://www.digium.com">www.digium.com</a></a> & <a href="http://www.asterisk.org" target="_blank"><a target="_blank" href="http://www.asterisk.org">www.asterisk.org</a></a></div><div><br></div><div>--</div><div>_____________________________________________________________________</div><div>-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --</div><div><br></div><div>Check out the new Asterisk community forum at: <a href="https://community.asterisk.org" target="_blank">https://community.asterisk.org</a>/</div><div><br></div><div>New to Asterisk? Start here:</div><div><a href="https://wiki.asterisk.org/wiki/display/AST/Getting+Started" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Getting+Started</a></div><div><br></div><div>asterisk-users mailing list</div><div>To UNSUBSCRIBE or update options visit:</div><div><a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a></div></div>