<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Do you run with high debug value (lot of log messages)? Because I
      don't get similar results to yours. Maybe you can share full
      kamailio.cfg and lua script for both cases.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 12.11.19 22:11, GG GG wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAO=zBEcVLtNEgGbVmtA5LrjvM1CeeEgm+5ZK+s5T8K6j2qVa3A@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>Hello,</div>
        <div><br>
        </div>
        <div>I removed KSR.x.exit() and I got same results for cpu usage
          and Recv-Q.</div>
        <br>
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">On Tue, Nov 12, 2019 at 3:56
            PM Daniel-Constantin Mierla <<a
              href="mailto:miconda@gmail.com" moz-do-not-send="true">miconda@gmail.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 bgcolor="#FFFFFF">
              <p>Hello,</p>
              <p>can you remove the KSR.x.exit() and test again? It will
                be the same effect from sip routing point of view, just
                to see what is the result.</p>
              <p>Because Lua 'exit' cannot be used, KSR.x.exit() is a
                workaround relying on error/exception handling with
                string comparison that I did.</p>
              <p>However, overall KSR.x.exit() alone has an
                insignificant effect on a production configuration,
                based on the tests I did for kamailio 5.2, you can look
                for more at:</p>
              <p>  - <a
                  href="https://www.kamailio.org/wiki/kemi/performance-tests/5.2.x"
                  target="_blank" moz-do-not-send="true">https://www.kamailio.org/wiki/kemi/performance-tests/5.2.x</a></p>
              <p>Cheers,<br>
                Daniel<br>
              </p>
              <div>On 12.11.19 21:28, GG GG wrote:<br>
              </div>
              <blockquote type="cite">
                <div dir="ltr">
                  <div>Hi Daniel,</div>
                  <div><br>
                  </div>
                  <div>For lua example, it's just an error when writing
                    my email... in my config file I have KSR.x.exit();</div>
                  <div>I have not tested a more complex config, but I'm
                    curious about kemi framework and how it works. So
                    before anything else I made a simple test to know
                    the cpu overhead.</div>
                  <div>For this test, I noticed that the Recv-Q of
                    kamailio remains high with kemi/lua, and with the
                    native one remains to 0, with children=1 of course.</div>
                  <div>Next step, is to use a more complex config file.</div>
                  <br>
                  <div class="gmail_quote">
                    <div dir="ltr" class="gmail_attr">On Tue, Nov 12,
                      2019 at 3:00 PM Daniel-Constantin Mierla <<a
                        href="mailto:miconda@gmail.com" target="_blank"
                        moz-do-not-send="true">miconda@gmail.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 bgcolor="#FFFFFF">
                        <p>Hello,</p>
                        <p>is it really just 'exit' in the
                          ksr_core_received()? Because that should shut
                          down kamailio.</p>
                        <p>Anyhow, practically with the examples here,
                          you test the difference between looking up a
                          function and doing exit in native kamailio.cfg
                          and lua script, which is really marginal
                          comparing with the rest of configuration file
                          in a usual production deployment. Have you
                          tested with a more complex set of
                          actions/functions?</p>
                        <p>Cheers,<br>
                          Daniel<br>
                        </p>
                        <div>On 12.11.19 17:36, GG GG wrote:<br>
                        </div>
                        <blockquote type="cite">
                          <div dir="ltr">Hi!
                            <div><br>
                              <div>I just made a simple test performance
                                between native script and kemi/lua with
                                the event_route[core:msg-received]
                                callback.</div>
                            </div>
                            <div><br>
                            </div>
                            <div># lua script children=1
                              cpu.process=100%</div>
                            <div>function ksr_core_received()<br>
                            </div>
                            <div>  exit;</div>
                            <div>end</div>
                            <div><br>
                            </div>
                            <div># native script children=1
                              cpu.process=70%</div>
                            <div>event_route[core:msg-received] {</div>
                            <div>  exit;</div>
                            <div>}<br>
                            </div>
                            <div><br>
                            </div>
                            <div># tested with udp 5060, 1000 Mbits/sec</div>
                            <div>iperf -c 127.0.0.1 -p 5060 -u -b1000m</div>
                            <div><br>
                            </div>
                            <div>I don't know if it's normal and what we
                              should expect from kemi, but I would like
                              to share this with you. Maybe someone
                              could confirm the performance difference.</div>
                            <div><br>
                            </div>
                            <div>Have a good day !</div>
                          </div>
                          <br>
                          <fieldset></fieldset>
                          <pre>_______________________________________________
Kamailio (SER) - Users Mailing List
<a href="mailto:sr-users@lists.kamailio.org" target="_blank" moz-do-not-send="true">sr-users@lists.kamailio.org</a>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
                        </blockquote>
                        <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank" moz-do-not-send="true">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Kamailio World Conference - April 27-29, 2020, in Berlin -- <a href="http://www.kamailioworld.com" target="_blank" moz-do-not-send="true">www.kamailioworld.com</a></pre>
                      </div>
                    </blockquote>
                  </div>
                </div>
              </blockquote>
              <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank" moz-do-not-send="true">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Kamailio World Conference - April 27-29, 2020, in Berlin -- <a href="http://www.kamailioworld.com" target="_blank" moz-do-not-send="true">www.kamailioworld.com</a></pre>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio World Conference - April 27-29, 2020, in Berlin -- <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>