Perl vs. python vs. Lua?
Alan DeKok
aland at deployingradius.com
Tue Feb 27 15:09:02 CET 2018
On Feb 27, 2018, at 8:57 AM, Dom Latter <freeradius-users at latter.org> wrote:
> So performance wise it's similar?
TBH, Python is probably slower than Perl. The Perl interpreter is threaded, Python isn't. There's a "Big Interpreter Lock" that essentially prevents most multi-threading.
That makes a BIG difference. Which means that the speed of running Perl or Python code itself doesn't matter, since Python spends most of it's time waiting for a lock.
> I should perhaps have mentioned that
> the script needs to connect to the database to check against known MAC
> addresses, send emails to new users, that sort of thing.
Use the native DB query functions in FreeRADIUS. It's MUCH faster that way.
i.e. do any and all DB queries via "update" sections, and assign the values to temporary attributes. Then, run the *logic* in Python. i.e. have the python code do if / then / else checks, but don't have it to DB connectivity.
And if you're sending email, you're MUCH better off doing that out of band. i.e. have FR write the information to a file / DB, etc. Then, another process can read that file and send the email.
Sending the email fro Python code inside of FreeRADIUS means that your RADIUS server will go down as soon as there's a problem with email.
If you're getting no more than 10-20 packets a second, you're probably OK with a "brute-force" approach. But if the traffic spikes much higher than that, you could quickly take your RADIUS server down with "brute-force" programming.
Alan DeKok.
More information about the Freeradius-Users
mailing list