PDA

View Full Version : in.php who connect to database only 1 time / hour?


cmedia
6th September 2009, 05:38 PM
Hello, i remeber was an option for large traffic site, to use the in.pohp without let the in.php connect each time to the database...

I check the manual but find 0 about.

I remember good or i just dream? :D

My site dont have4 too much traffic, 10-11.000 unique /day in home page, who is the only page who load the in.php

Anyway i try to put the in.php offline and all server was running much faster, specially mysql.

So i wonder if maybe will be better use in m y site this kind of in.ph to save mysql resource... :D

ICEFIRE
6th September 2009, 09:16 PM
10 - 15k traffic should be not a problem for CjOverkill even on a celeron/atom cheapest server. Check your server config because it should be running ok despite you use the default server config or not.

In any case, feel free to use this include instead of the traditional in.php include. Change the cookietime value to anything you want in seconds. It's at 300 seconds, or 5 minutes.


<?php
$cookietime=300;
$referer=$_SERVER["HTTP_REFERER"];
if($_COOKIE["overkill_in"]<time()-$cookietime){
setcookie("overkill_in", time(), time()+($cookietime*1));
include ("in.php");
}

?>

cmedia
6th September 2009, 10:44 PM
My server is not a dedicated, is a vps2 from hostv... Anyway for a vps is still a good one...

The "problem" is not cjoverkill, is other script such vshare i use on it, with a 100.000 page views/day.

In this situation cjoverkill in.php start to be "heavy" also because in mysql, cjoverkill is the only script with a database of 11-12mb, sometimes 14mb all other script i use, vshare too, are less then 1,4mb.

So when i try to see the site performace without in.php included i see the site "fly"... :D

So, cjoverkill i can optimize, vshare, NO.

So i opened here this topic... :D

This code set a cookie and avoid the in-php to be included when the suer is not an unique user in the last 24 hours, right? so cjoverkill will reduce the load for the in.php usually loaded from non unique user?

ICEFIRE
6th September 2009, 11:32 PM
The code I posted has the cookietime variable at 300 seconds. That's 5 minutes.
f course, you can make it the time you want.

One hour would be 3600 seconds. 12 hours would be 43200, etc...

cmedia
7th September 2009, 12:23 AM
Thank you very much.