Wednesday, February 29, 2012

Opera Mobile 12 and HTML5

Awesome :)

Web GL rendering is very smooth



Wednesday, February 15, 2012

Memcached Overview

 General

What is memcached:  "Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load." You may want to visit: Memcahed Wiki.

Memcached is developed in C programming language so that makes it cross platform and many other languages  have API interfaces to it so it can be used with lot of other technologies.

Installation

Installation on linux is a breeze :)  just run this command in terminal

- sudo apt-get install memcached

I got to a problem when installing memcached with a missing library pcre.h 
Well run this command in terminal

- sudo apt-get install libpcre3-dev


And I found this blog with the answer for this at pcre.h missing
Memcached has some default settings which are best for most server configurations so select all defaults when installing. If you have some special requirements visit the conf page .

If you want to use Memcached with PHP you will need PECL extension called memcache which is not included by default with PHP package, so you have install it manually. Open terminal and run this command

- sudo pecl install memcache

Accept all defaults. Once it is built and installed you may need to add this line to your php.ini file

- extension=memcache.so

into you extension section.

Well thats it for the installation, you are ready for caching :)

 Tutorial

When starting up with Memcached I recomend reading of the Caching story :) and also to illustraded one :)

So the basic idea of memcached is to store all your server adresses in an array like this

$MEMCACHE_SERVERS = array(
   "10.1.1.1", //web1
   "10.1.1.2", //web2
   "10.1.1.3", //web3
);

and put them into a memcache object like this

$memcache = new Memcache();
    foreach($MEMCACHE_SERVERS as $server){
    $memcache->addServer ( $server );
}


The next thing you should do is to use memcached i.e utilize the caching systems on all your servers in the cluster. In this example we have 3 with one 1 GB RAM, so that means 3 GB of distributed cache.

 Illustrations

Below are some images I made about memcahed usage and structure







Wednesday, February 8, 2012

PHP Accelerators Overview

When you have a dynamic web application that has a need of big payload of data at once you will need a caching management system that will optimize the loading process by scheduling what, how much and when to be loaded. Of course there are several PHP extensions that are available. But first to mention is that there are two levels of optimizing the loading of the data in a web appication:

level 1: local optimization
level 2: distributed (over several application servers)

maybe level 3: (disk caching if plausible)

level 1: For the first level now there are several well known accelerators like APC(Alternative PHP Cache), eAccelerator, XCache. Here is a wikipedia page for them opcode php cachers. The most popular is APC which will be built into the next versions of the php, probalbly 5.5 or newer.  APC and alike are very useful for bytecode caching i.e when you have many php pages to load it would be better to have them cached in memory rather than load them with each php request. But in either case you can use also data caching. When the data is distributed you have to use something else.

level 2: The second level is for web applications that are distributed accross several web application servers and have need of distributed data. Here comes into place one and well know caching system called memcached (http://memcached.org/)