DRAFT IN PROGRESS |
|
PLEASE DON'T EDIT UNLESS YOU ASKED FOR. |
|
Locked by: Artyom |
Locked by: --- |
|
## Introduction |
|
CppCMS is a web development framework for performance |
demanding applications. It enables improvement of over |
an order of magnitude in performance, hardware real |
estate requirements and power consumption for a typical |
industrial web site. |
|
CppCMS design goal was to reduce costs for web site |
maintenance, help develop highly scalable systems and |
preserve the environment. |
|
With the traditional web development technology, hosting |
most demanding web applications requires large server |
farms consuming lots of electricity. Developing web |
services that can run in parallel on a large server |
cloud presents a software engineering challenge. |
All of these may be avoided with CppCMS, which often |
enables hosting a web service on a single server |
when otherwise a large array of servers would be required. |
|
On the other side of the spectrum, CppCMS is also being |
used in embedded environments. This enables setting up |
a dedicated web interface on resource constrained |
low-power embedded CPU. Today, a growing number |
of embedded devices use this kind of lightweight web |
services for control and configuration. Examples include |
networking components, industrial controllers, monitoring |
equipment and consumer electronics (e.g. for firmware updates). |
|
CppCMS was tested on a variety of platforms, including Linux, |
Windows, Solaris, FreeBSD, Mac OS X and several embedded |
platforms. It is compatible with all industry-leading |
web servers (Apache, IIS, Nginx, etc) and also provides |
a built-in lightweight web server which can be used instead. |
|
CppCMS is free open source software. It may be distributed |
under LGPL license. For commercial applications, it offers |
an alternative commercial license. |
|
You can learn more from our website: <http://cppcms.com> |
|
|
## Case Study |
|
We implemented a simple web application --- a blog |
using several modern technologies: CppCMS, |
Java Servlets (JSP) and PHP. |
This application had typical features that most |
applications of its kind had: database access, text formatting, comments sanitation and of course |
caching. |
|
In order to perform the measurements, we created |
a typical workload. A special client requested different |
blog articles and ensured that some of them |
were taken from the web cache and some were |
fully generated simulating a required cache |
miss ratio. |
|
In this case study, we used cache miss ratio of 20%. |
This value is typical for the one of |
the largest web sites: Wikipedia. |
|
We had measured following parameters: |
|
1. Speed --- how many pages per second the application was able to generate. |
2. Resource consumption --- how much memory the application used. |
|
The benchmark results are shown at the figure [1](#hitspersec). You can see at the left |
side that the blog implemented using CppCMS technology |
was faster than the blogs implemented using JSP and PHP |
side, that the blog implemented using CppCMS technology |
was faster than the ones implemented using JSP and PHP |
by an order of magnitude. |
|
You can observe at the right side of the |
figure [1](#hitspersec) that the memory consumption |
figure [1](#hitspersec), that the memory consumption |
of the CppCMS based application was significantly lower as well. The application implemented |
using PHP consumed almost 3 times more memory than |
one implemented using CppCMS. The difference |
the one implemented using CppCMS. The difference |
between CppCMS and JSP was even higher. |
The blog implemented using Java Servlets |
consumed almost 30(!) times more memory than the |
blog based on our technology. |
|
You can clearly see that the applications which used our |
technology performed significantly better than ones implemented using PHP or JSP. The significant difference |
was observed in speed and memory consumption simultaneously. |
You can clearly see that the application which used our |
technology performed significantly better than ones implemented using PHP or JSP technologies. Such differences |
were observed in speed and memory consumption |
simultaneously. |
|
<span id="hitspersec">Figure 1: Typical application performance<br/> ![Typical Application Performance](/files/wp/20per.png) ![Typical Application Performance](/files/wp/memory.png)</span> |
|
## Technology |
|
CppCMS incorporates many unique approaches to achieve its goals. |
|
CppCMS uses C++ as the primary programming language for the |
web development. This language allows creating high-level |
object-oriented and modular designs; on the other hand it allows low level optimization of critical points helping |
to improve the performance and reduce the resource |
consumption. |
|
Performance is the core part of the CppCMS' design. |
For instance, unlike the most web frameworks' caching |
systems which use a simple key--value model, |
systems which use a simple key-value model, |
CppCMS takes caching to the next level. |
It provides special triggers that allow invalidating |
multiple cached objects as once (see fig. [2](#keys).) |
This approach allows keeping the web cache highly consistent; on the other hand, it preservers cached objects for longer time reducing the loads on the web application. |
Additionally, the cached web pages are stored already compressed, reducing both the network latency |
and the CPU load. |
|
<span id="keys"> |
Figure 2: CppCMS features trigger based cache invalidation system that allows removing multiple cached objects at once<br/> |
![Fig 2](/files/wp/keys.png) |
</span> |
|
The scalability is the other major concern of this |
web framework's design. For example, CppCMS provides |
client-side session storage based on encrypted |
and digitally signed cookies as linearly scalable storage. |
The distributed cache system uses two levels of cache |
(see fig. [3](#l2).) It reduces the network load and |
the cache-server's response times, |
|
|
<span id="l2">Figure 3: CppCMS' distributed cache system uses two-level cache that reduces |
the network load and the latency for the access to the |
most frequently used objects<br/>![Fig 3](/files/wp/l2.png) |
</span> |
|
|
Despite all the performance concerns and the low level |
optimizations, CppCMS allows developing safe and secure |
web applications. It provides a set of built-in tools |
that makes secure web design easier: forms validation |
with built-in Cross-Site Request Forgery (CSRF) protection, |
input character set validation, fast and efficient |
Cross-Site Scripting (XSS) filtering, SQL-injection |
prevention tools, built-in support of file-system level |
isolation using `chroot()` and more. |
|
## Ajax and Comet |
|
Modern web applications are highly interactive. |
The client side and the server side interchange |
the data all the time. CppCMS fully supports |
this kind of web development. |
information all the time. CppCMS fully supports |
such web development style. |
|
CppCMS recommends and uses JSON as |
a lightweight and powerful client--server data interchange format. |
CppCMS provides a built-in tools for |
straight forward conversion between the JSON and |
the C++ objects. It implements the JSON-RPC protocol |
giving easy to use tools for interaction |
between the client side and the server side --- the Ajax support. |
CppCMS recommends and uses JSON as a lightweight |
and powerful data interchange format. |
Our framework provides tools for straight forward |
conversion between JSON and C++ objects. |
It supports lightweight and widely used |
JSON-RPC protocol. All these together, give |
handful tools for implementing dynamic interaction |
between the client and the server side: the Ajax support. |
|
Unlike most web development frameworks, |
CppCMS technology supports both client side |
and the server side events --- the Comet support. |
CppCMS technology supports both the client |
and the server side events: the Comet support. |
|
CppCMS allows creating both synchronous and asynchronous |
web applications on the server side using the same approach. |
This approach allows tight integration between different |
types of applications: synchronous that respond to the |
client's requests and asynchronous that |
respond to server side events and notify the client |
about them, see fig. [4](#comet) |
CppCMS unifies the approach for implementing different kind |
of web applications: the synchronous ones which |
respond to the client's requests and the asynchronous |
ones which respond to the server side events and notify |
the client about them, see fig. [4](#comet). |
|
<span id="comet" >Figure 4: CppCMS provides built-in support for Comet technology |
The asynchronous web applications are event driven and |
capable to handle multiple HTTP connections |
simultaneously. This unique approach gives the CppCMS based |
application an ability to handle hundreds and thousands |
simultaneous connections with very low overhead. |
|
<span id="comet">Figure 4: CppCMS provides built-in support for Comet technology |
and allows handling both synchronous and asynchronous |
requests with very low resource usage<br/> |
![Fig 4](/files/wp/eventloop.png)</span> |
|
|
This unique approach allows the CppCMS based application to handle hundreds and |
thousands simultaneous connections with very low resource consumption. |
|
## Key Features |
|
1. High performance |
2. Low resource consumption |
3. Model-View-Controller application design pattern |
4. Advanced web template system that is directly compiled to the native code |
4. Powerful cache system |
5. Scalable web session storage |
1. Multiple security protection features like: XSS filters, SQL-injection and CSRF protection tools. |
1. Web server interoperability using industry standard protocols: FastCGI, SCGI and HTTP. |
## Key Features of CppCMS |
|
1. High performance and low resource consumption |
1. Model-View-Controller application design pattern |
1. Advanced web template system that is directly compiled to the native code |
1. Powerful cache system |
1. Scalable web session storage |
1. Multiple security features like: XSS filters, SQL-injection and CSRF protection tools |
1. Web server interoperability using industry standard protocols: FastCGI, SCGI and HTTP |
1. Built-in web server for embedded applications |
1. Ajax integration using JSON and JSON-RPC |
1. Native Comet integration and support --- server side events support |
1. Powerful internationalization and localization support\footnote{CppCMS contributed |
localization library to the Boost project: Boost.Locale}. |
1. Native Comet support |
1. Powerful internationalization and localization support; In-fact, CppCMS contributed a localization library |
to the Boost project: Boost.Locale |
1. Efficient database connectivity with built-in connection |
pooling and transparent prepared statement caching |
|
|
|