Before asking for help please read "Requesting Help and Suggestions" by clicking on that tab above here.
  • Page:
  • 1

TOPIC:

Slow performance 2.1.8 5 months 1 week ago #1

  • tobbe75
  • tobbe75's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 8
Why is my site so slow?
It takes several seconds to load a single page or login.
What can I do to improve performance?
I'm running on a home server and it is slow both from my internal network and from the internet.
I'm running in docker using nathanvaughn/webtrees image.

I don't think the server it's running on is slow.

URL: history.familjenmattsson.nu

Please Log in or Create an account to join the conversation.

Slow performance 2.1.8 5 months 1 week ago #2

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 17129
Your site just went down. Before it went down, I was looking at the timings for the vendor.min.js file.

This is a simple text file, with no PHP or database.

It should be pretty much instantaneous - but there were long delays with every aspect of the connection.

I guess the problem is with your server/docker configuration. It is slow before it even touches webtrees code.
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

Slow performance 2.1.8 5 months 1 week ago #3

  • tobbe75
  • tobbe75's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 8
Hi,

Thanks for you reply!
I'm sorry the connection went down, usually never happens.
I'm on a 150/10 Mbps cable connection in Sweden, running on a mostly idling intel nuc with 8GB RAM.
Bad luck perhaps, or maybe you testad around 03:00 UTC when I'm doing a scheduled DB backup?

I'm testing some timing from a separate mobile connection of good quality and this is the load times I typically get:
/ping - around 400ms
/tree/mattsson_nilsson - around 5 seconds.
Of those 5 seconds vendor.min.js only takes 2ms.
The tree (mattsson_nilsson) takes about 3 seconds alone).
Then I have two "blocks" on the start page that takes 1s and 500ms respectively.
The rest is pretty quick.

Load times for an individual in the tree is also around 5 seconds (not logged in).
Loggin in took about 8 seconds, and loading an individual when logged in takes around 10 seconds (with some media).

I already read the performance guide available but not sure where to look on my specific tree for bottlenecks.
Is it the thumbnails? Death dates? Size of three or media folder? Anything else?

Would you mind please take another look, or give advise on what to look for next?

Please Log in or Create an account to join the conversation.

Slow performance 2.1.8 5 months 1 week ago #4

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 17129
(Temporarily) disable all your custom modules.
Does this make a difference?
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

Slow performance 2.1.8 5 months 3 days ago #5

  • tobbe75
  • tobbe75's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 8
Thanks for your reply and sorry for late reply.
Are you talking about the "fancy imagebar" or what is the custom modules you're referring to?
Are there an easy way to disable them without uninstalling them?

I also did another experiment, I created a new tree called test1 and imported a subset of only 27 individuals to that tree.
test1 loads an individual's page in about 2.5 seconds (logged in).
The same individual in the bigger tree takes about 9 seconds to load (also logged in).
The thumbnails, css etc takes about 1 second to load, and the page itself takes about 8 seconds, according to chrome devtools network tab.

I wonder what I can do to speed that up?
If I should disable any modules, could you please specify which ones and give a hint on how to do that most easily?

Please Log in or Create an account to join the conversation.

Slow performance 2.1.8 5 months 3 days ago #6

  • tobbe75
  • tobbe75's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 8
I managed to disable the "fancy imagebar" moule, and voilá, it now takes about 2 seconds to load the same page.
Which is acceptable!
Thanks for pointing me in that direction!

I really do like the "fancy imagebar" though, and I'd really like to get it working faster if possible.
Could it be the thumbnail generation of the random images that takes so long?
Is it possible to pre-generate all the thumbnails for all the media in the media folder?

Please Log in or Create an account to join the conversation.

Slow performance 2.1.8 5 months 3 days ago #7

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 17129
How many media objects do you have.

I took a quick look at the code for the fancy-image-bar.

It uses the "->inRandomOrder()" function from the database library to select all images in a random order.

Internally, this uses the SQL construct: SELECT * FROM table ORDER BY RAND();

If you search online, you'll find that "ORDER BY RAND() LIMIT N" has very poor performance for large tables.

It can often be much faster to fetch all the primary keys, use PHP to select them using array_rand(), and then fetch just those rows in a second query.
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

Slow performance 2.1.8 5 months 3 days ago #8

  • tobbe75
  • tobbe75's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 8
I have around 600 media files in my database.
I have now changed the settings for the plugin to only use a few manually selected media files, and the performance is better, even if still a little slower than I would wish.
The performance got a little bit better still after I reloaded maybe 30 times. I suppose all or most thumbnails had been created then.
Thanks for checking out the module code.
I'll either live with my workaround or file an issue with on github for the fancy image bar module!

Please Log in or Create an account to join the conversation.

Do you need a web hosting solution for your webtrees site?
If you prefer a host that specialises in webtrees, the following page lists some suppliers able to provide one for you: 

Slow performance 2.1.8 5 months 3 days ago #9

  • tobbe75
  • tobbe75's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 8
It is still quite slow when not logged in, despite the fancy image bar is only showed to logged in users.
About 3 seconds to load the page for an individual.
Could it be that the calculation of death dates to show only dead individuals to non-logged in users are taking some time?

I can live with this, but it's not super fast.

Please Log in or Create an account to join the conversation.

Slow performance 2.1.8 5 months 2 days ago #10

  • JustCarmen
  • JustCarmen's Avatar
  • Offline
  • Elite Member
  • Elite Member
  • Posts: 1205

I took a quick look at the code for the fancy-image-bar.

It uses the "->inRandomOrder()" function from the database library to select all images in a random order.

Internally, this uses the SQL construct: SELECT * FROM table ORDER BY RAND();

If you search online, you'll find that "ORDER BY RAND() LIMIT N" has very poor performance for large tables.

It can often be much faster to fetch all the primary keys, use PHP to select them using array_rand(), and then fetch just those rows in a second query.

Thank you for the tips Greg. I'll try improve the code.

Carmen
Designer of the JustLight theme (comes with a light and dark color palette), Fancy Imagebar, Fancy Research Links and Fancy Treeview for webtrees 2


Check my website at www.justcarmen.nl

Please Log in or Create an account to join the conversation.

Slow performance 2.1.8 5 months 2 days ago #11

  • tobbe75
  • tobbe75's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 8
Thanks Carmen for picking this up!
Let me know if you change the code and want me to test, or if you need any more feedback from me.

Please Log in or Create an account to join the conversation.

Slow performance 2.1.8 5 months 2 days ago #12

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 17129
> /ping - around 400ms

This seems pretty slow.

My local dev machine (i.e. my laptop) gives 20ms.
My live server (in Ireland, I'm England) gives 60-80ms.

400ms seems pretty slow for a page that does little more than open/close a database connection.

> /tree/mattsson_nilsson - around 5 seconds.

Maybe look at your MySQL configuration?

Does it have lots of RAM?
Is it configured to skip DNS lookups - often an issue on machines with slow/misconfigured DNS.
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

Slow performance 2.1.8 5 months 2 days ago #13

  • tobbe75
  • tobbe75's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 8
I get around 300ms for /ping now, even when testing with wget from the linux host where the docker containers are running.
mariadb is set to ignore dns, I think that's what this means:

[mariadbd]
skip-host-cache
skip-name-resolve

Host has plenty RAM:
# free -h
total used free shared buff/cache available
Mem: 7.6Gi 4.0Gi 743Mi 2.0Mi 2.9Gi 3.5Gi
Swap: 4.0Gi 22Mi 4.0Gi

And CPU is fine too.

Is there a test URL that does not involve the DB at all so I can determine if it is the db that sis slow and not docker or webserver or something else?

Please Log in or Create an account to join the conversation.

Slow performance 2.1.8 5 months 2 days ago #14

  • Sir Peter
  • Sir Peter's Avatar
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 409
Greg already tested history.familjenmattsson.nu/public/js/vendor.min.js and said it is loading slow. You can use the webtrees icon at history.familjenmattsson.nu/favicon.ico which is loading slow as well (200msec is 5-10 times of what it should take). Both are simple files and bypass webtrees and database. While pings to your site are fast (~43msec), https is slow and http times out. In addition your webserver uses the HTTP/1.1 protocol only instead of HTTP/2. Not sure how much of a difference it makes, but HTTP/1.1 is deemed slower than HTTP/2. I suggest to look at the webserver configuration first, then at the network configuration.
Peter

Please Log in or Create an account to join the conversation.

Slow performance 2.1.8 1 week 4 days ago #15

  • Franz Frese
  • Franz Frese's Avatar
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 828
about Fancy image bar:
I would like to ask tobbe75, if the chages made in 2.2.1 would have speed up his site.
For me, the version 2.2.0 is very much quicker than the current 2.2.2.


Version 2.2.0 complete time is about 3 seconds


Version 2.2.2 complete time is about 10 seconds

the number of images is 1367

As I noticed with my poor knowledge in sql the implementation is not as Greg proposed by randomize over the keys but over the complete records.
I will stay at 2.2.0 until a quicker solution is available.
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: by Franz Frese.
  • Page:
  • 1
Powered by Kunena Forum