[TYPO3-english] Fork of Typo3 ?

Artemy Nikolsky artemy.nikolsky at gmail.com
Mon Feb 23 18:25:53 CET 2009


"Dmitry Dulepov" <dmitry at typo3.org> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ: 
news:mailman.1.1235319059.10483.typo3-english at lists.netfielders.de...
> Hi!
>
> Artemy Nikolsky wrote:
>>  Pentium D 2,8GHz CPU/4Gb RAM, 4x7200rpm IDE HDD (RAID10)
>
> RAM is your bottleneck.
>
>> apache1.3/mod_php for typo3, lighthttpd for static file - max 30 request 
>> to
>
> Apache 1.3???
>
>> But this bad theory because we had one big problem. After published good
>> news a server received more than 3000 page request per second lasting not
>> more than a half an hour. It gave many competing apache child processes
>> (load average> 20), severe swopping, dead 80 port and many the lost 
>> money.
>
> Yes, it sounds bad. But if you expect such peaks you need better hardware 
> and may be several servers. Even static pages will not work on your 
> hardware with 3000 rq/s.
>
To buy many hardware it`s
1) very boring  =)
2) And it is not always possible (DC have not empty seat)
3) Very long (I wait  2-3 weeks delivery of a server  + 1 week for stress 
testing )
4) And banal: no money (hello crisis)
5) etc..

>> The fast decision for such loading was to make dirty patches typo3 core 
>> and
>> ext for active use memcached, to remove apache and lithhttpd, to start 
>> such
>> scheme:
>
> Better made good patches, not dirty. And submit them to our bug tracker.

Typo3 Very big, it has many very perfect decisions in typo3core. Anyone will 
find in typo3 that is necessary for him. But it will be only 1 % from all 
possibilities. For everyone this percent will be a miscellaneous.

I think if somebody needs such path, He should think will get rid of 99 % of 
redundancy and to be free in the decision of the narrow problem. We cannot 
compile the typo3 as *nix

But I can share experience

>
> Memcached support is coming in 4.3.
Yes, but it look:
mamcache <=> typo3 <=> webserver
and all page request go to php/typo3/mysql and it demands much RAM

I spoke about such sheme:
typo3 <==> memcatch <==> webserver


I have now no those source codes, but it is very simple idea:

switch off all log on a server
--------------------------------------------------------------
index.php
//first line
ob_start();

//last line:
$page = ob_get_contents();


if(strpos($page,'Page is being generated') !== false){
    ob_flush();
}else{
    $M = new memcache();
    $M->connect('localhost', 11211);
    // $page = gzencode($page); // It`s can be not bad idea
    $M->set($M, $_SERVER['REQUEST_URI'], $page);
    ob_end_clean();
}

--------------------------------------------------------------
nginx config:
server {
    ...........
    location / {
        set             $memcached_key   "$uri";
        memcached_pass  localhost:11211;
        error_page      404 502 504 = @fallback;
    }

    location @fallback {

                        fastcgi_pass unix:/var/run/php-fpm.soket;
                        fastcgi_index  index.php;
                        root /path/to/webserver/dir/;
                        fastcgi_param  SCRIPT_FILENAME 
/path/to/webserver/dir$fastcgi_script_name;
                        include fcgi_params;
    }
    .........
}

--------------------------------------------------------------
For updating pages in memcache from BE

class OffLineJob {
 static $jobList = array();
 static function add($uri){
  $this->jobList[] = $uri;
 }
 static function go()
 {
  fastcgi_finish_request(); // browser close connect (php-fpm feature)
  foreach(self::$jobList as $v)
  {
   while(strpos(file_get_contents(urlencode($v)),'Page is being generated') 
=== false){
    sleep(2);
   }
  }
 }
}

In extension: OffLineJob::add($urlOfUpdatingPage);
In last line of BE sourse: OffLineJob::go();
--------------------------------------------------------------
If dynamic blocks on page using php only for updating are necessary, you are 
able to do it:
1) will replace the dynamic block in a template on <! - # include virtual = 
"full_page_url / __ dinamicBlockName"->
2) to forbid display "Page is being generated" in typo3


For example: for one page 20 (html/css/js/img) sockets will be opened.  it 
will demand only 250 byte * 20 = 5kb RAM
+ Very fast copyings of a content of answers from memory to system buffers

Now for maximum performance only system buffers and tcp a stack should be 
set up correctly

It was very good for a news site in my case. Because average time of 
interest to one news only 30 minutes. 95 % of inquiries come on a maximum of 
10 pages. On 1000 page/request only 5-15 request to typo3 for updating 
(comments, voting).



> -- 
> Dmitry Dulepov
> TYPO3 core team
> "Sometimes they go bad. No one knows why" (Cameron, TSCC, 
> "Dungeons&Dragons") 




More information about the TYPO3-english mailing list