Software Architecture

[article] [edit page] [discussion] [history]

From AMF Wiki

(Redirected from SoftwareArchitecture)


Why on Apache ?

For more 370,000,000 reasons

The Apache Web Server is the usest webserver in the world, over 60% of the market for top server use Apache as Web Server.


AMF Suite Architecture

This is the philosofy of the AMF project, the AMF is a perl module of Apache that use mod_perl2 API



“mod_perl is an optional module for the Apache HTTP server. It embeds a Perl interpreter into the Apache server, so that dynamic content produced by Perl scripts can be served in response to incoming requests, without the significant overhead of re-launching the Perl interpreter for each request. As Lincoln Stein defined mod_perl in his words: “ mod_perl is more than CGI scripting on steroids. It is a whole new way to create dynamic content by utilizing the full power of the Apache web server to create stateful sessions, customized user authentication systems, smart proxies and much more. Yet, magically, your old CGI scripts will continue to work and work very fast indeed. With mod_perl you give up nothing and gain so much! ” mod_perl can emulate a Common Gateway Interface (CGI) environment, so that existing Perl CGI scripts can benefit from the performance boost without having to be re-written. Unlike CGI (and most other web application environments), mod_perl provides complete access to the Apache API, allowing programmers to write handlers for all phases in the Apache request cycle, manipulate Apache's internal tables and state mechanisms, share data between Apache processes or threads, alter or extend the Apache configuration file parser, and add Perl code to the configuration file itself, among other things.”

(from wikipedia)

Inside AMF

In the next picture is described how the AMF modules works together:


The AMF<Device Repository>Filter is the most important module, and a requirement for all other AMF modules except AMFCarrierDetection. This module is for Device Detection and pass the information for all other modules.

Advanced Caching System

Make device detection is complex and burdensome for the CPU, since it must perform the following steps:

  • read the UserAgent
  • understand the id of DeviceRepository (any Device Repository supported by AMF
  • obtain information that is organized tree
  • give the information collected

for this reason it was implemented an advanced caching mechanism.

The are two type of caching system:

The Apache Mobile Filter when it has identified a mobile device, stores the capabilities in a persistent cache (filesystem)


The Apache Mobile Filter when it has identified a mobile device, stores the capabilities using memcached ( Ideal solutions in cluster architectures.



the advantage to use this solution is explain clearly here:

“memcached allows you to take memory from parts of your system where you have more than you need and make it accessible to areas where you have less than you need.

memcached also allows you to make better use of your memory. If you consider the diagram to the right, you can see two deployment scenarios:

  • Each node is completely independent (top).
  • Each node can make use of memory from other nodes (bottom).

The first scenario illustrates the classic deployment strategy, however you'll find that it's both wasteful in the sense that the total cache size is a fraction of the actual capacity of your web farm, but also in the amount of effort required to keep the cache consistent across all of those nodes.

With memcached, you can see that all of the servers are looking into the same virtual pool of memory. This means that a given item is always stored and always retrieved from the same location in your entire web cluster.

Also, as the demand for your application grows to the point where you need to have more servers, it generally also grows in terms of the data that must be regularly accessed. A deployment strategy where these two aspects of your system scale together just makes sense.

The illustration to the right only shows two web servers for simplicity, but the property remains the same as the number increases. If you had fifty web servers, you'd still have a usable cache size of 64MB in the first example, but in the second, you'd have 3.2GB of usable cache.

Of course, you aren't required to use your web server's memory for cache. Many memcached users have dedicated machines that are built to only be memcached servers.”*

Configuration AMF+ filter
AMF and mod_rewrite
Personal tools