Posts in category ‘Framework’.
Thoughts about template system
After looking how ASP.Net and J2EE work I thought a lot about current template system.
Today, CppCMS template system is dynamic typed. For example in order to render template:
<% template mycontent %>
<p>You have <% number %> of <% something %></p>
<% end %>
I write something like that (not correct code but idea):
map<boost::any> content;
content["something"]=string("orange");
content["number"]=10;
template.render(content,output);
The template is compiled to bytecode and than interpreted in rendering engine.
If variable title required it checks its type and renders its content.
Another possible approach it to make is statically typed :
So, I create a view interface for template:
struct mycontent: public content {
string something;
int number;
};
And then the above template is compiled to following C++ code:
void mycontent::render()
{
cout<<"<p>You have "<<number<<" of "<<escape(something)<<"</p>\n";
}
That is compiled to shared object that I can load dynamically. And render template as following:
auto_ptr<my_content> content(template.get("my_content"));
content->number=10;
content->something="orange";
content->render(output);
more...
API Changes and mod-prefork
There have been lot of work in recent weeks in order to make deep internal changes in the framework. Now they include:
- Transparent support of 3 web server APIs: fastcgi, cgi and scgi.
- Support of new mod prefork that allows safer management of worker processes.
- Implementation of a cache that is shared between forked processes.
CppCMS vs WordPress
Setup
I had compared two blog systems: this one and WordPress 2.5 with a patched WP-Cache-2 addon. I used following configuration:
- Web Server lighttpd 1.4.13
- Interface FastCGI
- PHP 5.2
- Bytecode cacher: XCache 1.2.1
- Database MySQL 5.0
- Caching for WP: WP-Cache-2 with an additional performance patch
- Hardware: AMD Athlon XP 64bit, 1G RAM
- OS: Linux, Debian Etch 64bit.
I prepared two blogs that were filled up with 1000 articles each. Each article had 10 comments, all the articles were organized in 10 categories in each blog.
more...The Roadmap to The First Beta Version of CppCMS
After quite a long period of development I had decided to get prepared to first public beta release of CppCMS.
The major components of this blog and the framework I want to introduce in first beta are following:
- Implementation of Django style templates inheritance, filters (done 70%)
- Introduce powerful cache system (done 100%)
- Replace SOCI by LibDBI (done 100%)
- Improve blog: true markdown, LaTeX equations, categories etc. (done 100%)
- Write Documentation (done 20%)
- Migrate my Hebrew blog from Word Press to CppCMS (done 100%)
There are lots of work to do, but CppCMS now looks much mature then before.
more...Next Step - Caching
As we had seen in previous article, the benchmarks had shown an ability of CppCMS to produce about 630 compressed pages per second and an output of about 20Mbit/s. Is this enough?
For most of cases it is… But as we had seen I want to use every cycle of the CPU as smart as I can. Even, if the model I had suggested, was able to show "a prove of concept" there is an important point that was missed: "Why should I create same page so many times?"
Caching
This is the next logical step in the development of high performance web development framework.
First of all we should understand a requirements of the caching system:
- Efficiency
- Support of "dropping cache on update"
- Support of drop the cache by timeout
- Work using three models: single process cache, shared cache between processes, shared over the network.
- Support of caching on entry page level and single view level as well
- Transparent storage of compressed content
Lets describe each one of them:
more...