Foros del Web » Programando para Internet » PHP »

Sobrecarga servidor php

Estas en el tema de Sobrecarga servidor php en el foro de PHP en Foros del Web. Hola! Mi servidor se sobrecarga y ya no se que hacer. El servidor usa php + mysql: [Algunas variables de Configuración] -httpd.conf Código: Timeout 120 ...
  #1 (permalink)  
Antiguo 05/11/2011, 05:46
 
Fecha de Ingreso: marzo-2008
Mensajes: 12
Antigüedad: 16 años, 1 mes
Puntos: 0
Sobrecarga servidor php

Hola!

Mi servidor se sobrecarga y ya no se que hacer. El servidor usa php + mysql:

[Algunas variables de Configuración]

-httpd.conf
Código:
Timeout 120
KeepAlive Off
-php.ini
Código:
safe_mode = Off
max_execution_time = 90 
max_input_time = 90
parsing request data
memory_limit = 250M
-my.cnf (archivo completo)
Código:
[mysqld]
connect_timeout = 5
interactive_timeout= 50
join_buffer_size = 1M
key_buffer = 256M
max_allowed_packet = 16M
max_connections = 300
max_connect_errors = 10
myisam_sort_buffer_size= 64M
read_buffer_size = 2M
read_rnd_buffer_size= 2M
sort_buffer_size = 2M
table_cache = 1024
thread_cache_size = 100
thread_concurrency = 4
wait_timeout = 5
query_cache_size = 128M
query_cache_limit = 1M
query_cache_type = 1
default-storage-engine = MyISAM
long_query_time= 10
log-slow-queries=/var/log/mysql/log-slow-queries.log

query-cache-type = 1
query-cache-size = 40M

He observado que en log-slow-queries.log aparecen entradas como:

Código:
# Query_time: 41.507906  Lock_time: 0.000268 Rows_sent: 0  Rows_examined: 2573
SET timestamp=1320492110;
select id,merchant,image_url,price,name,logo,dupe_hash from PT_products where match (name) against ('Live') and match(name) against ('At') and match (name) against ('The') order by rand() LIMIT 16;

# Query_time: 100.804454  Lock_time: 0.000258 Rows_sent: 5  Rows_examined: 4976
SET timestamp=1320492101;
select id,merchant,image_url,price,name,logo,dupe_hash from PT_products where match (name) against ('SURVIVAL-GUIDE-TO-THE-GPST-GPVTS-SELECTION-CENTRE-GP') and match(name) against ('RECRUITMENT') and match (name) against ('STAGE') order by rand() LIMIT 16;
Esas consultas cuando las realizo yo tardan 1seg o muy poco. La base de datos es de 400.000 entradas y estamos hablando de una tienda online. Alguien sabe donde puede estar el problema?

Para 'solucionar' el problema de sobrecarga he añadido este cron:
*/15 * * * * sync ; echo 3 > /proc/sys/vm/drop_caches

Con esto libero memoria cada quince minutos pero no se muy bien que efectos negativos tendra a largo plazo.


Datos del servidor:

Código:
Intel 2.4 Ghz P4 Celeron 
Generic 1024 MB DDR 266 
Generic 1024 MB DDR 266 
Apache 2.0.63
PHP 5.3.8
Mysql 5.5.17

Un saludo y miiiiil gracias!

Etiquetas: mysql, servidor, sobrecarga, sql, variables
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:37.