Jump to content

Server Side Optimization - CentOS + MySQL

Featured Replies

Posted

Looking for some experienced help and advice to optimize server side to reduce wait time to improvise the page load.

We are running on dedicated server with clouldflare pro plan to speed up front end.

We only have 1 main site on this server.

Server spec:

  • 2 X Intel(R) Xeon(R) CPU E3-1245 V2 @ 3.40GHz
  • Speed: 3392.173 MHz

  • Cache: 8192 KB

  • RAM: 32 GB

Operating system

  • CENTOS 6.10
  • PHP
  • MySql
  • Apache

CPU Load

top - 22:20:01 up 286 days,  1:59,  1 user,  load average: 0.14, 0.14, 0.17
Tasks: 244 total,   1 running, 241 sleeping,   0 stopped,   2 zombie
Cpu0  : 31.8%us,  2.0%sy,  0.0%ni, 65.7%id,  0.0%wa,  0.0%hi,  0.5%si,  0.0%st
Cpu1  :  4.0%us,  2.0%sy,  0.0%ni, 94.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu2  :  0.0%us,  0.5%sy,  0.0%ni, 99.5%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu3  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu4  :  0.0%us,  1.0%sy,  0.0%ni, 99.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu5  :  1.0%us,  0.5%sy,  0.0%ni, 98.5%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu6  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu7  :  2.0%us,  0.5%sy,  0.0%ni, 97.5%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  32909764k total, 14882656k used, 18027108k free,  1733764k buffers
Swap:   523260k total,   158160k used,   365100k free,  5096856k cached

MySql Config

[mysqld]
default-storage-engine=MyISAM
open-files-limit=6553
performance-schema=0
local-infile=0
bind-address=127.0.0.1

innodb_buffer_pool_size=134217728
max_allowed_packet=268435456

# CACHES AND LIMITS #
tmp-table-size=512M
max-heap-table-size=256M
query-cache-type=1
query-cache-size=256M
query-cache-limit=1048576
max-connections=505
max_user_connections=500
thread-cache-size=32
table-definition-cache=102400
table-open-cache=20480

#### Per connection configuration ####
join_buffer_size=4M
sort_buffer_size=4M
read_buffer_size=4M
read_rnd_buffer_size=4M

# INNODB #
innodb_file_per_table=1
innodb_buffer_pool_size=134217728

# MyISAM #
key-buffer-size=1G
open_files_limit=10000

 

MySQL Tuner Report

 >>  MySQLTuner 1.4.0 - Major Hayden <major@mhtx.net>
 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >>  Run with '--help' for additional options and output filtering
[OK] Currently running supported MySQL version 5.7.29
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in MyISAM tables: 508M (Tables: 684)
[--] Data in InnoDB tables: 34M (Tables: 476)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 87)
[--] Data in MEMORY tables: 0B (Tables: 4)
[!!] Total fragmented tables: 101

-------- Security Recommendations  -------------------------------------------
ERROR 1054 (42S22) at line 1: Unknown column 'password' in 'where clause'
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 5d 22h 27m 10s (95M q [186.335 qps], 582K conn, TX: 545B, RX: 27B)
[--] Reads / Writes: 90% / 10%
[--] Total buffers: 1.6G global + 16.2M per thread (505 max threads)
[OK] Maximum possible memory usage: 9.7G (30% of installed RAM)
[OK] Slow queries: 0% (0/95M)
[OK] Highest usage of available connections: 43% (219/505)
[OK] Key buffer size / total MyISAM indexes: 1.0G/240.5M
[OK] Key buffer hit rate: 100.0% (1B cached / 72K reads)
[OK] Query cache efficiency: 91.9% (84M cached / 91M selects)
[!!] Query cache prunes per day: 608570
[OK] Sorts requiring temporary tables: 0% (176 temp sorts / 670K sorts)
[!!] Joins performed without indexes: 6834
[OK] Temporary tables created on disk: 5% (106K on disk / 1M total)
[OK] Thread cache hit rate: 99% (1K created / 582K connections)
[OK] Table cache hit rate: 38% (19K open / 51K opened)
[OK] Open file limit used: 27% (11K/41K)
[OK] Table locks acquired immediately: 99% (10M immediate / 10M locks)
[OK] InnoDB buffer pool / data size: 128.0M/34.9M
[OK] InnoDB log waits: 0

 

