Dynamic web page creation needs a convenient and powerful server-side web framework. It is slow and difficult to create a functional and appealing dynamic web application using the legacy CGI protocol. Its interface is too low level and it provides little assistance to manipulate server-side data, render UI elements, and manage Ajax interactions.
In contrast, environments such as the ESP provide much more support for dynamic web content. However, not all frameworks are equally suited for embedded applications
Appweb provides a rich set of options to use when creating web pages or web applications. This document compares the alternatives and suggests where each option is best deployed.
Embedded Server Pages
ESP is a fast, efficient web framework that provides HTML templates, caching, Model-View-Controller paradigm, and an application and scaffold generator. ESP uses the "C" language code embedded in web pages for native-speed execution. It is very fast and compact.
To prevent name clashes on Linux and MacOSX, when Appweb is installed, the "esp" program built by Appweb will be named "appweb-esp". This prevents clashing with the "esp" program installed by the stand-alone ESP installation.
For more information about ESP, please see the ESP Web Site.
The action handler is a simple Appweb request handler that maps URIs to C functions. It does not provide any other infrastructure or capabilities other than those offered by the Appweb APIs. Action routines are very fast, as there is very little code run before invoking the action. The action handler is ideal for simple bindings from URI to C code. Read more in the Developer's Guide under Action Handler.
PHP is a widely-used general-purpose scripting language that is especially suited for enterprise Web development. It provides an object-oriented programming language, numerous extensions and a broad developer community. The power of PHP comes at a price, it typically has a memory footprint of more than 5 MB for the PHP code alone. For embedded systems, this is often too big and so we recommend using ESP instead.
Common Gateway Interface (CGI)
CGI stands for the Common Gateway Interface and it is the legacy extension interface for running external programs to generate dynamic data. It is standard but slow. Unless you have legacy CGI programs or need to run a scripting language via CGI, you are better served by using either ESP. For more information, please read Using CGI.
FastCGI is an optimized CGI and is the preferable way to run CGI programs or to run PHP applications.
Whereas CGI launches a new process to serve each and every request, FastCGI launches one or more CGI applications and then maintains a persistent connection to server multiple requests.
For embedded devices and applications: we recommend using ESP. It provides the fastest, most compact web framework without compromising on functionality.
The following table may help summarize the differences:
|Target Use||Web user interfaces, comms services||Simple C functions to serve content||Have existing CGI program||Enterprise web pages and forms|
|Memory (excluding core Appweb)||200K plus app code||5K||External program||20-50MB plus app code|
|Performance||Very fast||Fast||Very slow||Medium speed but large memory consumption|
|Advantages||Efficient and powerful framework||Simple, fast processing||Standard in wide-use||Large base of PHP code and developers|
|Disadvantages||No enterprise connectivity to MySQL||No web templates or higher-level functionality||Slow. Limit to forms. Low functionality||Large memory footprint|