Author Topic: Hey Jan....Check out your baby in action....  (Read 8374 times)

0 Members and 1 Guest are viewing this topic.

Offline Ruben

  • Newbie
  • *
  • Posts: 28
    • View Profile
Hey Jan....Check out your baby in action....
« on: June 24, 2002, 10:57:20 PM »


http://www.wobpictures.com

I go to PHPMyAdmin and check out the processes and there are like maybe 15 that are locked....seems like 4Images does sleeping processes that lasts for minutes !

Anyway I can fix this problem without having to restart mySQL twice an hour? My server's gonna die soon if I can't fix a solution for this...

Is there a way you can write like, or create a script that will shut the site off to certain people when it overloads the server and like, it redirects them to a special notice page instead ?

Thanks..

-Ruben
-Ruben
World of Britney.com

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Hey Jan....Check out your baby in action....
« Reply #1 on: June 25, 2002, 12:19:04 AM »
Hi,

try to put this at the top of your global.php:
Code: [Select]
$max_load = 5.00;
$path = "/proc/loadavg";

$buffer = "0 0 0";
$fp = @fopen($path, "r");
if (!@feof($fp)) {
  $buffer = @fgets($fp, 1024);
}
@fclose($fp);
$load = explode(" ", $buffer);
$load_avg = max((float)$load[0], (float)$load[1], (float)$load[2]);
if ($load_avg > $max_load) {
  header("Location: ./path/to/too_busy.html");
  exit;
}


Hope this will help...


Greets Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Ruben

  • Newbie
  • *
  • Posts: 28
    • View Profile
Hey Jan....Check out your baby in action....
« Reply #2 on: June 25, 2002, 01:12:15 AM »
Thank you, would that code go above the <?php or above

if (!defined('ROOT_PATH')) {
  die("Security violation");
}


??

Thanks..

-Ruben
-Ruben
World of Britney.com

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Hey Jan....Check out your baby in action....
« Reply #3 on: June 25, 2002, 07:51:15 AM »
Below <?php

Greets Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Ruben

  • Newbie
  • *
  • Posts: 28
    • View Profile
Hey Jan....Check out your baby in action....
« Reply #4 on: June 25, 2002, 07:58:42 AM »
Jan,
Thanks for the response.
Well, it's working, but it's constantly going over 5.00.

Is there a way that you could do something about this problem? It seems like if the software does not support high traffic sites?

I was talking to someone yesterday and he looked over the config.php and main.php and said how yoou didn't use something called "pconnect" or something like that?

I have to set the load to 10.00 so that the archive can be acceptable without it redirecting the users to the too_busy page all the time.

Like I said, the database locks a bunch of processes as well as works silently on them for a long long time...

Anyway you could offer support for high traffic websites in future releases of the software (although I would sorta need help now) so that it can run smoothly now matter how many pictures it has?

Thanks.

-Ruben
-Ruben
World of Britney.com

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Hey Jan....Check out your baby in action....
« Reply #5 on: June 25, 2002, 08:14:37 AM »
Hi,

if you want to use persistent database connections, change in global.php:

Code: [Select]
$site_db = new Db($db_host, $db_user, $db_password, $db_name);
to:
Code: [Select]
$site_db = new Db($db_host, $db_user, $db_password, $db_name, 1);

Greets Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Hey Jan....Check out your baby in action....
« Reply #6 on: June 25, 2002, 08:23:19 AM »
Another things you can do is to disable the random image which needs high performance:

in constans.php you can change this line:
Set:
Code: [Select]
define('SHOW_RANDOM_CAT_IMAGE', 1);
to:
Code: [Select]
define('SHOW_RANDOM_CAT_IMAGE', 0);
This wil disable the category related random images. Instead, a random image of the whole archive will be displayed.

You can also disable all random images, just set
Code: [Select]
define('SHOW_RANDOM_IMAGE', 1);
to:
Code: [Select]
define('SHOW_RANDOM_IMAGE', 0);

Greets Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline kief24

  • Sr. Member
  • ****
  • Posts: 267
    • View Profile
Re: Hey Jan....Check out your baby in action....
« Reply #7 on: May 07, 2006, 08:36:11 AM »
Quote
Hi,

if you want to use persistent database connections, change in global.php:


Code:
$site_db = new Db($db_host, $db_user, $db_password, $db_name);
to:

Code:
$site_db = new Db($db_host, $db_user, $db_password, $db_name, 1);

Greets Jan


Is it interesting for performance to use persisent connections in 4images ?