performance issues freeradius 2.1.12
hi i have around 10k users, i am creating a module for each acct-status-type and this module will call a php script in the accounting section, it is as follow if(Acct-Status-Type == "Start") { user-start } elsif (Acct-Status-Type == "Interim-Update") { user-interm-update } elsif(Acct-Status-Type == "Stop") { user-stop } is this a good design or there is a better one?? everything is working perfect, i have around 15 mikrotik nases, but sometimes i am receiving an error in the radius.log which is receiving conflicting packets , and the error is always from a specific nas i.e nas10, is it the nas that is not receiving the packet from the server or my server is slow, my database is well indexed + i am using an SSD hardisk
Hi,
On 30/03/2016, at 12:26, khouzam yaghi <khouzam.yaghi@gmail.com> wrote:
hi i have around 10k users, i am creating a module for each acct-status-type and this module will call a php script in the accounting section, it is as follow
It’s not “bad", but calling a PHP script will mean it spins up the PHP interpreter each time you get an accounting packet. If you do maybe a handful per second, then that won’t be too much of a problem. If you are doing lots, it will be. Are your 10k users online at the same time? What is your interim update timer? What rate do users re-connect (which generates auth and accounting start/stop)? Or put another way, how many times per second are you getting accounting messages, and calling the PHP interpreter? If you absolutely must use PHP then perhaps there’s some other way you can call it, or perhaps you can re-write your logic in Python or Perl, both of which there are freeradius modules for - this would reduce the incredible overhead of loading the interpreter and parsing the script each time. It’s an unusual design, however. Typically (based on installations I have worked on) you want to keep all your logic in FreeRADIUS/unlang, write stuff to databases, and then have some non-real time script process it from there. If you were at the limits of what you could do in unlang/SQL, then there are patterns you can use to use a pool of backend servers etc. etc. - however in your case with a very small installation, you should fix how the logic works first. -- Nathan Ward
Hi,
hi i have around 10k users, i am creating a module for each acct-status-type and this module will call a php script in the accounting section, it is as follow
what does the PHP script do? any time you fire up an external script there is a performance hit. (and does this need to be done in 100% real time? you could use eg buffered-sql virtual server and run these things in almost real time with no hit to the real-time authentication...?)? alan
the php script calculate the overall quota for the user, the monthly and the daily , each time i got an interim update for a user i added the acctinputoctet and acctoutputoctet to the monthly and daily quota (daily quota is to be reset everyday at 12 midnight) and it checks if the users exceeds his daily or monthly quota it will decrease his speed as specified in the database, the script also take care of the free time, if the isp specify a freetime , the server will not add the acctinputoctet and acctoutputoctet to the quota at freetime. is it better to use perl instead of php or what do you think is better?? what about receiving conflicting packets error (only from one nas out of 15 nases). is it the nas that is overloaded or the server is slow? On Wed, Mar 30, 2016 at 10:12 AM, <A.L.M.Buxey@lboro.ac.uk> wrote:
Hi,
hi i have around 10k users, i am creating a module for each acct-status-type and this module will call a php script in the accounting section, it is as follow
what does the PHP script do? any time you fire up an external script there is a performance hit.
(and does this need to be done in 100% real time? you could use eg buffered-sql virtual server and run these things in almost real time with no hit to the real-time authentication...?)?
alan - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Hi,
On 30/03/2016, at 22:47, khouzam yaghi <khouzam.yaghi@gmail.com> wrote:
the php script calculate the overall quota for the user, the monthly and the daily , each time i got an interim update for a user i added the acctinputoctet and acctoutputoctet to the monthly and daily quota (daily quota is to be reset everyday at 12 midnight) and it checks if the users exceeds his daily or monthly quota it will decrease his speed as specified in the database, the script also take care of the free time, if the isp specify a freetime , the server will not add the acctinputoctet and acctoutputoctet to the quota at freetime.
is it better to use perl instead of php or what do you think is better??
These things could be done directly with SQL to your database, which is what I’d do.
what about receiving conflicting packets error (only from one nas out of 15 nases). is it the nas that is overloaded or the server is slow?
I don’t have enough information to answer that. It’s strange that it’s only that NAS, but, maybe that NAS just happens to be busy so there’s more chance it happens there. Is the server replying before the NAS retransmits the request packet? That would probably indicate packet loss in the downstream direction towards the NAS. Perhaps you can post a debug of this happening. -- Nathan Ward
On Mar 30, 2016, at 5:47 AM, khouzam yaghi <khouzam.yaghi@gmail.com> wrote:
the php script calculate the overall quota for the user, the monthly and the daily , each time i got an interim update for a user i added the acctinputoctet and acctoutputoctet to the monthly and daily quota (daily quota is to be reset everyday at 12 midnight) and it checks if the users exceeds his daily or monthly quota it will decrease his speed as specified in the database, the script also take care of the free time, if the isp specify a freetime , the server will not add the acctinputoctet and acctoutputoctet to the quota at free time.
You can probably do all of that in "unlang" or Perl.
is it better to use perl instead of php or what do you think is better??
The server has support for native Perl scripts, which will be a LOT faster than running an external PHP script for every packet.
what about receiving conflicting packets error (only from one nas out of 15 nases). is it the nas that is overloaded or the server is slow?
It means that the server is slow. Your PHP script is slow. And the database queries it does are probably slow. You'll need to fix all of that. Alan DeKok.
Hi Everyone, How the simultaneous-use check works? When FreeRadius receives an Authentication NAS Pack, it uses checkrad or queries to check if user is on or not? Thanks Aurelio
participants (5)
-
A.L.M.Buxey@lboro.ac.uk -
Alan DeKok -
Aurélio de Souza Ribeiro Neto -
khouzam yaghi -
Nathan Ward