<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>CppCMS Blog :: Cache</title>
	<link>http://art-blog.no-ip.info/cppcms/blog</link>
	<description>A blog on CppCMS - C++ Web Development Framework</description>
	<atom:link 
		href="http://art-blog.no-ip.info/cppcms/blog/rss" 
		rel="self" type="application/rss+xml" />
	
		
		<item>
			<title>CppCMS 0.0.4 Released</title>
			<link>http://art-blog.no-ip.info/cppcms/blog/post/41</link>
			<guid>http://art-blog.no-ip.info/cppcms/blog/post/41</guid>
			<description>
			&lt;div style=&quot;direction:ltr&quot;&gt;
			&lt;p&gt;Version 0.0.4 of CppCMS had released.&lt;/p&gt;

&lt;p&gt;It includes optimizations required for using it in embedded systems.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Normal Embedded Build:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Caching is completely removed. Small memory footprint
is very important for embedded system thus, caching
stuff in memory is quite useless.&lt;/li&gt;
&lt;li&gt;Zlib compression are removed &amp;ndash; it removes dependency on
boost::iostreams, zlib and bzip2 libraries.&lt;/li&gt;
&lt;li&gt;Removed mod-prefork.&lt;/li&gt;
&lt;li&gt;Removed dynamic templates loading &amp;mdash; this feature requires export of
symbols to binary and increases its size in order to make RTTI work.
 Thus, all templates should be statically compiled into the binary.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;em&gt;Embedded CGI Mode:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;FastCGI and SCGI APIs are removed&lt;/li&gt;
&lt;li&gt;Mod-thread and mod process are removed including
all thread pool facilities&lt;/li&gt;
&lt;li&gt;Changes in files based session backend to work
properly with CGI mode including garbage collection
(sessions that had time-out).&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Downloads are avialable from Sf Project Page.&lt;/p&gt;

			&lt;p&gt;
			&lt;a href="/cppcms/blog/post/41"&gt;more...&lt;/a&gt;
			&lt;/p&gt;
			&lt;/div&gt;
			</description>
		</item>
		
		<item>
			<title>Preparing to Beta 2...</title>
			<link>http://art-blog.no-ip.info/cppcms/blog/post/29</link>
			<guid>http://art-blog.no-ip.info/cppcms/blog/post/29</guid>
			<description>
			&lt;div style=&quot;direction:ltr&quot;&gt;
			&lt;p&gt;What expected in the next beta version:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Now CppCMS is really ready for serving high load sides, thanks to new distributed cache module based on Boost.Asio.&lt;/p&gt;

&lt;p&gt;Several CppCMS processes running on different computers can share same cache distributed over several TCP/IP cache servers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;Staticly typed template system that fully integrated with the framework that allows:

&lt;ul&gt;
&lt;li&gt;&quot;Django style&quot; template inheritance.&lt;/li&gt;
&lt;li&gt;Powerful extendsions abilities using C++ code directly.&lt;/li&gt;
&lt;li&gt;Static compilation with generated templates code or loading templates as external shared objects.&lt;/li&gt;
&lt;li&gt;Creates a potential for future &quot;forms/widgets&quot; integration.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Various bugfixes and code cleanup.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Possibly included: form validation and generation modules.&lt;/p&gt;

&lt;p&gt;to be Continued&amp;hellip;&lt;/p&gt;

			&lt;p&gt;
			&lt;a href="/cppcms/blog/post/29"&gt;more...&lt;/a&gt;
			&lt;/p&gt;
			&lt;/div&gt;
			</description>
		</item>
		
		<item>
			<title>Caching System: Internals</title>
			<link>http://art-blog.no-ip.info/cppcms/blog/post/21</link>
			<guid>http://art-blog.no-ip.info/cppcms/blog/post/21</guid>
			<description>
			&lt;div style=&quot;direction:ltr&quot;&gt;
			&lt;p&gt;One of the latest implemented features of CppCMS is a caching system.&lt;/p&gt;

&lt;p&gt;Each cached entry is stored using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unique key that defines the entry&lt;/li&gt;
&lt;li&gt;An actual data&lt;/li&gt;
&lt;li&gt;Entry lifetime period.&lt;/li&gt;
&lt;li&gt;The set of triggers &amp;mdash; this is a feature that is not available in many cache system like &lt;a href=&quot;http://www.danga.com/memcached/&quot;&gt;memcached&lt;/a&gt;.&lt;br/&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;For example: main page that displays 5 recent posts may have a key &lt;code&gt;main_page&lt;/code&gt; and triggers: &lt;code&gt;post_123&lt;/code&gt;, &lt;code&gt;post_124&lt;/code&gt;, &amp;hellip; , &lt;code&gt;post_128&lt;/code&gt;. More then that, each time, during page build, when you fetch some cached data, like a sidebar or set of options, their sets of triggers are automatically added to the set of triggers of the page you build.&lt;/p&gt;