Hey @Gauravk,

If you're looking to have your server professionally tuned, I'm happy to offer my services to you.

You can find my rates and contact me here:

 

Are you using Redis?

image.png.18df8dacf9707f8add21e34483a958a6.png

 

image.png.50b295d8ad7c2274fe74cd8248f21921.png

  • Author

Thanks @AlexWebsites yes its showing on at the back-end, but Im not sure if its doing any good.

Any ways to check the redis installation is alive and kicking....?

 

Thanks @AlexWebsites yes its showing on at the back-end, but Im not sure if its doing any good.

Any ways to check the redis installation is alive and kicking....?

Under the support section, you'll see to the right system info. If IPS is using Redis, you'll see something like:

image.png.441883f09b5aebd0f79ddcb132a900c0.png

Hello @Gauravk

You should plan an upgrade to Centos 7 to get the new compilers and try to use phpfpm + Nginx + tuning everything on the system....

Not something that you can solve easily on a topic...

  • Author

Thanks @AlexWebsites this is nice to verify that its working.

image.png.555445e0ea8bdbac7b3f0a5466e463bb.png

  • Author

Thanks @Makoto and @ASTRAPI apart from the cost, there are several other reasons that I am stuck with DIY approach due to internal policies.

If any of you have some mod, plugin, app or detailed guide, I'm happy to buy it.

See if you can still support here with any inputs that will be highly appreciated.

I made little progress so far from 1.96 Request/Sec - 6.43 Request/Sec, hope I can better this more.

Baseline - Anonymous - Cloudflare ON

Concurrency Level:      1
Time taken for tests:   51.114 seconds
Complete requests:      100
Failed requests:        9
   (Connect: 0, Receive: 0, Length: 9, Exceptions: 0)
Non-2xx responses:      100
Total transferred:      4339200 bytes
HTML transferred:       4244800 bytes
Requests per second:    1.96 [#/sec] (mean)
Time per request:       511.145 [ms] (mean)
Time per request:       511.145 [ms] (mean, across all concurrent requests)
Transfer rate:          82.90 [Kbytes/sec] received

 

Redis + MySql config - Anonymous + Cloudflare ON

Concurrency Level:      1
Time taken for tests:   15.553 seconds
Complete requests:      100
Failed requests:        0
Total transferred:      19199846 bytes
HTML transferred:       19138500 bytes
Requests per second:    6.43 [#/sec] (mean)
Time per request:       155.530 [ms] (mean)
Time per request:       155.530 [ms] (mean, across all concurrent requests)
Transfer rate:          1205.55 [Kbytes/sec] received

 

You're welcome to refer to my guide on setting up and optimizing Nginx/PHP-FPM here:

It's a little dated, so just use php7.3 or php7.4 in place of php5. Don't try and use php5 anymore.

If you want to throw some support my way, I do have a small Patreon you can use:

https://www.patreon.com/makotodev

 

I highly recommend centminmod:

https://centminmod.com/

So are you using memcached vs redis? I'm on apache, wondering if I should move to nginx. 

@AlexWebsites I have tried both and they both work very well. Redis does a lot more then memcached out of the box and you can still use it with centminmod, along with all the constant tweaking that eva2000 does. 

  • Author
 

I highly recommend centminmod:

https://centminmod.com/

Thanks @Steph40 for recommending this. Can you please explain little bit what it is? And can we use this with Apache and CentOS?

Are you using this? If yes, I like to have a look at your IPB site for speed testing, please.

  • Author
 

@Gauravk sent you a pm.

Thanks for the PM, lovely site with a very beautiful and fresh design and awesome speed.

Please share the backend details like: Apache or Nginx, MySQL or MariaDB, Redis or Memcached, InnoDB or MyISAM?

Centminmod uses Centos, a highly optimized version of nginx. Installed PHP 7.3 and redis.

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.