<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 14, 2021 at 9:19 AM Dan Cropp <<a href="mailto:dan@amtelco.com">dan@amtelco.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="EN-US" style="overflow-wrap: break-word;">
<div class="gmail-m_-2442231853580409307WordSection1">
<p class="MsoNormal">Thank you George.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">It is using local file based configuration files.</p></div></div></blockquote><div><br></div><div>Well, that's good at least.  It eliminates the database layer which can be troublesome in virtualized environments, especially if a SAN and/or a remote database server is used.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US" style="overflow-wrap: break-word;"><div class="gmail-m_-2442231853580409307WordSection1"><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Other factors.<u></u><u></u></p>
<p class="MsoNormal">We run Asterisk in realtime mode to allow it to run as fast as possible.</p></div></div></blockquote><div><br></div><div>Running at "realtime" level is usually NOT a good thing for Asterisk and rarely needed when there are adequate resources.  Let's say you have a local DNS resolver running.   If the system is stressed, Asterisk could actually starve the resolver of resources, which then causes Asterisk to back up waiting for DNS resolution to complete.  We've seen this happen when using a database backend for configuration.  Someone thinks "I'll just give Asterisk more resources" forgetting that Asterisk needs the database engine to run.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US" style="overflow-wrap: break-word;"><div class="gmail-m_-2442231853580409307WordSection1"><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I just learned customer upgraded to 24 CPU cores.  Although, I’m not sure they actually assigned 24 physical cores to this machine or just increasing Hyper-V values.<br></p></div></div></blockquote><div><br></div><div>How is this VM's priority versus other VMs on the same cluster?  Just because it has 24 threads doesn't mean it's got 24 threads dedicated.  Does using a realtime priority in the VM trickle down to Hyper-V's hypervisor's resource management algorithms?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US" style="overflow-wrap: break-word;"><div class="gmail-m_-2442231853580409307WordSection1"><p class="MsoNormal">
<br>
<u></u><u></u></p>
<p class="MsoNormal">I will monitor for additional information and see if the customer will allow me to capture a coredump when problems are happening.<u></u><u></u></p>
<p class="MsoNormal">Waiting for them to report an incident.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Here is a small sample of the system right now (24 cores), to the best of my knowledge it’s running fine.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">top -p 1509 -n 1 -H -b<u></u><u></u></p>
<p class="MsoNormal">top - 15:06:32 up  9:06,  2 users,  load average: 6.02, 5.59, 5.26<u></u><u></u></p>
<p class="MsoNormal">Threads: 1709 total,   8 running, 1701 sleeping,   0 stopped,   0 zombie<u></u><u></u></p>
<p class="MsoNormal">%Cpu(s):  3.1 us,  2.5 sy,  0.0 ni, 94.3 id,  0.0 wa,  0.0 hi,  0.1 si,  0.0 st<u></u><u></u></p>
<p class="MsoNormal">KiB Mem : 32143072 total, 29750072 free,  1016132 used,  1376868 buff/cache<u></u><u></u></p>
<p class="MsoNormal">KiB Swap:  8388604 total,  8388604 free,        0 used. 30697060 avail Mem<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">   PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND<u></u><u></u></p>
<p class="MsoNormal">  1830 root     -11   0 13.741g 493680  28828 R 99.9  1.5 174:13.39 asterisk<u></u><u></u></p>
<p class="MsoNormal">  1541 root     -11   0 13.741g 493680  28828 R 14.3  1.5  20:03.30 asterisk<u></u><u></u></p>
<p class="MsoNormal">33601 root     -11   0 13.741g 493680  28828 S  9.5  1.5   0:16.30 asterisk<u></u><u></u></p>
<p class="MsoNormal">46605 root     -11   0 13.741g 493680  28828 S  9.5  1.5   0:30.06 asterisk<u></u><u></u></p>
<p class="MsoNormal">  2295 root     -11   0 13.741g 493680  28828 S  4.8  1.5  12:25.50 asterisk<u></u><u></u></p>
<p class="MsoNormal">  2297 root     -11   0 13.741g 493680  28828 S  4.8  1.5   1:10.59 asterisk</p></div></div></blockquote><div><br></div><div>There's definitely one thread that's pegging a CPU.  If that thread is one of the few "singleton" threads, that can be an issue.  What does "core show taskprocessors" indicate?  Are there any that are hitting their limits?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US" style="overflow-wrap: break-word;"><div class="gmail-m_-2442231853580409307WordSection1"><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> asterisk-users <<a href="mailto:asterisk-users-bounces@lists.digium.com" target="_blank">asterisk-users-bounces@lists.digium.com</a>>
<b>On Behalf Of </b>George Joseph<br>
<b>Sent:</b> Tuesday, September 14, 2021 9:39 AM<br>
<b>To:</b> Asterisk Users Mailing List - Non-Commercial Discussion <<a href="mailto:asterisk-users@lists.digium.com" target="_blank">asterisk-users@lists.digium.com</a>><br>
<b>Subject:</b> Re: [asterisk-users] Large system seeing single CPU core spiking<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Tue, Sep 14, 2021 at 8:07 AM Dan Cropp <<a href="mailto:dan@amtelco.com" target="_blank">dan@amtelco.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">I am working with a very large customer running Asterisk with PJSIP.  Systems total channels have been over 2500 (which includes hundreds of local channels and ConfBridges) when
 the issues occur.<u></u><u></u></p>
