Welcome to Geeklog Tuesday, November 19 2019 @ 03:44 pm EST

Geeklog Forums

every 2 minutes cache of frontpage


Status: offline

1000ideen

Forum User
Full Member
Registered: 04/08/03
Posts: 1294
The folks at phpBB seem to have had a very good idea. They use a "soft" form of caching the index page only.

[url]http://translate.google.com/translate?hl=de&u=http%3A%2F%2Fwww.phpbb.de%2Fdoku%2Fkb%2Fartikel.php%3Fartikel%3Dcache_index&sl=de&tl=en[/url]

A crontab produced an html file of the front page every two minutes and produces it for guest only. phpBb identifies guest by the cookie.

Would this be possible for Geeklog too, also on webspace withough the possibility to run shell scripts?
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 04/08/03
Posts: 1294
I think this was a pretty cool idea. Wouldn`t that be a good solution for high traffic Geeklogs?
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/05
Posts: 985
What happens to the "Welcome to Geeklog, Fred" if you cache the home page?
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 04/08/03
Posts: 1294
The index.htm is only being presented to those who have no cookie of that site. All the others who login or have a language or theme cookie will be presented the index.php / normal Geeklog.

So this cacheing of the front page takes away some load and it is a concept the people of phpbb have some experience with.
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/05
Posts: 985
Then how much improvement you would see depends on how much of your traffic logs in or doesn't. A community site would probably see less benefit from a news for the world site.
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 04/08/03
Posts: 1294
The phpbb.de people say that about 30 users without a cookie are permanently on the homepage. [url]http://www.phpbb.de/kb/cache_index[/url] This is probably because google leads them to the homepage as they are looking for "phpbb". There is a crontab running every 2 minutes to cache the homepage.

I tried that manually with GL and made an index.htm homepage. Most registered users didn`t notice the difference. They log in or have a cookie already and go to the forum anyway. This was not a perfect test but I wanted to see any potential problems.

Anyway I don`t really have a high traffic site and one needs to measure the difference.
 Quote

ismael

Anonymous
I need something kind of cache. My site has a lot of traffic and i have problems with 500 users online. Too many data base connections.

i've read this but i don't know if it will be good for geeklog:

.htaccess:

php_value auto_prepend_file /home/user/public_html/start_cache.php
php_value auto_append_file /home/user/public_html/end_cache.php

start_cache.php:

<?
$settings_cachedir = '/home/user/public_html/cache_files/';
$settings_cachetime = 3600; //keep cache files for 3600 seconds (1 hour)
//Pagina php
$thispage = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$cachelink = $settings_cachedir.md5($thispage).".html";
if (@file_exists($cachelink)) {
$cachelink_time = @filemtime($cachelink);
if ((time() - $settings_cachetime) < $cachelink_time) { @readfile($cachelink);die(); }
}
ob_start();
?>

end_cache.php:

<?
$fp = fopen($cachelink, 'w'Wink;@fwrite($fp, ob_get_contents());@fclose($fp);ob_end_flush();
?>
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/05
Posts: 985
Quote by: ismael[p]@readfile($cachelink);die(); }[/p]

I would change that to
[code]
{
@readfile($cachelink) AND die();
}
[/code]
This way, if for some reason the cache file isn't found, the code attempts to generate and recache the file instead of dying with no output.

The other issue with this code is if your site generates any kind of headers, the cache won't save them.
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 04/08/03
Posts: 1294
@ismael it would be great if you could give some feedback later on with your experience and some data on how the situation improved Exclamation

How many of those 500 users are registered and have a cookie? Are there many guests who go tho the front page Confused:
 Quote

All times are EST. The time is now 03:44 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content