VPS и сайты на WordPress

12
Plutishe
На сайте с 06.03.2006
Offline
205
1420

Добрый день, знатоки!

VPS и пару десятков мало посещаемых сайтов на WP, заметно притормаживают при открытии страниц.

Подскажите что "покрутить" в конфигах системы (ngnix, apache, mysql).

la: 0.39, 0.61, 0.51

Mem: 2097152к total, 1052280k used, 1044872 free

115240k cached

2000 MHz / 2 GB RAM/ OVZ / Ubuntu 12.04 x86/ mpm.itk

Ngnix:

user  nginx;

worker_processes auto;
timer_resolution 100ms;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

server_tokens off;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

gzip on;
gzip_http_version 1.1;
gzip_disable msie6;
gzip_types text/plain application/xml application/x-javascript text/css;

include /etc/nginx/conf.d/stub.conf;

include /usr/local/ispmgr/etc/nginx.domain;
client_max_body_size 512M;

apache:

# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100
Options Includes FollowSymLinks MultiViews

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5

##
## Server-Pool Size Regulation (MPM specific)
##

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadLimit: ThreadsPerChild can be changed to this maximum value during a
# graceful restart. ThreadLimit can only be changed by stopping
# and starting Apache.
# ThreadsPerChild: constant number of worker threads in each server process
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 150
MaxRequestsPerChild 0
</IfModule>

# event MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_event_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 150
MaxRequestsPerChild 0
</IfModule>

<IfModule itk.c>
StartServers 2
MinSpareServers 2
MaxSpareServers 4
ServerLimit 110
MaxClients 100
MaxRequestsPerChild 1000
</IfModule>

Спасибо.

