MySQL Connections

Hello All,

Asterisk Version: 13.7.2

I was looking into upping my MySQL max connections and wanted to check in and make sure I wasn’t missing anything. Do I need to do anything beyond editing the /etc/my.conf file to include “set-variable=max_connections=xxx” and doing a services restart?

Is there a better way to do this? I noticed there was not a variable for max_connections in this file previous to my entry.

Thanks for any insights you can provide!

Why would you want to do that? Not being mean - it will help us to answer your question. The database my.cnf file is tuned for Asterisk, so this should be a useless change even assuming you got the variable declaration correct.

Hi Dave,

No worries. I have a custom built callback app that calls the caller back in 30-45 minutes depending on the scenario. Each callback is creating a thread in the MySQL database until the callback is complete.

When using the app in production, I noticed there seemed to be a limit to the number of pending callbacks. It always seemed to be stuck in the 140’s. Sure enough a look at the max connections in MySQL shows 150, so that makes sense. I wanted to see if there would be a noticeable quality impact by increasing that limit.

Any advice?

P.S. When you say Asterisk has already sized the connection, does that mean it dynamically determined 150 was what my hardware could handle, or does that mean 150 is the upper limit for Asterisk, regardless of hardware?

Thanks again!

There is probably a better of doing whatever you are trying to do., how are you doing what you want to do?

Hey dicko!

Basically I have an Free PBX IVR that plays an offer to callback message. If the caller accepts (press 1) it goes to the following [callback] extension. It uses their callerID as the call back number, and calls them back in 45 minutes. The playbacks are instructions that explain the callback process to the caller.

From there it goes to announcement y, which announces the callback. Then it goes to another IVR prompting the user to press 1 if they still need the callback. If the user presses 1, they are sent via misc-destination to the final stop in the treatment.

The dialplan I use for the callback is outlined below.

exten => x,1,Set(CALL=${CALLERID(number)})
exten => x,n,Set(DESTINATION=app-announcement-y.s.1)
exten => x,n,Set(SLEEP=2700)
exten => x,n,System(/var/lib/asterisk/bin/callback ${CALL} ${DESTINATION} ${SLEEP} &)
exten => x,n,Playback(custom/acba_xxx,noanswer)
exten => x,n,Playback(custom/acba_yyy,noanswer)
exten => x,n,Hangup

Let me know if you need more detail, and thanks for the help!

I present to you:
look at the hotel wakeup demo

1 Like

I would create a call file and touch it “+ 45 minutes” before moving it to /var/spool/asterisk/outgoing

1 Like

Thanks for the enhancement ideas. I will convert our system to this approach (Score!).

But with my original question about SQL threads, will this help? Will the call file shrink the number of threads for calls that are waiting for callback? Because its not using the sleep command (i.e. writing to the DB)? Sorry, the call file is a new area for me, so I appreciate the guidance.

In the short term, while I implement and test the call file approach, are there any concerns on the Asterisk/FreePBX side about raising the connection count from 150 in the my.conf file? The number of calls that actually process are very low (i.e. about 10 at most are ever called back at the same time).

I don’t know what your script does, but I do know that :-

mysql --password=?? --user=?? -e  " SHOW FULL PROCESSLIST; SHOW STATUS LIKE '%onn%';

would let you know more about whatsup.

1 Like