Долгий старт

[Удален]
1900

Здравствуйте,

установил у себя сервер, core i3 2Ghz, 4gb ram,

на сервере стоит ubuntu, apache 2, nginx, php 5, mysql, apc,

nginx фронт

apache бак

проблема в том что если открывать сайт с сервера, то первоначально он долго запускается ( секунд 10), а после все шустро работает, такое ощущение что какой-то сервис висит в спящем режиме и когда происходит запрос он запускается, в общем не понятно в чем дело,

помогите разобраться плиз в чем причина долгого старта сайта?

сайт - http://yorto.ru/

R
На сайте с 14.02.2010
Offline
77
#1
iScreenager:
первоначально он долго запускается ( секунд 10)

первоначально, это после загрузки сервера что ли? или как? не совсем понятно...

[Удален]
#2
r0mik:
первоначально, это после загрузки сервера что ли? или как? не совсем понятно...

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

pupseg
На сайте с 14.05.2010
Offline
364
#3

у меня ваш сайт открылся достаточно шустро, правда из мира,а не с сервера.

Качественная помощь в обслуживании серверов. (/ru/forum/661100) Бесплатных консультаций не даю, не помогаю, не обучаю. Минималка от 100$. Как пропатчить KDE-просьба не спрашивать. Есть форумы (http://linux.org.ru) и полезные сайты (http://www.opennet.ru/).
R
На сайте с 14.02.2010
Offline
77
#4

ну это друпал, а там куча запросов к БД... скорей всего мускул нужно тюнить, а то оно постоянно с диска подымает базу. со временем кэш диска сбрасывается, отсбда и тормоза "первоначально".

покажите my.cnf еще лучше запустите http://launchpad.net/mysql-tuning-primer/trunk/1.5-r5/+download/tuning-primer.sh и покажите выхлоп...

хотя 10 секунд... у меня на ноуте после рестарта мускула и дропа кэшей выходит примерно 6сек. на холодную загрузку друпала. правда i7 и 7200-диск, но и друпал пожирней вашего явно...

Andreyka
На сайте с 19.02.2005
Offline
822
#5

Скорее всего стоит кеширование на уровне самого drupal

Не стоит плодить сущности без необходимости
[Удален]
#6
r0mik:
ну это друпал, а там куча запросов к БД... скорей всего мускул нужно тюнить, а то оно постоянно с диска подымает базу. со временем кэш диска сбрасывается, отсбда и тормоза "первоначально".

покажите my.cnf еще лучше запустите http://launchpad.net/mysql-tuning-primer/trunk/1.5-r5/+download/tuning-primer.sh и покажите выхлоп...

хотя 10 секунд... у меня на ноуте после рестарта мускула и дропа кэшей выходит примерно 6сек. на холодную загрузку друпала. правда i7 и 7200-диск, но и друпал пожирней вашего явно...

вот выхлоп скрипта


-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -

MySQL Version 5.1.49-1ubuntu8.1 x86_64

Uptime = 4 days 13 hrs 12 min 37 sec
Avg. qps = 0
Total Questions = 154782
Threads Connected = 2

Server has been running for over 48hrs.
It should be safe to follow these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10.000000 sec.
You have 0 out of 154803 that take longer than 10.000000 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.1/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 8
Current threads_cached = 7
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 151
Current threads_connected = 2
Historic max_used_connections = 10
The number of used connections is 6% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory
See "MEMORY USAGE" section to make sure you are not over-allocating

INNODB STATUS
Current InnoDB index space = 6 M
Current InnoDB data space = 7 M
Current InnoDB buffer pool free = 0 %
Current innodb_buffer_pool_size = 8 M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE
Max Memory Ever Allocated : 68 M
Configured Max Per-thread Buffers : 405 M
Configured Max Global Buffers : 42 M
Configured Max Memory Limit : 447 M
Physical Memory : 3.71 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 4 M
Current key_buffer_size = 16 M
Key cache miss rate is 1 : 916
Key buffer free ratio = 81 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 16 M
Current query_cache_used = 3 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 22.51 %
Current query_cache_min_res_unit = 4 K
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 2 M
Current read_rnd_buffer_size = 256 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 132.00 K
You have had 40 queries where a join could not use an index properly
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.
If you are unable to optimize your queries you may want to increase your
join_buffer_size to accommodate larger joins in one pass.

Note! This script will still suggest raising the join_buffer_size when
ANY joins not using indexes are found.

OPEN FILES LIMIT
Current open_files_limit = 1024 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine

TABLE CACHE
Current table_open_cache = 64 tables
Current table_definition_cache = 256 tables
You have a total of 169 tables
You have 64 open tables.
Current table_cache hit rate is 2%
, while 100% of your table cache is in use
You should probably increase your table_cache

TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 16 M
Of 3409 temp tables, 2% were created on disk
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 128 K
Current table scan ratio = 28302 : 1
You have a high ratio of sequential access requests to SELECTs
You may benefit from raising read_buffer_size and/or improving your use of indexes.

TABLE LOCKING
Current Lock Wait ratio = 0 : 155058
Your table locking seems to be fine

вот my.cnf


#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
default-character-set = utf8
# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
default-character-set = utf8
#
# * Basic Settings
#

#
# * IMPORTANT
# If you make changes to these settings and your system uses apparmor, you may
# also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
#

user = mysql
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1

log_error = /var/log/mysql/error.log

# Here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem



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

[mysql]
default-character-set = utf8
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer = 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/

iScreenager добавил 11.01.2011 в 13:39

Andreyka:
Скорее всего стоит кеширование на уровне самого drupal

как сделать чтобы кэш не собирался каждый раз после долгого отсутствия запросов к сайту?

DV
На сайте с 01.05.2010
Offline
644
#7

Вариант, что резолвится долго, не рассматривали? Что там с DNS?

VDS хостинг ( http://clck.ru/0u97l ) Нет нерешаемых задач ( https://searchengines.guru/ru/forum/806725 ) | Перенос сайтов на Drupal 7 с любых CMS. ( https://searchengines.guru/ru/forum/531842/page6#comment_10504844 )
[Удален]
#8
DenisVS:
Вариант, что резолвится долго, не рассматривали? Что там с DNS?

dns сервера у меня нет, использую freedns.afraid.org, т.к. у меня динамический ip.

и эта задержка только при первом запросе ...

Andreyka
На сайте с 19.02.2005
Offline
822
#9
iScreenager:

как сделать чтобы кэш не собирался каждый раз после долгого отсутствия запросов к сайту?

Настроить его в друпале должным образом

[Удален]
#10

Спасибо всем за помощь, похоже это было из-за крона, он автоматически запускается каждый час но через сайт, т.е. когда кто нибудь заходит на сайт.

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