Author Topic: Sobresaturacion en mi galeria  (Read 4206 times)

0 Members and 1 Guest are viewing this topic.

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Sobresaturacion en mi galeria
« on: June 15, 2007, 12:32:56 PM »
ultimamente he tenido sobresaturacion en mi galeria. Cuando hay muchos usuarios. La web se inhabilita durante unos segundos porque hay mas del 20% de cpu del hosting

Estos son los datos de mi host:
It is parked courtesy BlueHost.com
Offering 50GB Space, 999GB Bandwidth, and 6 Domains on 1 Account for only $6.95/Month.

que puedo hacer para saber que algoritmo he hecho mal?? he intentado con mysql_stat(); pero nose donde ponerlo para ver los resultados.
creo que tengo sobrecarga desde que tengo instalados los siguientes mods:
http://www.4homepages.de/forum/index.php?topic=8682.0 <- Es un menu que carga en page_header

y este que he hecho yo para ver las 6 ultimas imagenes en los detalles de la imagen del usuario que la envio
en details:
antes de :
Code: [Select]
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email")."
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_id = $image_id AND c.cat_id = i.cat_id";
$image_row = $site_db->query_firstrow($sql);
$cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;

tengo esto:

Code: [Select]
$sql = "SELECT i.image_id, i.cat_id, i.user_id
        FROM (".IMAGES_TABLE." i)
        WHERE i.image_id = $image_id";
$image_row = $site_db->query_firstrow($sql);
$cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;
//-----------------------------------------------------
//--- START Show user images in profile ---------------
//-----------------------------------------------------
$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
  $imgtable_width .= "%";
}

$additional_sql = "";
if (!empty($additional_image_fields)) {
  foreach ($additional_image_fields as $key => $val) {
    $additional_sql .= ", i.".$key;
  }
}

$user_images = 6; // SET HERE HOW MUCH IMAGES SHOULD BE SHOWN

$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_date, i.image_active,  i.image_media_file, i.image_thumb_file, i.image_hits, c.cat_name
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = ".$image_row['user_id']." AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
        ORDER BY i.image_date DESC
        LIMIT $user_images";

$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
if (!$num_rows)  {
  $user_profile_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  $user_profile_images .= $lang['no_new_images'];
  $user_profile_images .= "</td></tr></table>";
}
else  {
  $user_profile_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  $count = 0;
  $bgcounter = 0;
  while ($image_row1 = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $user_profile_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $user_profile_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";
if(in_array($image_row1['cat_id'],$links_cat)){
    show_image_links($image_row1);
    $user_profile_images .= $site_template->parse_template("thumbnail_links_bit2");
}else{
    show_image($image_row1);
    $user_profile_images .= $site_template->parse_template("thumbnail_bit_last_images");
    }
$user_profile_images .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $user_profile_images .= "</tr>\n";
      $count = 0;

    }
  } // end while
 
  if ($count > 0)  {
    $leftover = ($config['image_cells'] - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $user_profile_images .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $user_profile_images .= "</tr>\n";
    }
  }
  $user_profile_images .= "</table>\n";
} // end else

$site_template->register_vars("user_profile_images", $user_profile_images);
unset($user_profile_images);
//-----------------------------------------------------
//--- END Show user images in profile -----------------
//-----------------------------------------------------

alguien sabe como puedo solucionar estos problemas?? Tambien he hecho que los 5 ultimos mensajes en el guestbook se vean en profile, y las ultimas 12 canciones favoritas se escuchen... y que los 3 ultimas imagenes favoritas se vean al igual que las 6 ultimas imagenes añadidas por el usuario en memberprofile (de nicky el ultimo)

mi web es: http://www.myart.es Como puedo optimizarla??? alguien sabe como puedo arreglar este gran problema???

:arrow: 4images Paid Mods: Links, Blog, Albums, Subdomains for users, Diferent templates for user profile, Related picture in details, Last pictures in details.
And the mod that you request me.   Demo: http://www.myart.es

A website dedicated to artist people who loves drawing, design, writing and more

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: Sobresaturacion en mi galeria
« Reply #1 on: June 16, 2007, 02:02:34 AM »
nadie sabe como optimizar la galeria??? o una web que tiene acceso a la base de datos y hace muchas consultas?
:arrow: 4images Paid Mods: Links, Blog, Albums, Subdomains for users, Diferent templates for user profile, Related picture in details, Last pictures in details.
And the mod that you request me.   Demo: http://www.myart.es

A website dedicated to artist people who loves drawing, design, writing and more

Offline excitex2

  • Addicted member
  • ******
  • Posts: 1.590
  • He desactivado la galería y el buscador
    • View Profile
Re: Sobresaturacion en mi galeria
« Reply #2 on: June 17, 2007, 06:00:24 PM »
Saludos amiga,,,

Si tienes instalado el MOD de motores de búsqueda ,,, lee este post : http://www.4homepages.de/forum/index.php?topic=8535.0[/b]]http://www.4homepages.de/forum/index.php?topic=8535.0 .

excitex
Lo importante no es saber,,, lo importante es tener el E-Mail de quien sabe