&lt;p&gt;For example, when the page is created and sidebar block is fetched from cache all its triggers are automatically added: if &lt;code&gt;sidebar&lt;/code&gt; depends of &lt;code&gt;options&lt;/code&gt;, then trigger &lt;code&gt;sidebar&lt;/code&gt; and &lt;code&gt;options&lt;/code&gt; will be automatically added to triggers of &lt;code&gt;main_page&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Thus, when certain trigger is risen, all pages that depends on it are automatically trashed. This makes a cache system quite powerful and easy to control correct data representation. &lt;/p&gt;

&lt;p&gt;The developer is expected to create a rational model of data/triggers that
represent the relations between parts of internal data and rise these triggers
when committing changes to database.&lt;/p&gt;

			&lt;p&gt;
			&lt;a href="/cppcms/blog/post/21"&gt;more...&lt;/a&gt;
			&lt;/p&gt;
			&lt;/div&gt;
			</description>
		</item>
		
		<item>
			<title>API Changes and mod-prefork</title>
			<link>http://art-blog.no-ip.info/cppcms/blog/post/24</link>
			<guid>http://art-blog.no-ip.info/cppcms/blog/post/24</guid>
			<description>
			&lt;div style=&quot;direction:ltr&quot;&gt;
			&lt;p&gt;There have been lot of work in recent weeks in order to make deep internal changes in the framework. Now they include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Transparent support of 3 web server APIs: fastcgi, cgi and scgi.&lt;/li&gt;
&lt;li&gt;Support of new mod prefork that allows safer management of worker processes.&lt;/li&gt;
&lt;li&gt;Implementation of a cache that is shared between forked processes.&lt;/li&gt;
&lt;/ol&gt;


			&lt;p&gt;
			&lt;a href="/cppcms/blog/post/24"&gt;more...&lt;/a&gt;
			&lt;/p&gt;
			&lt;/div&gt;
			</description>
		</item>
		
		<item>
			<title>CppCMS vs WordPress</title>
			<link>http://art-blog.no-ip.info/cppcms/blog/post/22</link>
			<guid>http://art-blog.no-ip.info/cppcms/blog/post/22</guid>
			<description>
			&lt;div style=&quot;direction:ltr&quot;&gt;
			&lt;h3&gt; Setup&lt;/h3&gt;

&lt;p&gt;I had compared two blog systems: this one and WordPress 2.5 with a patched WP-Cache-2 addon. I used following configuration:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Web Server lighttpd 1.4.13&lt;/li&gt;
&lt;li&gt;Interface FastCGI&lt;/li&gt;
&lt;li&gt;PHP 5.2&lt;/li&gt;
&lt;li&gt;Bytecode cacher: XCache 1.2.1&lt;/li&gt;
&lt;li&gt;Database MySQL 5.0&lt;/li&gt;
&lt;li&gt;Caching for WP: WP-Cache-2 with an additional &lt;a href=&quot;http://art-blog.no-ip.info/cppcms/blog/post/20&quot;&gt;performance patch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Hardware: AMD Athlon XP 64bit, 1G RAM&lt;/li&gt;
&lt;li&gt;OS: Linux, Debian Etch 64bit.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;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.&lt;/p&gt;

			&lt;p&gt;
			&lt;a href="/cppcms/blog/post/22"&gt;more...&lt;/a&gt;
			&lt;/p&gt;
			&lt;/div&gt;
			</description>
		</item>
		
		<item>
			<title>Patch For WP-Cache-2 plugin</title>
			<link>http://art-blog.no-ip.info/cppcms/blog/post/20</link>
			<guid>http://art-blog.no-ip.info/cppcms/blog/post/20</guid>
			<description>
			&lt;div style=&quot;direction:ltr&quot;&gt;
			&lt;p&gt;I'm going to run a heavy benchmarks comparing WordPress &amp;ndash; the blog system I know very well, with CppCMS based blog &amp;ndash; the system I had written.&lt;/p&gt;

&lt;p&gt;The new caching system that was developed for CppCMS is quite smart, it stores
the entry pages twice: original and gzip compressed. On heavy loads, this allows
serving pages significantly faster because only thing that should be done is
to push html or compressed html page directly from the cache. Otherwise, gzip 
compression (even fastest) would take lots of resources and reduces a preformace of the system.&lt;/p&gt;

&lt;p&gt;When it comes to benchmarks, I had discovered that WP-Cache-2 plugin does the
job well, but it caches only html version of the file, thus, even if the 
page is cached it still must pass a compression by Apache&amp;rsquo;s mod_deflate or by PHP engine itself. &lt;/p&gt;

&lt;p&gt;I had patched this plugin and now it stores two versions of same page: an original and compressed. and was able to get 60% performace improvement.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;WordPress native plugin: 450 requests per second&lt;/li&gt;
&lt;li&gt;WordPress patched  plugin: 720 requests per second&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;So after this patch I can feel that the benchmarks would be proper, because without it this would be incorrect to compare time required for fetching a cache 
with the time required for compressing entry page.&lt;/p&gt;

