What is MMCache ?
MMCACHE is Web Server with Load Balancing logic + Memcache Array
How it works?
1. One or multiple server produce html page.
2. MMCache save html page in memcache static or dynamic.
Config example:
# domain
[www.yellowpages.pl]
# memcache array dynamic expiration time 3600 sek IP:Port
cache=10.0.0.9:11213:3:0:3600,10.0.0.10:11213:3:0:3600
# memcache static dynamic expiration time one week IP:Port
cache_static=10.0.0.9:11214:3:0:604800
# server - source server any webserver
server=10.0.0.1:8080,10.0.0.2:8080,10.0.0.3:8080,10.0.0.4:8080,
replace_host=no
# which data we wish to save and serve from memcache
accept_types=text/*,application/x-javascript,image/*
# save css , pics , js and other in schema how many days in the memcache + how many days in browser cache
dir=/css/:7:7,/img2/:7:7,/pics/:7:7,/js/:7:7
# timeout for connection with source server in sek
timeout=10
# following cookie name make mmcache transparent, need then user is logged in
cookie=SID
Software Language : C++
How to check it ?
Please open Live Headers and start http://www.yellowpages.pl
You should see:
HTTP/1.x 200 OK
Content-Encoding: gzip
X-mmcache: 1 licensed to: Yellowpages.pl
Please make refresh and check css
http://www.yellowpages.pl/css/2/structure.css
HTTP/1.x 304 Not Modified
X-mmcache: 1
Connection: close
Depending of expiration time, next CSS request don’t be asked by your browser.
Next user request are serving from memcache.
Memcache stats :
STAT cmd_get 72565326
STAT get_hits 70526888
STAT get_misses 2038438
As you see over 90% data are from memory, thats mean your source server don’t need make heavy work.
Load Balancing with logic it isn’t simple round roubin.
| Host: 10.0.0.1:8080 | 467 | 610 | 680 | 10 | 740 | 670 | 620 | 760 | 10 | 570 | 0 |
| Host: 10.0.0.2:8080 | 369 | 550 | 770 | 800 | 590 | 980 | 0 | 0 | 0 | 0 | 0 |
| Host: 10.0.0.3:8080 | 410 | 840 | 420 | 510 | 990 | 1340 | 0 | 0 | 0 | 0 | 0 |
| Host: 10.0.0.4:8080 | 431 | 860 | 3450 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Next host… | |||||||||||
Costs :
Simple license without Load Balancer & Memcache Array - 79 EUR
Enterprise license MMcache with Load Balancer & Memcache Array - 249 EURO
more info : mmcache [at] mainseek.net
Why you need such software ?
During servicing different www projects based on the environment of at least LAMP, we have noticed that no matter how we use the application cache for returning results, e.g. Apache and PHP reading the data from memcache is drawn from that cache. Each Apache fork from php causes occupying a part of RAM and burdening CPU. In the effect, we are forced to add new www machines and balance with the traffic. If we have many services on one machine (hosting services), then after some time we have to transfer the service to another server. It means facing additional costs. Having that in mind, we have come to a conclusion that if we already have something in memcache, then we should draw it out and send it to the user’s browser, without engaging the apache webserver and php. That’s the origin of memcache.
To make things simple, it is a proxy server, which role is to collect data from the source server, save in whole with the compression in memcache and return it with every request of the user, storing the data for a definite period of time.
Technical
mmcache - is a simple proxy server between www server and the user’s browser - web accelerator . Its most important feature is using memcached for caching the data in memory. Thanks to it www server can be significantly relieved and the display of sites in the user’s browser can be accelerated. The key identifying the given site is designated from URL, so if for example there is a session in url, then proxy will not work effectively.
Start-up
Typically, mmcache should be started up on port 80 and the domain should be directed to the IP on which it being started up. Mmcache should be started in the catalogue (with saving rights) in which there is the configuration file (required). One must bear in mind that the application working on port 80 can be started up only from the account with root authorities. The parameters with which mmcache can be started up are the following:
-i ini_file - the name of configuration file (optionally with full path) - required parameter
-p port_number - port on which mmcache monitors (if not supplied, then it will get started up on port 80)
-d - start up as daemon
-r- respawn (automatic restart after unforeseen outlet)
-bindip ip_num - binding to the defined IP (by default bound to all local addresses on the given port)
-u user_name- changing the owner of the process (recommended if one starts up from root)
-keep_tmp - temporary files with content sent from webserver are not deleted (it makes sense to switch it on only for problem diagnosis)
-no_gzip - data which are stored in memcached are by default gzipped (this option makes the input data not gzipped)
