1

I've installed FreeRADIUS, MySQL and FreeRADIUS management (a web-based app) on the same machine, with both FreeRADIUS and FreeRADIUS management using same user to connect MySQL. My problem is when I make a report from FreeRADIUS managment, it makes MySQL busy and FreeRADIUS can not respond to the request (out of service) until my report query has finished. My question is: How both applications (FreeRADIUS & FreeRADIUS management) run queries on MySQL at same time.

I'm using MyISAM and below is the result of SHOW PROCESSLIST; enter image description here

These are the queries run during SHOW PROCESSLIST;

SELECT count( DISTINCT (username) ) , `nasipaddress` FROM `radacct` 
WHERE (
   acctstarttime < 'First period' 
   AND acctstoptime > 'First period'
   AND acctstoptime <'Second period'
   )
OR (
    acctstarttime > 'First period'
    AND acctstoptime < 'Second period'
   )
OR (
  acctstarttime < 'First period'
  AND acctstoptime > 'Second period'
 )
OR (
  acctstarttime > 'First period'
  AND acctstarttime < 'Second period'
  AND acctstoptime > 'Second period'
 )
OR (
    acctstarttime < 'First period'
    AND acctstoptime IS NULL
    )
OR (
  acctstarttime > 'First period'
  AND acctstarttime <'Second period'
  AND acctstoptime IS NULL
 )
GROUP BY `nasipaddress`

-----------------------------------------
SELECT SUM(AcctSessionTime), SUM(AcctOutputOctets), SUM(AcctInputOctets) 
FROM radacct
WHERE username='xxx'
-----------------------------------------

UPDATE radacct
      SET 
     nasipaddress = '192.168.1.2', 
         framedipaddress = '10.10.10.2', 
         acctsessiontime     = '200', 
         acctinputoctets     = '8263'
         acctoutputoctets    = '310'
      WHERE acctsessionid = 'FD324A12' 
      AND username        = 'yyy' 
      AND nasipaddress    = '192.168.1.2'"
Robert Gannon
  • 434
  • 3
  • 10
JOGOOL
  • 13
  • 4

1 Answers1

0

Not really an answer, but too big for a comment. This is quite a specialised question and would probably (IMHO) be better off asked on the FreeRadius mailing lists.

I looked here and found this

FreeRADIUS is a high-performance and highly configurable RADIUS server. It supports many database back-ends such as flat-text files, SQL, LDAP, Perl, Python, etc.

The problem with many systems which support multiple back-ends is that they end up not being optimised for any of them - it's possible that something in their code conflicts with MySQL's way of doing things. And I'm not even sure what a "Perl, Python, etc." back-end is - drivers?

From here, it appears to me that the default database is PostgreSQL and it's possible that scenarios which work with PostgreSQL either don't work or work poorly with MySQL. So, my second suggestion is to try that RDBMS (which, in any case, is superior to MySQL IMHO).

[EDIT] in response to the OP's queries.

Just out of curiosity - what are the response times of those queries when run separately? Second, the issue appears to be a lock on the radacct table. This is a problem with MyISAM tables which your system uses.

Could you take a dump of your schema using mysqldump, change ENGINE=MyISAM to ENGINE=InnoDB,

sed -i 's/ENGINE=MyISAM/ENGINE=InnoDB/g' your_schema_dump.sql

load the edited dump file and rerun the system to the point where you are having the problem? There is very little to be said these days for running a system using MyISAM tables.

Vérace
  • 29,825
  • 9
  • 70
  • 84
  • thanks for your advice, but I did all Database configuration for freeRADIUS and I have problem with mysql now – JOGOOL Aug 22 '14 at 01:06
  • OK - are you using MyISAM or InnoDB? When you're having a problem, can you run SHOW PROCESSLIST; please? – Vérace Aug 22 '14 at 01:16
  • I edit the Question and add result of SHOW PROCESSLIST; – JOGOOL Aug 22 '14 at 11:54
  • Could you post it as a code block into your question, or provide something downloadable - I'm afraid that I am unable to read your image. – Vérace Aug 22 '14 at 12:29
  • just right click and save as image so you can see the image clearly – JOGOOL Aug 22 '14 at 14:03
  • Are you running with MyISAM or InnoDB (I'm guessing MyISAM because of the table level lock in the show processlist)? You have a lot of idle processes - can you activate the general query log so that you can get the entire text of all queries made against the server? I can't read the full text of the queries so it's difficult to tell what's going on. Do not activate the general query log on a production system or performance could suffer. – Vérace Aug 22 '14 at 14:35
  • I just add queries that are running,to the question. – JOGOOL Aug 22 '14 at 17:52