&lt;p&gt;Links:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://mnm.uib.es/gallir/wp-cache-2/&quot;&gt;WP Cache 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://art-blog.no-ip.info/files/wp-cache.patch&quot;&gt;Patch&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;strong&gt;N.B.:&lt;/strong&gt; The full benchmarks coming soon&lt;/p&gt;

			&lt;p&gt;
			&lt;a href="/cppcms/blog/post/20"&gt;more...&lt;/a&gt;
			&lt;/p&gt;
			&lt;/div&gt;
			</description>
		</item>
		
		<item>
			<title>The Roadmap to The First Beta Version of CppCMS</title>
			<link>http://art-blog.no-ip.info/cppcms/blog/post/15</link>
			<guid>http://art-blog.no-ip.info/cppcms/blog/post/15</guid>
			<description>
			&lt;div style=&quot;direction:ltr&quot;&gt;
			&lt;p&gt;After quite a long period of development I had decided to get prepared to first public beta release of CppCMS.&lt;/p&gt;

&lt;p&gt;The major components of this blog and the framework I want to introduce in first beta are following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Implementation of Django style templates inheritance, filters (done 70%)&lt;/li&gt;
&lt;li&gt;Introduce powerful cache system (done 100%)&lt;/li&gt;
&lt;li&gt;Replace &lt;a href=&quot;http://soci.sourceforge.net&quot;&gt;SOCI&lt;/a&gt; by &lt;a href=&quot;http://libdbi.sourceforge.net&quot;&gt;LibDBI&lt;/a&gt; (done 100%)&lt;/li&gt;
&lt;li&gt;Improve blog: true markdown, LaTeX equations, categories etc. (done 100%)&lt;/li&gt;
&lt;li&gt;Write Documentation (done 20%)&lt;/li&gt;
&lt;li&gt;Migrate my Hebrew blog from Word Press to CppCMS (done 100%)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;There are lots of work to do, but CppCMS now looks much mature then before.&lt;/p&gt;

			&lt;p&gt;
			&lt;a href="/cppcms/blog/post/15"&gt;more...&lt;/a&gt;
			&lt;/p&gt;
			&lt;/div&gt;
			</description>
		</item>
		
		<item>
			<title>Next Step - Caching</title>
			<link>http://art-blog.no-ip.info/cppcms/blog/post/7</link>
			<guid>http://art-blog.no-ip.info/cppcms/blog/post/7</guid>
			<description>
			&lt;div style=&quot;direction:ltr&quot;&gt;
			&lt;p&gt;As we had seen in previous article, the &lt;a href=&quot;http://art-blog.no-ip.info/cppcms/blog/post/4&quot;&gt;benchmarks&lt;/a&gt; had shown an ability of CppCMS to produce about
630 compressed pages per second and an output of about 20Mbit/s. Is this enough? &lt;/p&gt;

&lt;p&gt;For most of cases it is&amp;hellip; 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 &quot;a prove of concept&quot; there is an important point that was missed: &quot;Why should I create same page so many times?&quot;&lt;/p&gt;

&lt;h2&gt; Caching &lt;/h2&gt;

&lt;p&gt;This is the next logical step in the development of high performance web development framework.&lt;/p&gt;

&lt;p&gt;First of all we should understand a requirements of the caching system:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Efficiency&lt;/li&gt;
&lt;li&gt;Support of &quot;dropping cache on update&quot;&lt;/li&gt;
&lt;li&gt;Support of drop the cache by timeout&lt;/li&gt;
&lt;li&gt;Work using three models: single process cache, shared cache between processes, shared over the network.&lt;/li&gt;
&lt;li&gt;Support of caching on entry page level and single view level as well&lt;/li&gt;
&lt;li&gt;Transparent storage of compressed content&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Lets describe each one of them:&lt;/p&gt;

			&lt;p&gt;
			&lt;a href="/cppcms/blog/post/7"&gt;more...&lt;/a&gt;
			&lt;/p&gt;
			&lt;/div&gt;
			</description>
		</item>
		
		<item>
			<title>The Goals</title>
			<link>http://art-blog.no-ip.info/cppcms/blog/post/2</link>
			<guid>http://art-blog.no-ip.info/cppcms/blog/post/2</guid>
			<description>
			&lt;div style=&quot;direction:ltr&quot;&gt;
			&lt;p&gt;When I started working on this project, many were (and still are) extremely skeptical about its future. Many questions were asked, like: &quot;Are you masochist? Who you think will ever use it? The hardware is cheap, we do not need such things!&quot; etc.&lt;/p&gt;

&lt;p&gt;In this post I'll explain my point of view and I'll show why &quot;C++ Web Development Framework&quot; is more then just &quot;yet another crazy idea of another geek&quot;&lt;/p&gt;

			&lt;p&gt;
			&lt;a href="/cppcms/blog/post/2"&gt;more...&lt;/a&gt;
			&lt;/p&gt;
			&lt;/div&gt;
			</description>
		</item>
		
	
</channel>
</rss>
