Fresh server, page slowly

inomi13

Verified User
Joined
Jan 7, 2022
Messages
162
I have fresh server with below configuration where I have only one installation wordpress with woocommerce. Database of this wordpress has about 1GB and files have about 60 GB. I have configured redis, WP Fastest Cache and I set innodb_buffer_pool_size=1G. Before install redis and WP Fastest Cache server has load average like in log and page load very slowly. Do you have any idea how many requests will be able this server and I need to do something to improve it works?


CPUIntel(R) Xeon(R) Gold 6150 CPU @ 4 X 2.70GHz
Memory4 GB (Cached: 3.71 GB/ Used: 3.71 GB, Free: 1.16 GB)
Disk500GB SSD
directadmin1.665
httpd 2.4.62
dovecot 2.3.21
exim4.98
pure-ftpd1.0.51
mysqld10.6.18
named 9.16.23
 

Attachments

Last edited:
I'm not into speed things, others can advise better on these things.
However, very often in WP the xlmrpc.php is attacked which causes high load, you can easily see if that is going on in the server status.

On option is this post and the on below it:

Do you also have a swapfile? If not, be sure to create one and I would use 4 GB of swapspace (or more).
 
If it's just a default installation, there are a few things that you can do
1. Replace Apache with OpenLitespeed or Litespeed.
2. Optimize MariaDB.
3. Replace WP Fastest Cache with Litespeed Cache.
4. Block unnecessary requests to xmlrpc.php as Richard pointed out, requests from bad bots. Block them with firewall, or at least with mod_security, so they will not request database.
5. Check your WordPress if the theme is optimized or you might need to try with a faster theme. The same applies to plugins. Do you have many plugins? Any bad plugin?
 
@gate2vn Thanks for your advices. I disabled xmlrpc.php in .htaccess domain and I optimized MariaDB and Wordpress. In php I changed to pm.max_children = 50 and and now page works as I want but I have one more an issue, some times of day I have Load Avg High 5 minute load average alert about 10 and I don't know where I have to need look for is the problem. Log of php doens't give me any suggestions.

user1 1228504 26.6 1.8 288368 148900 ? R 10:30 2:14 \_ php-fpm: pool user1
user1 1228509 26.3 1.8 282984 143364 ? S 10:30 2:11 \_ php-fpm: pool user1
user1 1228601 28.3 1.8 283036 143924 ? S 10:31 2:02 \_ php-fpm: pool user1
user1 1228603 28.3 1.8 283200 146892 ? S 10:31 2:02 \_ php-fpm: pool user1
user1 1228614 27.9 1.9 295220 155248 ? S 10:31 2:01 \_ php-fpm: pool user1
user1 1228808 32.8 1.9 295148 155744 ? S 10:34 1:36 \_ php-fpm: pool user1
user1 1228810 33.3 1.8 287112 147376 ? S 10:34 1:38 \_ php-fpm: pool user1
user1 1229090 35.3 1.7 206752 136220 ? R 10:37 0:37 \_ php-fpm: pool user1
user1 1229092 34.8 1.6 201632 131484 ? S 10:37 0:37 \_ php-fpm: pool user1
user1 1229094 34.4 1.7 281032 140356 ? R 10:37 0:36 \_ php-fpm: pool user1
 
check TOP, check website logs, mysql logs. Test pages with benchmarks and optimize them.
 
I enabled mysql logs and responde query time from page is very slowly. What can I set in /etc/my.conf to optimalization and improve to fast responde query ?
 
check mysqltuner recommendations, also check phpmyadmin recommendations.
 
<Not saying a word, even though I replied> 😏

Seriously though...... Unless one exists, if someone has set up a "99%" fool-proof DA server solely for WordStress, they should add it to the Tutorial Section...... This might help others.
 
I suggest check mysql table index, if big data and query not use the index column, it will slow down your site.

Also more using plugins= more slow down site.
I think you should disable some plugins one by one and test speed until found the cause issued.
 
website is optimization because works better in another server which has the same configuration and doesn't has directadmin. For example when I want change some options in 20 products on fast edit, page works very slowly and lfd send mi alert that 1 Min Load Avg: 10.30.
 
website is optimization because works better in another server which has the same configuration and doesn't has directadmin. For example when I want change some options in 20 products on fast edit, page works very slowly and lfd send mi alert that 1 Min Load Avg: 10.30.
Is the other server optimised as well as WordStress? As in Webserver & MySQL/MariaDB?

Depending on the server usage, servers need to be optimised.
 
Probably I found an issue. I added logs to mysql and mysql gave me information that response time of table wp_postmeta is very slowly ~3 seconds. In this table I have about 5 millions rows. Do you have any sugestions how to improve to fast requests to this table?
 
depend on how's wordpress use query string.
you need to adjust key index. as I mention in comment #9


WHERE Cause: you must separate key index.

GROUP BY: you must group multiple culumn into 1Index
- example : group by row1 row5 row6, you must create 1 index with this three row.

ORDER BY: Have similar with WHERE Cause, except if query be like this "order by row1 row5 row6 DESC", you must create index group same as "GROUP BY".

###note:Becaurefully, create index on big table need long time to create per key index.
 
So what I did
  • optimized my WordPress database
  • set redis, opcache and cache from the wordpress side(Wp fastest Cache)
  • in /my/etc/my.cnf I set below conf
    • [mysqld]
      # Settings buforrer InnoDB
      innodb_buffer_pool_size = 2G
      innodb_log_file_size = 512M
      innodb_log_buffer_size = 256M

      # Rest
      table_definition_cache = 600
      query_cache_size = 0
      local-infile = 0
      max_allowed_packet=64M

      # Logs
      slow_query_log = 1
      slow_query_log_file = /var/log/mysql/mysql-slow.log
      long_query_time = 5
  • changed default value from pm.max_children = 10 to pm.max_children = 5
I did the tests via apache jmeter for 100 users and results was good, page and server works very stable but I have one more thing. In directadmin -> System Info I see free ram about 900 MB / Total 8GB and rest memory is divided to cached and used. it is good situtation? What will happend where ram doesn't have free memory? My server doesn't have swap memory.
 
Last edited:
My happiness was very short-lived. Today I had about 20 minutes, cpu 100% and page didn't work. In directadmin -> show services I saw many httpd PID(s) which used memory 3.5GB, htop was showing that all five process php-fpm used 100% cpu.

My case is the same like your @LawsHosting . One sever which has only one page on the wordpress. Before transfer to new server with directadmin page and server worked great.

Now I disabled cron in wordpress and enqabled debug.log, maybe these give me more information. Of course I checked the apache logs and I didn't find any multiple requests from the same IP address. The slow mysql logs only gave me the information that the query response was very slow ~6 seconds.
 
You should see list mysql quary which have long time processing
in DA Database Monitor or via cli if you have legacy license.


Code:
mysql --defaults-extra-file=/usr/local/directadmin/conf/my.cnf
show full processlist;
 
I disabled the default wp-cron.php file and now I see that the server is more stable.
 
@johannes I know, when I used define('DISABLE_WP_CRON', 'true'); then I set command with time every 5 minutes in crontab which call wp-cron.php
 
Back
Top