FusionPbx top performance setting

Status
Not open for further replies.

Maani

Member
Nov 12, 2017
34
1
8
53
Hi
Please share your recommendation and experience about top performance of Fusionpbx(Freeswitch, Postgresql, Nginx, Memcached...)

Thanks.
 

Maani

Member
Nov 12, 2017
34
1
8
53
@DigitalDaz
Hi, I mean how to get maximum Calls per second or simultaneous calls from fusionpbx.for example there is very much details in CDRs now may tunning field generated in CDR increase performance....
 

ad5ou

Active Member
Jun 12, 2018
884
195
43
There are a lot of things that can be done to maximize performance. Many options are too advanced for a forum post.
If you need to fine tune your system, I would suggest a paid support for maximum benefit.
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,038
556
113
Well, hardware is cheap enough so no need for too much tweaking, just scale out and scale out well before you start to stress it.

There is no measure and its as simple as that when putting clients on a box its their behaviour, which you do not know in advance that is going to determine your load. One client with 10 extensions can load up your box more than a client with 100 depending on how they are using it. One of the things I do first is get those sqlite dbs into ram and turn off nginx access logs, also turn down the default logging on the freeswitch log file.
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,038
556
113
Also, with the default settings most boxes collapse at just over a 1000 concurrent due to php limits, memcached previously etc.
 

Maani

Member
Nov 12, 2017
34
1
8
53
Also, with the default settings most boxes collapse at just over a 1000 concurrent due to php limits, memcached previously etc.

Why php limits performance ? Except call broadcast is there any other place php code involves in call setup ? Even if no one configuring via web interface still there is problem from php side ?
Comparing to ordinary bare Freeswitch , is there any places Fusionpbx puts much higher processing load?
How about disabling Memcached and using internal PostgreSQL cache ?
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,038
556
113
Well, the immediate thing that comes to mind is CDRs, these are http posts to the webserver.
 

Maani

Member
Nov 12, 2017
34
1
8
53
Well, the immediate thing that comes to mind is CDRs, these are http posts to the webserver.

Hi
In order to reduce CDR http posts to WEB server in Advanced , Default Setting, Category CDR, Subcategory storage I changed value from db to dir and reboot server. CDR directories populated with XML CDR but still database is populating with same information.
Is there any way to offload database from CDR ?

Regards.
 

mingus

Member
Mar 23, 2018
43
7
8
53
There is always a balance between features and performance. The more features you want to provide, the lower your CPS (assuming this is your benchmark) will likely go. For example, encryption (SIPS & SRTP) has a big performance cost. However, you trade security for performance if you turn off encryption. Turning off transcoding will also consume fewer resources but it will limit the codecs you can use on your platform.

Keep in mind that CPS may not be your ideal benchmark. An established 2-party call without any encryption, without recording, and without transcoding will consume fewer resources than establishing a new call. In other words, increasing CPS by 10% doesn't necessarily mean you'll see a 10% increase in simultaneous calls.

The operating performance tweaks help. However, you need to determine if you are starving for CPU, Memory, or IO. Based on where you have a problem, you need to make the correct choices for your platform and then alleviate where the problem resides. For instance, if you are IO or memory bound, fixing CPU bottlenecks may not help you. Performance is all about making choices specific to your platform and testing those changes.

Here is a link to some interesting Linux tuning options that may (or may not) work on your platform:
https://freeswitch.org/confluence/display/FREESWITCH/Performance+Testing+and+Configurations
 
Last edited:

Maani

Member
Nov 12, 2017
34
1
8
53
Hi
1-If someone can live with CSV CDR , it is possible to disable and stop mod_xml_cdr and increase performance.(it seems it stops posts to web server)
2- Also comment from DigiDaz in another post for putting internal freeswitch DB in RAM:

add this to fstab, reboot and you are done:
tmpfs /var/lib/freeswitch/db tmpfs defaults 0 0
 

markjcrane

Active Member
Staff member
Jul 22, 2018
447
162
43
49
"php limits" This is not a big factor on scalability. The HTTP Post to the web server uses PHP for XML CDR. You can skip the HTTP Post and use a cron job and still use XML CDR just without the HTTP Post. PHP is not a major deciding factor on scale.

What affects performance the most is actually how much the person configuring the server picks the right hardware and understand the software and all dependencies to configure their settings for the best performance. There is also things like is the server virtualized, and how good is the network routers, switches, and connection to the internet.

I had a company that hired me to come in person. I was there for 3 days. Most of the time I was there was spent optimizing many different things. Could have been optimizing things for weeks. We didn't have that kind of time I was helping them for only 3 days. However in the end they saw a dramatic improvement in performance. Point I'm trying to make is that it wasn't a few settings to get a big performance increase. It was many settings and optimizations.
 
  • Like
Reactions: Maani

Maani

Member
Nov 12, 2017
34
1
8
53
"php limits" This is not a big factor on scalability. The HTTP Post to the web server uses PHP for XML CDR. You can skip the HTTP Post and use a cron job and still use XML CDR just without the HTTP Post. PHP is not a major deciding factor on scale.

What affects performance the most is actually how much the person configuring the server picks the right hardware and understand the software and all dependencies to configure their settings for the best performance. There is also things like is the server virtualized, and how good is the network routers, switches, and connection to the internet.

