[SR-Users] Performance tests of native vs. kemi scripting for SIP routing

Daniel-Constantin Mierla miconda at gmail.com
Tue Dec 11 17:00:06 CET 2018

Thanks for the feedback!

Regarding an official recommended kemi language, I think it would rather
hard to do it, because it can be an opinionated choice for each developer.

I am more or less going for Lua if it's only about me. It is a small
interpreter, with a fair large set of extensions and good docs/community
out there.

However, many companies I work with have Python dev teams, rather than
Lua. So if they want Python, I help them to build the SIP routing logic
in it. But again, it is not a language I use often myself. Of course,
the ecosystem around Python is enormous comparing with Lua (community,
docs, extensions, ...).

Ruby was requested at last Kamailio World Conference edition and proved
to be easy to write the module for it, so I did it. It is the one I
tested the least so far.

JavaScript was added because embedding the JS duktape interpreter is
more or less like embedding Lua (same approach and similar api -- kind
of only different data type names and function names). However, this I
did it because I wanted to have an established scripting language (so
people can learn easily the syntax and the basics of the language)
without depending on external libs. That's why ducktape JS interpreter
code in imported in app_jsdt module (they recommend this way anyhow).
This is like a fist choice when one just need script reload without restart.

Squirrel support was added more for didactic purposes, it has the same
embedding API like Lua (and ducktape). Being small, can be used as a
module to learn how to develop another KEMI interpreter module. It can
be also an option for using with embedded devices, the code for its
interpreter (which is also imported in kamailio module app_sqlang) is
really small comparing with duktape. But then, JavaScript is a more
complex and complete language.

The fact is that apart of KSR.x and KSR.pv sub-modules, all the
functions/sub-modules exported by KSR are exactly the same in any of
these KEMI scripting languages -- read it like it is the exact same c
code running behind these functions, no matter which kemi scripting
language you use.



On 11.12.18 16:09, Samuel F. wrote:
> Thanks Daniel, very interesting!
> We are running four production instances with Kemi Python v2 and will
> launch two more instances starting next month on Python v3.
> So far Python v2 has worked flawlessly!
> As a side note, would be great to have a official recommended language
> for KEMI so other devs can share modules/codes/tutorials etc.. having
> too many languages, in my opinion, reduces the benefit a community can
> provide.
> All the best,
> Samuel
> ------------------------------------------------------------------------
> *From:* sr-users <sr-users-bounces at lists.kamailio.org> on behalf of
> Daniel-Constantin Mierla <miconda at gmail.com>
> *Sent:* Tuesday, December 11, 2018 09:30
> *To:* Kamailio (SER) - Users Mailing List; Kamailio (SER) - Devel
> Mailing List; business at lists.kamailio.org
> *Subject:* [SR-Users] Performance tests of native vs. kemi scripting
> for SIP routing
> Hello,
> during the preparations of Kamailio v5.2.0 and the days after, I got the
> time to run some tests in order to see the differences of running
> similar SIP routing logic when using native configuration file scripting
> versus KEMI languages. So far I did it for Lua and Python (v2),
> hopefully I will find time to run also for the rest of supported
> scripting languages: Python (v3), JavaScript, Ruby, Squrrel and Lua with
> LuaJIT.
> The pleasant surprise was to see that this time, the results of using
> Python were similar to native scripting and Lua. When I did some basic
> tests during development of KEMI, using Python seemed slower.
> More details about how tests were performed, the config files/scripts,
> used tools and results were published in a wiki page:
>   -
> https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwiki%2Fkemi%2Fperformance-tests%2F5.2.x&data=02%7C01%7C%7Ca073cd176b784611f1a908d65f434965%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636801139925397334&sdata=GdUdX%2BjUgpJydYvBxP%2BChGbzD4qCJK%2BWJ7fFPNEYeOs%3D&reserved=0
> A news article with further details is on kamailio website:
>   -
> https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fw%2F2018%2F12%2Fperformance-tests-for-kemi-scripting-languages%2F&data=02%7C01%7C%7Ca073cd176b784611f1a908d65f434965%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636801139925397334&sdata=tYxvflkw9hFnVE%2BLe1wqrvvWQ7Nif0E%2F4NeT4hAdTSM%3D&reserved=0
> Should anyhow of you have some time to run the tests in own environment
> and share the results (on sr-users mailing list), it would be
> appreciated and would help to validate the tests and discover if I
> forgot something in any of the configs. Note that the goal of the tests
> is not measuring the capacity of Kamailio in your environment, but see
> the differences between using different scripting languages in the same
> environment (so you can do the tests on raspberry pi, if you like).
> I would also be interested in knowing if you are using Kamailio with
> KEMI or you are planning to, if yes, which scripting language. If
> already doing it, is already in production? These are useful to plan
> where to allocate developer resources in the future...
> And to start, I am running Kamailio with Lua (4 instances) and Python
> (1) scripting in production deployments, with very good results so far.
> Cheers,
> Daniel
> -- 
> Daniel-Constantin Mierla --
> https://nam04.safelinks.protection.outlook.com/?url=www.asipto.com&data=02%7C01%7C%7Ca073cd176b784611f1a908d65f434965%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636801139925397334&sdata=vn1TxHaSsjR3gbvq5Gpw53%2BvJigcdrefxvEy163La8g%3D&reserved=0
> https://nam04.safelinks.protection.outlook.com/?url=www.twitter.com%2Fmiconda&data=02%7C01%7C%7Ca073cd176b784611f1a908d65f434965%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636801139925397334&sdata=30E7Ww%2BigG3Rzbwi4j%2BIqjF4TpUqfnYYMspLhPQAvP0%3D&reserved=0
> --
> https://nam04.safelinks.protection.outlook.com/?url=www.linkedin.com%2Fin%2Fmiconda&data=02%7C01%7C%7Ca073cd176b784611f1a908d65f434965%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636801139925397334&sdata=XEjKBjIq9eANmHr8KeEQXlB1HLR8Tn%2BVwoNtkMz2G%2Fg%3D&reserved=0
> Kamailio World Conference - May 6-8, 2019 --
> https://nam04.safelinks.protection.outlook.com/?url=www.kamailioworld.com&data=02%7C01%7C%7Ca073cd176b784611f1a908d65f434965%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636801139925397334&sdata=k5%2BSGddS3uWGMX7%2Fnyt13EBNrFcqqRYU%2FggS0EapwEw%3D&reserved=0
> Kamailio Advanced Training --
> https://nam04.safelinks.protection.outlook.com/?url=www.asipto.com&data=02%7C01%7C%7Ca073cd176b784611f1a908d65f434965%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636801139925397334&sdata=vn1TxHaSsjR3gbvq5Gpw53%2BvJigcdrefxvEy163La8g%3D&reserved=0
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=02%7C01%7C%7Ca073cd176b784611f1a908d65f434965%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636801139925397334&sdata=VuoEwq7PaEC3BYsGPgaRuXiLvJ%2B%2FTGi790ht1E9wvdY%3D&reserved=0

Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - May 6-8, 2019 -- www.kamailioworld.com
Kamailio Advanced Training -- www.asipto.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20181211/923d34cf/attachment.html>

More information about the sr-users mailing list