<p class="MsoNormal">It’s running on a Hyper-V VM with 12 CPU cores.<u></u><u></u></p>
<p class="MsoNormal">Things work fine most of the time.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">They periodically see 10-30 minute periods where audio starts sounding like jitter buffer type issues.  Can literally have someone spelling their name and a ConfBridge recording
 of it shows the audio is missing a letter or two.<u></u><u></u></p>
<p class="MsoNormal">The odd part is another system (not running Asterisk) was handling these calls previously.  The overall network has plenty of bandwidth (as evidenced by another system able to handle
 the call volume)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">One area that has perplexed us is when using htop, we see a single CPU core will spike to 100%.  Which core does keep changing.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Asterisk is definitely the process using the vast majority of the CPU cycles.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">We recently found a setting on Hyper-V networking SR-IOV which improved things.  Prior to changing this setting, we were seeing SIP OPTIONS packets/responses would occasionally
 take more than 3 seconds causing devices to drop and come back online.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">We have configured a similar system running at Amazon handling far more traffic and can’t get the single CPU core to spike.  Only small static pops during the calls.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">The sheer scale of the system is making it hard to diagnose the problem.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Any thoughts on how to diagnose what is causing the single CPU core to spike?<u></u><u></u></p>
<p class="MsoNormal">Any thoughts on how to diagnose the problem?<u></u><u></u></p>
<p class="MsoNormal">Any other thoughts/comments?<u></u><u></u></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">The first thing I'd do is see where the CPU is spending time: userspace, system, nice, wait, etc.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Is it actually the asterisk process consuming the CPU?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Is Asterisk running with local file-based configs, local database, remote database, etc?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">If call quality is really bad already and your customer agrees, you could try the following the next time it happens...<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> 1. Run "top -p `pidof asterisk` -n 1 -H -b" to get a list of all of Asterisk's threads and their CPU utilization.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> 2. Run ast_coredumper with the --RUNNING option.  This will pause Asterisk while the dump is being generated!<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> 3. See if you can correlate the high cpu thread IDs from the top output to the threads listed in the coredumper's -brief.txt file.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">That _may_ give you an idea of where to look.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Dan<u></u><u></u></p>
</div>
<p class="MsoNormal"><span style="font-size:10pt"><br>
This email is intended only for the use of the party to which it is addressed and may contain information that is privileged, confidential, or protected by law. If you are not the intended recipient you are hereby notified that any dissemination, copying or
 distribution of this email or its contents is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer.
</span><u></u><u></u></p>
</div>
<p class="MsoNormal">-- <br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">
http://www.api-digital.com</a> --<br>
<br>
Check out the new Asterisk community forum at: <a href="https://community.asterisk.org/" target="_blank">
https://community.asterisk.org/</a><br>
<br>
New to Asterisk? Start here:<br>
      <a href="https://wiki.asterisk.org/wiki/display/AST/Getting+Started" target="_blank">
https://wiki.asterisk.org/wiki/display/AST/Getting+Started</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</div>
<span style="font-size:10pt"><br>
This email is intended only for the use of the party to which it is addressed and may contain information that is privileged, confidential, or protected by law. If you are not the intended recipient you are hereby notified that any dissemination, copying or
 distribution of this email or its contents is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer.
</span>
</div>

-- <br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" rel="noreferrer" target="_blank">http://www.api-digital.com</a> --<br>
<br>
Check out the new Asterisk community forum at: <a href="https://community.asterisk.org/" rel="noreferrer" target="_blank">https://community.asterisk.org/</a><br>
<br>
New to Asterisk? Start here:<br>
      <a href="https://wiki.asterisk.org/wiki/display/AST/Getting+Started" rel="noreferrer" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Getting+Started</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" rel="noreferrer" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a></blockquote></div></div>