• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question TTFB always high also with many optimizations

fferraro87

Basic Pleskian
Hi,
i'm using Plesk Onyx Version 17.8.11 Update #16 on a centos 7.
i've an TTFB very high (1.3 s) on my plesk vps, i've made many optimizations.
I've disabled many apache module in order to improve apache performance, i've tried also to disable use of apache and use only nginx with nginx caching. but nothing changed.

i've enabled keep-alive. i've disabled php (i'm using php 7.1) modules that i'm not using but ttfb it's still the same.
i've enabled logging of slow sql query but logfile it's empty.

do you have some tips or advice in order to mitigate ttfb (1.3 s is very very high)
All websites are wordpress.

that's my use of RAM right now :

total used free shared buff/cache available
Mem: 9,6G 1,2G 934M 841M 7,5G 7,0G
Swap: 6,9G 54M 6,8G


Thanks
 
High TTFB can be caused by many things. Could be system resources, could be I/O, could be code related. In order to further diagnose you can post your URL and we can run it through some analysers.

BTW, if you're using WordPress you can't disable PHP, hah.
 
High TTFB can be caused by many things. Could be system resources, could be I/O, could be code related. In order to further diagnose you can post your URL and we can run it through some analysers.

BTW, if you're using WordPress you can't disable PHP, hah.
Hi, thanks for your answer.
i've sent you on PM website.

I know that i cannot disable PHP on WP unfortunately :D
 
Did you try a reboot of the whole system after doing all the optimizations? Some of them could just be not active or you have another problem that becomes solved by a reboot.
 
Did you try a reboot of the whole system after doing all the optimizations? Some of them could just be not active or you have another problem that becomes solved by a reboot.
I've reboot but nothing change.

i've done a benchmark on disk and i've that output very very slow :

Code:
test: (g=0): rw=randrw, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=64
fio-3.1
Starting 1 process
test: Laying out IO file (1 file / 4096MiB)
Jobs: 1 (f=1): [m(1)][99.9%][r=5592KiB/s,w=1844KiB/s][r=1398,w=461 IOPS][eta 00m:10s]
test: (groupid=0, jobs=1): err= 0: pid=15976: Wed Aug  1 13:14:32 2018
   read: IOPS=67, BW=270KiB/s (276kB/s)(3070MiB/11652063msec)
   bw (  KiB/s): min=0, max=  587, per=0.63%, avg= 1.71, stdev=19.74, samples=21914
  iops: min=0, max=  146, avg= 0.36, stdev= 4.91, samples=21914
  write: IOPS=22, BW=90.2KiB/s (92.3kB/s)(1026MiB/11652063msec)
   bw (  KiB/s): min=0, max=  235, per=0.61%, avg= 0.55, stdev= 7.27, samples=20723
  iops: min=0, max=   58, avg= 0.12, stdev= 1.79, samples=20723
  cpu: usr=1.17%, sys=72.47%, ctx=149598, majf=0, minf=23
IO depths: 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=0.1%, >=64=100.0%
submit: 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.1%, >=64=0.0%
issued rwt: total=785920,262656,0, short=0,0,0, dropped=0,0,0
latency   : target=0, window=0, percentile=100.00%, depth=64

Run status group 0 (all jobs):
  READ: bw=270KiB/s (276kB/s), 270KiB/s-270KiB/s (276kB/s-276kB/s), io=3070MiB (3219MB), run=11652063-11652063msec
WRITE: bw=90.2KiB/s (92.3kB/s), 90.2KiB/s-90.2KiB/s (92.3kB/s-92.3kB/s), io=1026MiB (1076MB), run=11652063-11652063msec

Disk stats (read/write):
dm-0: ios=791061/448801, merge=0/0, ticks=128828689/311685689, in_queue=441632917, util=100.00%, aggrios=790845/436059, aggrmerge=901/1296
0, aggrticks=128724952/290145923, aggrin_queue=418620971, aggrutil=100.00%
sda: ios=790845/436059, merge=901/12960, ticks=128724952/290145923, in_queue=418620971, util=100.00%

and you can see that it's very very slow. it's strange because i've do another test on another centos 7 on the same storage pool and i've that output :


Code:
test: (g=0): rw=randrw, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=64
fio-3.1
Starting 1 process
test: Laying out IO file (1 file / 4096MiB)
Jobs: 1 (f=1): [m(1)][100.0%][r=5912KiB/s,w=2016KiB/s][r=1478,w=504 IOPS][eta 00m:00s]
test: (groupid=0, jobs=1): err= 0: pid=22051: Wed Aug  1 14:26:49 2018
   read: IOPS=1401, BW=5605KiB/s (5740kB/s)(3070MiB/560869msec)
   bw (  KiB/s): min=    8, max=14008, per=100.00%, avg=5608.92, stdev=2260.60, samples=1121
   iops        : min=    2, max= 3502, avg=1402.16, stdev=565.16, samples=1121
  write: IOPS=468, BW=1873KiB/s (1918kB/s)(1026MiB/560869msec)
   bw (  KiB/s): min=   72, max= 4880, per=100.00%, avg=1881.36, stdev=759.26, samples=1117
   iops        : min=   18, max= 1220, avg=470.27, stdev=189.84, samples=1117
  cpu          : usr=1.89%, sys=4.85%, ctx=527464, majf=0, minf=23
  IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=0.1%, >=64=100.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.1%, >=64=0.0%
     issued rwt: total=785920,262656,0, short=0,0,0, dropped=0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=64

Run status group 0 (all jobs):
   READ: bw=5605KiB/s (5740kB/s), 5605KiB/s-5605KiB/s (5740kB/s-5740kB/s), io=3070MiB (3219MB), run=560869-560869msec
  WRITE: bw=1873KiB/s (1918kB/s), 1873KiB/s-1873KiB/s (1918kB/s-1918kB/s), io=1026MiB (1076MB), run=560869-560869msec

Disk stats (read/write):
    dm-0: ios=785752/262734, merge=0/0, ticks=29645167/6178464, in_queue=35847305, util=100.00%, aggrios=782876/262396, aggrmerge=3044/384, ag
grticks=29550626/6166078, aggrin_queue=35715013, aggrutil=100.00%
  sda: ios=782876/262396, merge=3044/384, ticks=29550626/6166078, in_queue=35715013, util=100.00%

so i exclude that the problem is the hardware. so i do an iotop in order to see what process do many iops on that VPS and i see this
Code:
Total DISK READ :  40.23 K/s | Total DISK WRITE :   15.32 K/s
Actual DISK READ:  61.30 K/s | Actual DISK WRITE:     409.92 K/s
  TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND                                                                      
  655 be/3 root    0.00 B0.00 B  0.00 %  1.41 % auditd
13197 be/4 root   0.00 B0.00 B  0.00 %  1.24 % [kworker/u8:0]
 4339 be/4 mysql476.00 K    288.10 M  0.00 %  1.03 % mysqld --basedir=/usr --datadir=/var/lib~db.pid --socket=/var/lib/mysql/mysql.sock
  425 be/4 root  464.00 K      0.00 B  0.00 %  0.97 % [xfsaild/dm-0]
14130 be/4 root 0.00 B0.00 B  0.00 %  0.48 % [kworker/1:2]
 4141 be/4 nginx11.01 M0.00 B  0.00 %  0.28 % nginx: worker process
13232 be/4 root    0.00 B      0.00 B  0.00 %  0.27 % [kworker/1:1]
 4340 be/4 mysql208.00 K   1076.00 K  0.00 %  0.25 % mysqld --basedir=/usr --datadir=/var/lib~db.pid --socket=/var/lib/mysql/mysql.sock
 3197 be/4 mysql   0.00 B      0.00 B  0.00 %  0.25 % mysqld --basedir=/usr --datadir=/var/lib~db.pid --socket=/var/lib/mysql/mysql.sock
 4938 be/4 apache296.00 K72.00 K  0.00 %  0.12 % httpd -DFOREGROUND
14209 be/4 root0.00 B0.00 B  0.00 %  0.14 % [kworker/u8:2]
 4933 be/4 apache60.00 K     32.00 K  0.00 %  0.10 % httpd -DFOREGROUND
 4969 be/4 apache     1592.00 K     32.00 K  0.00 %  0.08 % httpd -DFOREGROUND
 4936 be/4 apache 60.00 K     32.00 K  0.00 %  0.08 % httpd -DFOREGROUND
 4957 be/4 apache464.00 K     80.00 K  0.00 %  0.07 % httpd -DFOREGROUND
 6426 be/4 apache588.00 K128.00 K  0.00 %  0.06 % httpd -DFOREGROUND
 6407 be/4 apache284.00 K     40.00 K  0.00 %  0.06 % httpd -DFOREGROUND
 4943 be/4 apache1172.00 K     24.00 K  0.00 %  0.05 % httpd -DFOREGROUND
 4960 be/4 apache 476.00 K    508.00 K  0.00 %  0.05 % httpd -DFOREGROUND
 6428 be/4 apache      228.00 K    176.00 K  0.00 %  0.05 % httpd -DFOREGROUND
 4912 be/4 apache136.00 K     80.00 K  0.00 %  0.05 % httpd -DFOREGROUND
 4919 be/4 apache224.00 K     24.00 K  0.00 %  0.05 % httpd -DFOREGROUND
 4927 be/4 apache 80.00 K     36.00 K  0.00 %  0.05 % httpd -DFOREGROUND
 6408 be/4 apache688.00 K     68.00 K  0.00 %  0.04 % httpd -DFOREGROUND
 4951 be/4 apache296.00 K     68.00 K  0.00 %  0.04 % httpd -DFOREGROUND
14829 be/4 apache460.00 K     48.00 K  0.00 %  0.11 % httpd -DFOREGROUND
14835 be/4 apache 96.00 K     32.00 K  0.00 %  0.11 % httpd -DFOREGROUND
 4958 be/4 apache544.00 K     36.00 K  0.00 %  0.04 % httpd -DFOREGROUND
 6409 be/4 apache716.00 K     96.00 K  0.00 %  0.03 % httpd -DFOREGROUND
 4926 be/4 apache268.00 K     36.00 K  0.00 %  0.03 % httpd -DFOREGROUND
 4928 be/4 apache48.00 K     36.00 K  0.00 %  0.03 % httpd -DFOREGROUND
 6413 be/4 apache436.00 K     72.00 K  0.00 %  0.03 % httpd -DFOREGROUND
 4910 be/4 apache452.00 K76.00 K  0.00 %  0.03 % httpd -DFOREGROUND
 4955 be/4 apache340.00 K     40.00 K  0.00 %  0.03 % httpd -DFOREGROUND
 4914 be/4 apache124.00 K     44.00 K  0.00 %  0.03 % httpd -DFOREGROUND
 4954 be/4 apache536.00 K    312.00 K  0.00 %  0.03 % httpd -DFOREGROUND
 4947 be/4 apache624.00 K    392.00 K  0.00 %  0.03 % httpd -DFOREGROUND
 4974 be/4 apache 60.00 K     44.00 K  0.00 %  0.03 % httpd -DFOREGROUND
 4981 be/4 apache80.00 K     56.00 K  0.00 %  0.03 % httpd -DFOREGROUND
 6414 be/4 apache408.00 K    108.00 K  0.00 %  0.03 % httpd -DFOREGROUND
 4930 be/4 apache152.00 K    104.00 K  0.00 %  0.03 % httpd -DFOREGROUND
 4918 be/4 apache  76.00 K     56.00 K  0.00 %  0.03 % httpd -DFOREGROUND
 4939 be/4 apache180.00 K     64.00 K  0.00 %  0.03 % httpd -DFOREGROUND
 4935 be/4 apache216.00 K     44.00 K  0.00 %  0.03 % httpd -DFOREGROUND
i don't have many iops generally on the disk so what can i do ?
 
cpu: usr=1.17%, sys=72.47%, ctx=149598, majf=0, minf=23

What says top? Who is consuming so much cpu?
 
nothing strange, that was only a peak because it's doing fio test on disk i think.

from my monitor i've no many cpu usage as you can see from screenshot( Imgur )
 
I only thought the same test should have similar results ....
Slow system: cpu: usr=1.17%, sys=72.47%, ctx=149598, majf=0, minf=23
Fast system: cpu: usr=1.89%, sys=4.85%, ctx=527464, majf=0, minf=23

You wrote "storage pool". What exactly? How connected?
 
I'm using vmware hypervisor and i'm using different storage for different VPS on my infrastructure.

these two tests are done on two VPS that use same LUN (so with same disk)
 
Back
Top