I had a company that hired me to come in person. I was there for 3 days. Most of the time I was there was spent optimizing many different things. Could have been optimizing things for weeks. We didn't have that kind of time I was helping them for only 3 days. However in the end they saw a dramatic improvement in performance. Point I'm trying to make is that it wasn't a few settings to get a big performance increase. It was many settings and optimizations.


Thanks for reply. you are correct about PHP posts but another small point was if someone just needs simple CDR (A ,B numbers ,duration and date) in simple csv format, He/She can omit huge amount of Hard Disk I/O(if database was local) with disabling mod_xml_cdr so expecting increasing in performance.
 
Last edited:

Maani

Member
Nov 12, 2017
34
1
8
53
@markjcrane @KonradSC

In recent version of Fusionpbx memcache was disabled.
according to mcrane:"file cache out performs memcache at scale..because of listeners getting busy and using TCP".
If I am correct when memchached is disabled Fusionpbx XML handler is reading directly from postgresql database , So when file cache comes into play ?
I saw some suggestions from @KonradSC about adding indexes and using postgres cache.
Is it possible to a explain more ?
Another question if TCP connection cause memcahced not scale good the same scale problem we may encounter when using ESL connection ?
 
Last edited:

KonradSC

Active Member
Mar 10, 2017
166
98
28
We are talking FreeSWITCH speed here...Using the file cache method, the dialplan is only pulled from the database when there are not dialplan xml files present on the file system. Go look in the file cache directory on your server. You'll see a bunch xml files there. Clear cache then look again. The directory should be empty. Make a call and the directory will have files in it again. To make this happen, the dialpan was pulled from postgres and then written to the files on your server. If the xml files exist already, then postgres isn't touched.

If you want to talk about web interface speed, then you need to look at postgres indexes. There is nothing in the web interface that is cached. The postgres data on every page is pulled directly from postgres. (There is probably an exception to this for the web interface, I just can't think of anything right now.) Active Calls, Registrations, Active Agents, etc uses ESL to access FreeSWITCH which then draws data from sqlite.

I'm sure you could hit limits or have performance hits if have too many people looking at the Active Calls page at once. We only allow Superadmins access to that page for this very reason.
 
  • Like
Reactions: Maani

Maani

Member
Nov 12, 2017
34
1
8
53
We are talking FreeSWITCH speed here...Using the file cache method, the dialplan is only pulled from the database when there are not dialplan xml files present on the file system. Go look in the file cache directory on your server. You'll see a bunch xml files there. Clear cache then look again. The directory should be empty. Make a call and the directory will have files in it again. To make this happen, the dialpan was pulled from postgres and then written to the files on your server. If the xml files exist already, then postgres isn't touched.
@markjcrane
So may be this helps improving performance:
tmpfs /var/cache/fusionpbx tmpfs defaults 0 0
 

Maani

Member
Nov 12, 2017
34
1
8
53
In " Building Telephony Systems with OpenSIPS" book mentioned:

...To prevent these attacks, many people employ the use of a
utility called Fail2ban successfully. While Fail2ban is effective, it requires intensive
processing of log files, possibly degrading the performance of the whole system. In 2012,
at the ClueCon (developers’ conference focused on open source VoIP), Vlad Paiu
presented a simple script able to ban the attackers simply using OpenSIPS tools. I’m
reprinting the script here:

Code:
www_authorize("","subscriber");
switch ($retcode) {
     case  -3:       # stale nonce
     case  -2:       # invalid passwd
     case  -1:       # no such user
           xlog("Failed Auth\n");
           if ( cache_fetch("local","authF_$si",$avp(failed_no)) ) {
              if ( $(avp(failed_no){s.int}) >= 20 ) {
                 xlog("SCRIPT: SECURITY ALERT: 20 failed auth from $si\n");
                 send_reply("403","Forbidden");
                 exit;
              }
            cache_add("local","authF_$si",1,60);
          } else {
            cache_store("local","authF_$si","1",60);
          }
     default:
        xlog("Challenging\n");
        www_challenge("", "0");
        exit;
        break;
}
 
Last edited:

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,038
556
113
I have thought for some time now that the use of opensips/kamailio in front of fusionpbx may well be really worth while.I think there are a number of ways within these packages to sanitise the sip before it hits fusionpbx.

I've never decided upon the approach properly though. Do you just relay through the kamailio everything to the fusionpbx or really try and integrate it. The second method would be better performance wise, if kamailio could handle much of the presence and registrar functions etc.
 
  • Like
Reactions: absg-scott

smn

Member
Jul 18, 2017
201
20
18
I have thought for some time now that the use of opensips/kamailio in front of fusionpbx may well be really worth while.I think there are a number of ways within these packages to sanitise the sip before it hits fusionpbx.

I've never decided upon the approach properly though. Do you just relay through the kamailio everything to the fusionpbx or really try and integrate it. The second method would be better performance wise, if kamailio could handle much of the presence and registrar functions etc.

The easiest way is to just use it as a proxy. What most integrations appear to do, is use it for presence/registrar. But it increases complexity considerably so it is usually not worthwhile to try do it yourself.
 
Last edited:

Maani

Member
Nov 12, 2017
34
1
8
53
The easiest way is to just use it as a proxy. What most integrations appear to do, is use it for presence/registrar. But it increases complexity considerably so it is usually not worthwhile to try do it yourself.

Do not forget Opensips mid_registrar module, it can lift 90% register traffic without any complexity and without fusionpbx configuration change.
 
Status
Not open for further replies.