Хостинг за РУБЛИ (http://yousite.ru/h) | VPS/VDS на платформе: XEN c администрированием (http://yousite.ru/v) | Регистрация доменов (http://yousite.ru/d)
K5
На сайте с 21.07.2010
Offline
209
#1
la: 0.39, 0.61, 0.51
Mem: 2097152к total, 1052280k used, 1044872 free
115240k cached

исчерпывающие исходные данные 🤪

хоть бы конфиг какой показали 🍿

аська 45два48499два записки на работе (http://memoryhigh.ru) помогу с сайтом, удалю вирусы, настрою впс -> отзывы ТУТ (/ru/forum/836248) и ТАМ (http://www.maultalk.com/topic140187.html) !!!всегда проверяйте данные людей, которые сами пишут вам в аську или скайп!!!
Plutishe
На сайте с 06.03.2006
Offline
205
#2

MySQL (mariadb):

# * Client Settings

[client]
default-character-set = utf8
socket = /var/run/mysqld/mysqld.sock

[mysqld]
# * Basic Settings
character_set_server=utf8
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
skip-external-locking

skip-networking
#port = 3306
#bind = 127.0.0.1
tmpdir=/var/lib/tmp_mysql
default-storage-engine = MyISAM

# * Fine Tuning
max_allowed_packet = 16M
max_connections = 100
key_buffer_size = 64M
thread_cache_size=64
sort_buffer_size = 2M
read_buffer_size = 1M
bulk_insert_buffer_size = 16M
tmp_table_size = 32M
max_heap_table_size = 32M

# * MyISAM

table_open_cache = 400
read_rnd_buffer_size = 1M
myisam_sort_buffer_size = 128M

# * Query Cache Configuration

query_cache_size = 128M
query_cache_limit = 2MB

thread_stack = 256K
table_cache = 256

# * InnoDB

innodb_file_per_table=1
innodb_data_file_path=ibdata1:10M:autoextend
innodb_buffer_pool_size = 64M
innodb_log_file_size = 50M
innodb_flush_log_at_trx_commit=2
innodb_open_files = 400
innodb_io_capacity = 400
innodb_flush_method = O_DIRECT
character-set-server = utf8

#userstat=1

[mysqldump]
quick
quote-names
max_allowed_packet = 16M
default-character-set = utf8

[mysql]
no-auto-rehash

default-character-set = utf8
[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M

[mysqlhotcopy]
interactive-timeout
Andreyka
На сайте с 19.02.2005
Offline
822
#3

Советую это

Не сможете сами - обращайтесь

Не стоит плодить сущности без необходимости
K5
На сайте с 21.07.2010
Offline
209
#4

определитесь с версией maria (соответствующей mysql) и уберите 1 из параметров:

table_open_cache = 400
table_cache = 256

что mysql-tuner говорит?



---------- Добавлено 10.06.2014 в 21:19 ----------

апач

Timeout 30

.....

StartServers 5

MinSpareServers 7

MaxSpareServers 7

ServerLimit 30

MaxClients 30

Plutishe
На сайте с 06.03.2006
Offline
205
#5
kgtu5:

что mysql-tuner говорит?


-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.5.37-MariaDB-1~precise
[OK] Operating on 32-bit architecture with less than 2GB RAM

-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 65M (Tables: 778)
[--] Data in InnoDB tables: 1M (Tables: 21)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[!!] Total fragmented tables: 89

-------- Performance Metrics -------------------------------------------------
[--] Up for: 7m 11s (3K q [9.030 qps], 874 conn, TX: 9M, RX: 329K)
[--] Reads / Writes: 98% / 2%
[--] Total buffers: 304.0M global + 4.4M per thread (100 max threads)
[OK] Maximum possible memory usage: 741.5M (36% of installed RAM)
[OK] Slow queries: 0% (0/3K)
[OK] Highest usage of available connections: 3% (3/100)
[OK] Key buffer size / total MyISAM indexes: 64.0M/22.9M
[!!] Key buffer hit rate: 92.8% (5K cached / 398 reads)
[!!] Query cache efficiency: 19.7% (694 cached / 3K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 164 sorts)
[OK] Temporary tables created on disk: 15% (78 on disk / 509 total)
[OK] Thread cache hit rate: 99% (3 created / 874 connections)
[!!] Table cache hit rate: 5% (256 open / 5K opened)
[OK] Open file limit used: 48% (499/1K)
[OK] Table locks acquired immediately: 100% (1K immediate / 1K locks)
[OK] InnoDB data size / buffer pool: 1.0M/64.0M

-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inaccurate
Enable the slow query log to troubleshoot bad queries
Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
query_cache_limit (> 2M, or use smaller result sets)
table_cache (> 256)

Перезапустил с новыми параметрами, завтра ещё раз тюнером пройдусь.

Romka_Kharkov
На сайте с 08.04.2009
Offline
485
#6

Plutishe, почитай мою тему вот тут Я уже колупался с mysql-tuner правда на generic mysql.

Есть около 15.000 ipv4 !!! (http://onyx.net.ua/price.php#ipv4) Качественный хостинг с 2005 года - лучшее клиентам! (http://onyx.net.ua/)
AC
На сайте с 07.12.2013
Offline
51
#7

Пока не будет проведен полноценный очный аудит вашей системы с анализом всех аспектов ее работы, вам будет трудно дать какой-либо вменяемый совет по ее оптимизиции. Никакие конфиги, выложенные на форуме не дадут целостной картины.

Обращайтесь.

Skype: anton_chudesnikov

email: sysbooter@inbox.ru

K5
На сайте с 21.07.2010
Offline
209
#8

ТС

MySQL version 5.5.37-MariaDB-1~precise

все же правильный


table_open_cache = 500

table_cache - устаревший параметр с версии 5.1

если в апаче согласно моего совета поставили ServerLimit 30, то в мускл max_connections = 40

Plutishe
На сайте с 06.03.2006
Offline
205
#9

Выполнил некоторые рекомендации тюнера, 24 часа прошло, отчёт:


-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.5.38-MariaDB-1~precise
[OK] Operating on 32-bit architecture with less than 2GB RAM

-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 65M (Tables: 778)
[--] Data in InnoDB tables: 1M (Tables: 21)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[!!] Total fragmented tables: 97

-------- Performance Metrics -------------------------------------------------
[--] Up for: 1d 1h 0m 1s (499K q [5.554 qps], 15K conn, TX: 2B, RX: 66M)
[--] Reads / Writes: 95% / 5%
[--] Total buffers: 208.0M global + 4.4M per thread (40 max threads)
[OK] Maximum possible memory usage: 383.0M (18% of installed RAM)
[OK] Slow queries: 0% (4/499K)
[OK] Highest usage of available connections: 77% (31/40)
[OK] Key buffer size / total MyISAM indexes: 64.0M/22.9M
[!!] Key buffer hit rate: 93.4% (1M cached / 83K reads)
[OK] Query cache efficiency: 39.9% (267K cached / 670K selects)
[!!] Query cache prunes per day: 21618
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 22K sorts)
[OK] Temporary tables created on disk: 22% (18K on disk / 83K total)
[OK] Thread cache hit rate: 99% (31 created / 15K connections)
[!!] Table cache hit rate: 0% (500 open / 543K opened)
[OK] Open file limit used: 11% (941/8K)
[OK] Table locks acquired immediately: 99% (155K immediate / 155K locks)
[OK] InnoDB data size / buffer pool: 1.0M/64.0M

-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
Enable the slow query log to troubleshoot bad queries
Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
query_cache_size (> 32M)
table_cache (> 500)
Andreyka
На сайте с 19.02.2005
Offline
822
#10

У вас неверный подход

Вы получаете молотком по лбу и смотрите чем лучше помазать - йодом, зеленкой или налепить пластырь.

Достаточно просто не получать по лбу.

12

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий