Did you do each thing alone too to tell the difference?<br>-hp alone, disable monotonic alone (i did not see you mention the disable monotonic)<br><br>as for your 4ms thing, yes we require high resolution timing, if we ask to sleep 1000 microseconds that is what we need it to sleep for or at least as close as possible, and the main reason that thread is never sleeping is because you can&#39;t actually count on it to run every 1ms but you mostly can.  Hence the whole philosophy on only making 1 thread run hot all the time to ensure that the rest don&#39;t have to repeat the same algorithm.  We focus on high end performance this was the point of your experimentation because we will need to use a compile time defines and other logic to make it more efficient on your platform, a platform which we are not using.  I am curious what would happen if you install Kristian&#39;s astlinux on one of your devices, i think you should also compare the kernel versions.<br>
 <br><br>What OS are you running anyway?<br><br>Here are some more things to try (running plain trunk with no mods) do these systematically each alone and all together with/without -hp or disable monotonic etc to see what different combos create<br>
<br>comment out this line (line 10)<br>#define DISABLE_1MS_COND<br><br>rebuild, this tells it to run a conditional at 1ms in the same timer thread which will make all the switch_cond_next share a 1ms conditional instead of doing microsleeps <br>
<br>next <br><br>some kernels/devices work better using select(0) for sleep where others work better using usleep.<br>comment out line 109 <br>apr_sleep(t);<br><br>and try <br>usleep(t)<br><br>also mac works better using nanosleep so you could try changing it so it<br>
uses the code starting at 101 instead.<br><br><br>also your claim about JS should be investigated because I do not think it should be the case.<br>but you may want to move this to a jira <a href="http://jira.freeswitch.org">http://jira.freeswitch.org</a><br>
<br>As for the asterisk comparison,<br>not sure how to answer you, that&#39;s your decision.<br><br><br><br><div class="gmail_quote">On Mon, Dec 7, 2009 at 9:28 AM, eaf <span dir="ltr">&lt;<a href="mailto:erandr-junk@usa.net">erandr-junk@usa.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Here is what I found...<br>
<br>
I tried high-priority scheduling as per your suggestion, reniced the program<br>
explicitly, rewrote timer thread to sleep on cond. variable and activate<br>
only when there are timers and only when the timer actually had to be<br>
clicked, turned off SQL thread and removed polling from sofia profile<br>
thread.<br>
<br>
That pretty much eliminated all idle 1ms sleepers that were there except for<br>
three in sofia itself (su_epoll_port). And when I was about to be happy, I<br>
found that two outgoing calls through my VOIP providers when bridged<br>
together showed terrible distortions. I undid all my changes, tried 1.0.4,<br>
trunk (noticed btw that when I bridge two calls via loopback in JS in the<br>
trunk I must keep JS running, or the calls get terminated - NOT the same as<br>
in 1.0.4 where exitting JS left calls running), got pretty much the same sad<br>
results. At the same time calls bridged by freeswitch between LAN and any of<br>
the VOIP providers behaved just fine. And calls bridged by Asterisk any way<br>
were fine too. So that pretty much looked like the end of the freeswitch<br>
trials for me.<br>
<br>
But then I timed your code, mine and found that all those 1ms sleeps that<br>
your timer thread was doing (and all those pollers were doing as well) were<br>
actually 4ms sleeps because you know what unless kernel is configured with<br>
HZ=1000, you can&#39;t sleep for less than 4ms (HZ=250) or perhaps even 10ms<br>
(HZ=100). Mine was 250.<br>
<br>
This actually meant that the original timer thread was firing once, sleeping<br>
for 4ms, firing 3 more times back-to-back, sleeping for 4ms more, firing 4<br>
times back-to-back, etc. It was still firing 20ms timers on time, but 30ms<br>
ones of course were not, since 30ms doesn&#39;t divide by 4 evenly. Plus whoever<br>
relied on runtime.reference or switch_micro_time_now() were kind of screwed<br>
because both were running jumpy. Plus whoever assumed that apr_sleep(1000)<br>
or cond_yield() was sleeping for 1ms were also in for a surprise. It felt<br>
satisfying to find that, however it didn&#39;t explain why the same distortions<br>
were observed with rewritten timer thread and disabled RTP timers.<br>
<br>
Anyway, I sighed (pretty much like you) and recompiled the kernel with<br>
HZ=1000. Recompiling kernel on these ALIX boards is fun. If smth goes south,<br>
you need to hook up serial console and see what the heck went wrong.<br>
<br>
That eliminated distortions, ha! But made freeswitch more CPU hungry. Now<br>
the remaining 1ms threads sitting in sofia epoll were really polling for<br>
1ms, not 4, and freeswitch was consistently sitting in the first line of the<br>
top chart showing 3% CPU utilization when idle.<br>
<br>
Don&#39;t know whether it&#39;s because of the remaining epolls in sofia or whether<br>
it&#39;s because there are still some threads left in freeswitch that I<br>
neglected to change because they were sleeping with 100ms interval, so I<br>
figured, who cares. Maybe when all things come together (sofia, 100ms*N)<br>
freeswitch ends up spending 3% of CPU while doing pretty much nothing.<br>
<br>
Btw, compared with Asterisk, the latter is not even visible on the first<br>
top&#39;s screen and spends 1% CPU when bridging two G711 calls and recording<br>
them to disk.<br>
<br>
So, at this time I have both original Asterisk and FS setups running. One is<br>
seemless but clumsy in configuration, the other one is neat and stylish but<br>
too preoccupied with smth... Should I look into sofia epollers? That&#39;s kind<br>
of deep in the code. Or should I just stick with Asterisk?<br>
<div><div></div><div class="h5"><br>
<br>
<br>
<br>
<br>
Anthony Minessale-2 wrote:<br>
&gt;<br>
&gt; There is another user here with a 300mhz box.  I am willing to investigate<br>
&gt; this improved performance for weak devices but I need to do it in a sane<br>
&gt; cross-platform way.<br>
&gt;<br>
&gt;<br>
&gt; On Fri, Dec 4, 2009 at 1:32 PM, Yossi Neiman<br>
&gt; &lt;<a href="mailto:freeswitch@cartissolutions.com">freeswitch@cartissolutions.com</a><br>
&gt;&gt; wrote:<br>
&gt;<br>
&gt;&gt; A word to the wise to the general FreeSWITCH community:  If Anthony<br>
&gt;&gt; Minessale suggests that you try to do any number of things, it&#39;s a very<br>
&gt;&gt; good idea to try all those ideas before continuing on.  I&#39;ve known him,<br>
&gt;&gt; MikeJ, and bkw for several years, and they almost always have very good<br>
&gt;&gt; ideas as to troubleshoot a problem in FreeSWITCH.  It&#39;s extremely<br>
&gt;&gt; frustrating to try to help people out who won&#39;t try the provided<br>
&gt;&gt; suggestions first.<br>
&gt;&gt;<br>
&gt;&gt; And note directly to &quot;eaf&quot; - bogomips is quite possibly the least<br>
&gt;&gt; significant bit of data about a cpu that you will get out of<br>
&gt;&gt; /proc/cpuinfo...  The name itself - bogo, means bogus.<br>
&gt;&gt; <a href="http://en.wikipedia.org/wiki/Bogomips" target="_blank">http://en.wikipedia.org/wiki/Bogomips</a><br>
&gt;&gt;<br>
&gt;&gt; -Yossi<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; FreeSWITCH-users mailing list<br>
&gt;&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
&gt;&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt;&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt;&gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Anthony Minessale II<br>
&gt;<br>
&gt; FreeSWITCH <a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org/</a><br>
&gt; ClueCon <a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com/</a><br>
&gt; Twitter: <a href="http://twitter.com/FreeSWITCH_wire" target="_blank">http://twitter.com/FreeSWITCH_wire</a><br>
&gt;<br>
&gt; AIM: anthm<br>
</div></div>&gt; <a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a> &lt;<a href="mailto:MSN%253Aanthony_minessale@hotmail.com">MSN%3Aanthony_minessale@hotmail.com</a>&gt;<br>
&gt; GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a>&lt;<a href="mailto:PAYPAL%253Aanthony.minessale@gmail.com">PAYPAL%3Aanthony.minessale@gmail.com</a>&gt;<br>
<div class="im">&gt; IRC: <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> #freeswitch<br>
&gt;<br>
&gt; FreeSWITCH Developer Conference<br>
</div>&gt; <a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a> &lt;<a href="mailto:sip%253A888@conference.freeswitch.org">sip%3A888@conference.freeswitch.org</a>&gt;<br>
<div class="im">&gt; <a href="http://iax:guest@conference.freeswitch.org/888" target="_blank">iax:guest@conference.freeswitch.org/888</a><br>
</div>&gt; <a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a>&lt;<a href="mailto:googletalk%253Aconf%252B888@conference.freeswitch.org">googletalk%3Aconf%2B888@conference.freeswitch.org</a>&gt;<br>

&gt; pstn:213-799-1400<br>
&gt;<br>
<div class="im">&gt; _______________________________________________<br>
&gt; FreeSWITCH-users mailing list<br>
&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
&gt;<br>
&gt;<br>
<br>
--<br>
</div>View this message in context: <a href="http://old.nabble.com/Choppy-sound-with-PCMU-tp26594250p26678873.html" target="_blank">http://old.nabble.com/Choppy-sound-with-PCMU-tp26594250p26678873.html</a><br>
<div class="im">Sent from the Freeswitch-users mailing list archive at Nabble.com.<br>
<br>
<br>
_______________________________________________<br>
</div><div><div></div><div class="h5">FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="http://iax:guest@conference.freeswitch.org/888">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:213-799-1400<br>