Some trouble with TTFB

icechieff
Posts: 48
Joined: Thu Aug 27, 2020 10:13 pm
Your location: Saint-Petersburg

hi.
trying to fix some long ttfb.

webpagetest example - https://webpagetest.org/result/210210_D ... 66a7d6212/

sometimes have a latency about 2,5s but only with php pages (with mariadb requests).
main page (html) doesn't have any troubles.

tried to google, but no result.
converted db to innodb - no changes

srv config - 2*E5-2630, 32gb ram, sas raid.

maybe some advices?
Thx
User avatar
myVesta
Site Admin
Posts: 928
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 8 times
Been thanked: 6 times

looks like database is large.

maybe to put larger buffers in /etc/mysql/mariadb.conf :

Code: Select all

[client]
port=3306
socket=/var/run/mysqld/mysqld.sock

[mysqld_safe]
socket=/var/run/mysqld/mysqld.sock

[mysqld]
user=mysql
pid-file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysqld/mysqld.sock
port=3306
basedir=/usr
datadir=/var/lib/mysql
tmpdir=/tmp
lc-messages-dir=/usr/share/mysql
log_error=/var/log/mysql/error.log

symbolic-links=0

skip-external-locking
key_buffer_size = 512M
max_allowed_packet = 32M
# table_open_cache = 256
sort_buffer_size = 4M
net_buffer_length = 16K
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 128M
# thread_cache_size = 8
# query_cache_size= 16M
# thread_concurrency = 8

#innodb_use_native_aio = 0
innodb_file_per_table

max_connections=200
max_user_connections=199
# wait_timeout=30
interactive_timeout=50
long_query_time=5

table_open_cache = 20480
thread_cache_size = 384
query_cache_size = 50M
# thread_concurrency = 16
wait_timeout = 180
join_buffer_size = 16M
query_cache_type = 1
tmp_table_size = 512M
innodb_buffer_pool_size=4G

!includedir /etc/mysql/conf.d/
after that restart mariadb:

Code: Select all

systemctl restart mysql
icechieff
Posts: 48
Joined: Thu Aug 27, 2020 10:13 pm
Your location: Saint-Petersburg

played with my.cnf, now it is :

Code: Select all

[client]
port=3306
socket = /var/run/mysqld/mysqld.sock
default-character-set=utf8mb4

[mysql]
#default-character-set=utf8mb4

[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
local-infile=0
#sql_mode = "NO_ENGINE_SUBSTITUTION"
user=mysql
pid-file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysqld/mysqld.sock
port=3306
#bind-address = 127.0.0.1
basedir=/usr
datadir=/var/lib/mysql
tmpdir = /dev/shm
#lc-messages-dir=/usr/share/mysql
log_error=/var/log/mysql/error.log
skip_name_resolve
skip-external-locking
skip-log-bin
connect_timeout=80
wait_timeout=80
interactive_timeout=80
net_write_timeout=80
#symbolic-links=0
init-connect='SET NAMES utf8mb4'
skip-character-set-client-handshake
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
#default-storage-engine=innodb
#concurrent_insert = ALWAYS
#sysdate_is_now = 1
#low-priority-updates
join_buffer_size=32M
max_connect_errors=30
#key_buffer_size = 180M
#max_connections = 256
#max_allowed_packet = 1000M
max_allowed_packet = 64M
table_open_cache = 8192
thread_stack=384K
thread_cache_size=500
net_buffer_length=96K
net_read_timeout=500
max_heap_table_size=2G
#table_definition_cache = 600
#sort_buffer_size = 16M
sort_buffer_size = 128M
#read_buffer_size = 16M
read_buffer_size = 128M
read_rnd_buffer_size = 128M
#read_rnd_buffer_size = 8M
#myisam_sort_buffer_size = 256M
#thread_cache_size = 32
#query_cache_size = 150M
query_cache_size = 128M
query_cache_limit = 2M
query_cache_type = 1
#query_cache_min_res_unit = 2k
#thread_concurrency = 12
tmp_table_size =4G
#max_heap_table_size = 128M
performance_schema=ON

innodb_file_per_table
innodb_autoinc_lock_mode=2
innodb_buffer_pool_size = 8G
innodb_buffer_pool_instances=16
innodb_buffer_pool_chunk_size=256M
#innodb_io_capacity = 4000
#performance_schema = ON
innodb_log_file_size = 2G
innodb_log_buffer_size = 8M
innodb_flush_method = O_DIRECT_NO_FSYNC
innodb_flush_log_at_trx_commit = 2
innodb_stats_on_metadata=0
#innodb_parallel_read_threads=4
innodb_open_files=16384
innodb_sort_buffer_size=64M
innodb_read_io_threads=8
innodb_write_io_threads=8
innodb_io_capacity=1000
innodb_page_cleaners=16
#transaction-isolation = READ-COMMITTED
innodb_lock_wait_timeout = 5
#innodb_rollback_on_timeout=1
#binlog-format = MIXED

#innodb_use_native_aio = 0
#innodb_file_per_table

sync_binlog=0
max_binlog_size = 100M
max_connections=300
#max_user_connections=100
#wait_timeout=200
#interactive_timeout=500
slow_query_log=ON
long_query_time=2
log_slave_updates=OFF
innodb_log_compressed_pages=OFF
sql_mode=ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

!includedir /etc/mysql/conf.d/
icechieff
Posts: 48
Joined: Thu Aug 27, 2020 10:13 pm
Your location: Saint-Petersburg

db is just 1Gb, not so large...
icechieff
Posts: 48
Joined: Thu Aug 27, 2020 10:13 pm
Your location: Saint-Petersburg

today bought sas ssd, want to try to enable smart cache on raid controller.
User avatar
myVesta
Site Admin
Posts: 928
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 8 times
Been thanked: 6 times

icechieff wrote: Thu Feb 11, 2021 5:44 pm played with my.cnf
is it better now?
icechieff
Posts: 48
Joined: Thu Aug 27, 2020 10:13 pm
Your location: Saint-Petersburg

dpeca wrote: Thu Feb 11, 2021 6:25 pm
icechieff wrote: Thu Feb 11, 2021 5:44 pm played with my.cnf
is it better now?
no, don't think so.

with bought ssd hgst my hp dl160 gen8 don't want even start((( so serching for another solution(
icechieff
Posts: 48
Joined: Thu Aug 27, 2020 10:13 pm
Your location: Saint-Petersburg

today edited sysctl.conf after that have no ttfb more than 0,2-03, sec. if it will work after some time - will post my cfg

https://webpagetest.org/result/210213_D ... 01e129fba/
icechieff
Posts: 48
Joined: Thu Aug 27, 2020 10:13 pm
Your location: Saint-Petersburg

morning tests failed
https://webpagetest.org/result/210214_D ... 98e4e7a2f/

wtf...

la is low, db request too, srv is running with a lot of free resources...
icechieff
Posts: 48
Joined: Thu Aug 27, 2020 10:13 pm
Your location: Saint-Petersburg

some screenshots from cp
la.png
la.png (33.3 KiB)
mem.png
mem.png (24.19 KiB)
nginx.png
nginx.png (24.35 KiB)
apache.png
apache.png (25.7 KiB)
mysql.png
mysql.png (28.07 KiB)
Post Reply