New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance #224

Closed
peterschen opened this Issue Jun 1, 2015 · 8 comments

Comments

Projects
None yet
2 participants
@peterschen
Contributor

peterschen commented Jun 1, 2015

I have fm running on three different systems with a different combination of Apache, nginx, PHP-FPM, APC. For all the performance for rendering is not quite what I would like to have. I havn't drilled into this quite extensively but it seems that most of the time is spent for the first request and sending back the page.

On my production system (nginx, PHP-FPM, APC) I also used phpIPAM and with the same configuration and database it flies whilst fm feels sluggish.

@peterschen

This comment has been minimized.

Contributor

peterschen commented Jun 1, 2015

I had some time to look into this today. We have ~ 200 zones. I noticed that for every request made to the server two functions in fm-modules/fmDNS/functions.php are called: getSOACount getNSCount.

They are not called once but for every zone, whether it is displayed or not. I think there is a better way to achieve this as uncommenting the execution of the SQL statement results in much better performance already.

It seems that the performance degrades gradually with the amount of zones you keep. From my observations the abovementioned methods are called for every not deleted active zone.

@WillyXJ

This comment has been minimized.

Owner

WillyXJ commented Jun 1, 2015

Both functions are required to ensure the zone can be built or reloaded which is why they are run against every zone. As I work the other issues, I'll think about how the checks can be optimized.

@WillyXJ

This comment has been minimized.

Owner

WillyXJ commented Dec 4, 2015

My test environment for resolving this issue includes ~180 forward zones with ~1400 records each and loading zones-forward.php would take ~13 seconds while showing all zones on a single page.

I've found the following:

  • The query to pull zone record counts takes ~ 10 seconds.
    • After removing idx_record_account_id from fm_dns_records, the page load now takes ~3.5 seconds. I haven't seen much performance gain by disabling the getNSCount() and getSOACount() functions.
  • session_start() within getLanguage() takes ~1.4 seconds
  • getModuleBadgeCounts('zones') takes ~1 second

Working on optimizing the above functions.

@WillyXJ

This comment has been minimized.

Owner

WillyXJ commented Dec 4, 2015

Gained significant performance increases by:

  • Adding another index to the fm_dns_records table
  • Implementing better usage of session_write_close()
  • Slightly decreasing the number of SQL calls

Fixes will be included in the next release.

WillyXJ added a commit that referenced this issue Dec 4, 2015

#224 - Performance increases
Add another index to the fm_dns_records table
Implemented better usage of session_write_close()
Slightly decreased the number of SQL calls
@peterschen

This comment has been minimized.

Contributor

peterschen commented Dec 7, 2015

Sounds great. I'll give it a go when the next version is out.

@WillyXJ

This comment has been minimized.

Owner

WillyXJ commented Dec 8, 2015

fM 2.1.1 and fmDNS 2.1.2 have been released and contain the performance improvements.

@WillyXJ

This comment has been minimized.

Owner

WillyXJ commented Apr 1, 2016

@peterschen Is the performance still an issue in your environment with these changes?

@peterschen

This comment has been minimized.

Contributor

peterschen commented Apr 2, 2016

We're currently running 2.1.4. Loading the forward zones from the home screen takes little more than five seconds in total (see screenshot).

Stats:
3 servers
223 forward zones
6 reverse zones
~6 records per forward zone

Environment:
nginx 1.8.1
php-fpm 5.4.45-1dotdeb+7.1
php 5.4.45-1
dotdeb+7.1
apc 3.1.13

If there are some tweaks to be made I'd be happy to have them. All in all though I'm very happy with the product and the recent changes you incorporated.

Performance

@WillyXJ WillyXJ closed this Jul 20, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment