Skip to main content ↑ ↓
Slow Page Load time Started by Hj Ahmad Rasyid Hj Ismail · · Read 611 times 0 Members and 2 Guests are viewing this topic.

Re: Re: Load time achievement

Reply #15 –

Did you check the hostname lookup setting (just want to be sure its a DB issue and not something else) is off?

The error message appears to be it was not finding the mysqld.sock socket, what setting did you have to change to fix the issue?

Re: Re: Load time achievement

Reply #16 –

It was a jail / chroot issue. Not jailing / chrooting it allows direct connection to localhost, so that issue alone was fixed.

However, there is no improvement whatsoever, so my guess about it was totally wrong. I got nothing to do with either 127.0.0.1 or localhost connection. Learning on how Elkarte 2.0 Beta 1 php is processing database may be is what I need to find out more.

By the way, converting either from or to 127.0.0.1 to or from localhost, need to be done in database as well as settings file, as the leftovers might render an Elkarte forum inaccessible do to the change of path whether just /web for chrooted site using 127.0.0.1 or /full/path/to/web in localhost setup.

It might be easier to setup a new site for testing, unless you want to have some fun too, which I did.

Re: Re: Load time achievement

Reply #17 –

I noticed you fix this in this in this forum since its queries are now improved than when it was launched before. Do share the adjustments you made @Spuds.

Re: Re: Load time achievement

Reply #18 –

I've installed this on a few machines now and have not exactly been able to replicate the slowdown you reported.  I've tried Apache, Nginx, PHP 8.2-8.5, MySql and Mariadb. 

One thing I did notice while testing, using vhosts .... I had PHP set as on-demand (ispconfig default) and it would take a good 3-5 seconds to respond.  It would also shoot out random token failure when in the admin panel.

The default pm.process_idle_timeout is 10s, and with pm = ondemand it means the PHP-FPM worker gets killed 10 seconds after going idle. Any time testing gaps between tries were long then every "new" request was a cold start and it would spawn a new PHP process, initialize extensions, reconnect to MySQL, and repopulate OPcache/APCu , all before the page starts rendering.

Anyway In production I always use dynamic workers so I was not familiar with the performance of ondemand.  For testing I set it to static and a few workers.  Just thought it was interesting.

Re: Slow Page Load time

Reply #19 –

I broke this out of the other thread and put the main bits it in the bug board.  I've also added the last discussion section from GitHub just so I can track this.

QuoteI haven't tested 2.0 extensively though already have it up and running since you released its beta. So far I am still not satistifed with front page queries which still taken more than 3 seconds while in 1.1 it is just below 0.02 seconds. I don't what queries have been added to load the forum at that instance and whether they are even necessaries. I haven't gone deeper into the code anyway, so cannot give any opinion but generally too much queries when loading the forum is no good, or if the queries are about the same as 1.1, how the queries are done, that cause that longer time to process it, is still not acceptable to me. Anyway, thanks for "this fix" even though I haven't gone through in details or tested it.

I've not experienced this on my installs so there is something different that is causing the issue.  The only slow (and its very slow) query that I know of is if you enable like stats on the board index (its one of the theme options for the information center, like calendar, new posts, members, etc) That query will be slow IF you have a test board with lots of posts.  I've made adjustments that will help with that for the next test release.

That said, does your test site have many posts or is it a fresh install with just a few posts?  Then what are you running in terms of apache/nginx, mysql/mariadb/postgre and then PHP and its version.  I'd like to recreate your environment to see if I can repo this issue.

Re: Slow Page Load time

Reply #20 –

Fresh install 2.0, so empty. Even old one 1.1 is not active. I am restructuring my servers, but they are both in the same one ISPConfig server, all the time, with the same config for both websites, so I am still not so sure why.
https://elkarte.sch.my
https://elkarte2.sch.my
May be I create an access for you later on in my ISPConfig and pm you to test both in there.

Re: Slow Page Load time

Reply #21 –

That is painfully slow !

Re: Slow Page Load time

Reply #22 –

Yeah. Weirdly slow. Even when refreshed. I can see this site is way faster. You will be shocked if you know how much vrams and vcpus I have assigned for this server vm, even its storage is on enterprise nvme, so yes, I should finished restructuring to see whether something else are bothering / disturbing.

Re: Slow Page Load time

Reply #23 –

I was using curl to grab one of the hive css files and I did notice that nginx does not seem to be compressing the files, so check if your nginx.conf file has something like:
Code: [Copy]
gzip on;
gzip_comp_level 5;
gzip_min_length 256;
gzip_vary on;
gzip_proxied any;
gzip_types
  text/css
  application/javascript
  text/javascript
  application/json
  image/svg+xml
  font/ttf
  application/vnd.ms-fontobject;
Just getting a static file from the server was slow and that has nothing to do with the ElkArte front end.  Some of that is also having a lot of network to traverse between me and you.

Other than that seeing 3-5 seconds on 17 queries maybe a slow connection to your db?  If the db server setting is a hostname that may cause a DNS lookup for each connection which would be slow.  You can try to measure it with:
Code: [Copy]
time mysql -h localhost -u USER -p'PASS' -e "SELECT 1;"
time mysql -h 127.0.0.1 -u USER -p'PASS' -e "SELECT 1;"

Can also check if the db is doing rDNS lookups, at least for MariaDb it should have skip-name-resolve in its conf file (assuming everything is on the same server)

Re: Slow Page Load time

Reply #24 –

Ok. I think the static files could be the issue too, and I will dig deeper on that.

Internally, mysql connections, they are both very fast:
time mysql -h 127.0.0.1 -u USER -p'PASS' -e "SELECT 1;"
Quotereal    0m0.068s
user    0m0.036s
sys     0m0.018s
time mysql -h localhost -u USER -p'PASS' -e "SELECT 1;"
Quotereal    0m0.066s
user    0m0.037s
sys     0m0.013s

Re: Slow Page Load time

Reply #25 –

Sighed. It was server settings for caching. Simply setting it to 1st level file based caching fixed the problem. Minor 0.015-0.020 delay from 1.1 but that is negligible.

It was Firefox default Google Ai that pointed the possible "caching" issue, in cross reference to our old topic:
https://www.elkarte.net/community/index.php?t/Problem-with-all-posts-timing-out---resolved-by-editing-Settings.php-2079

Also, just to note, I researched back and I found out that I didn't use gzip setup for quite sometimes, but I will definitely will study it back later.

My plan is to setup Redis and all out using it, for my project.

Re: Slow Page Load time

Reply #26 –

Interesting finding on the cache, I'll have a second look at the cache off code. 

Definitely worth the time setting up Gzip for your static (txt based) assets, it will make a nice improvement to your sites.

Elk20 does have support for Redis cache I've not used it myself other than some basic tests.

Re: Slow Page Load time

Reply #27 –

Tested but found no improvement with memcache and memcached which is weird but redis makes the site back to the slowest 3.5 seconds which is more weird.

Re: Slow Page Load time

Reply #28 –

In the Admin area where you set the cache engine check the "cache status" section (new in 2.0) it will show you some details of what the cache is doing and most importantly if its working.  The miss rate will be high on a test site with no real traffic, but it will show that it connected and using the cache.

Re: Slow Page Load time

Reply #29 –

Edited: Only some like redis didn't show status. I'll test more later.

In the meantime, I think "memcache" is broken / wrongly detected, as setting it breaks the forum. Others seemed fine but Redis is not showing status as mentioned above.
Last Edit: October 05, 2026, 07:33:31 pm by Hj Ahmad Rasyid Hj Ismail