Welcome to Geeklog Saturday, October 21 2017 @ 06:27 am EDT


Status: offline

1000ideen

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

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

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?

Status: offline

1000ideen

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

Status: offline

jmucchiello

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

Status: offline

1000ideen

Forum User
Full Member
Registered: 04/08/2003
Posts: 1289
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.

Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/2005
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.

Status: offline

1000ideen

Forum User
Full Member
Registered: 04/08/2003
Posts: 1289
The phpbb.de people say that about 30 users without a cookie are permanently on the homepage. http://www.phpbb.de/kb/cache_index 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.

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();
?>

Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/2005
Posts: 985
Quote by: ismael

@readfile($cachelink);die(); }


I would change that to
PHP Formatted Code

{
     @readfile($cachelink) AND die();
}
 

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.

Status: offline

1000ideen

Forum User
Full Member
Registered: 04/08/2003
Posts: 1289
@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:

All times are EDT. The time is now 06:27 am.

  • 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