<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>CppCMS Blog :: Benchmarks</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>Asp.Mono in Linux? Not Yet...</title>
			<link>http://art-blog.no-ip.info/cppcms/blog/post/27</link>
			<guid>http://art-blog.no-ip.info/cppcms/blog/post/27</guid>
			<description>
			&lt;div style=&quot;direction:ltr&quot;&gt;
			&lt;p&gt;During development of CppCMS I have always wanted to do some benchmarks against one of the most popular web development technologies: Asp.Net. I had found a blogging system: &lt;a href=&quot;http://www.dotnetblogengine.net/post/BlogEngineNET-145-released-today.aspx&quot;&gt;BlogEngine.Net&lt;/a&gt; that in its latest version had full support of mono under Linux, support of MySQL &amp;mdash; all I need to run benchmarks against CppCMS.&lt;/p&gt;

&lt;p&gt;The beginning was promising. The instructions were simple, there was an actual blog running BE.Net under Apache mod_mono on Ubuntu. There were &lt;a href=&quot;http://blog.ruski.co.za/page/Install-BlogEngineNET-on-Ubuntu.aspx&quot;&gt;Linux specific&lt;/a&gt; instructions as well. &lt;/p&gt;

&lt;p&gt;So, first of all I had installed mono 1.9.1 from Etch backports. The first problem I had to deal with was an installation problem &amp;mdash; the version of C# compiler and mono environment were different. This was solved quite simply. So, I could finally see BE.Net running under Mono using XML as data storage backend.&lt;/p&gt;

&lt;p&gt;Then, I wanted to add MySQL storage backend. The problems had come very soon. The MySQL database script was written under assumption that table names are case insensitive. That was not true for MySQL under &lt;em&gt;Linux&lt;/em&gt;. This problem was fixed.&lt;/p&gt;

			&lt;p&gt;
			&lt;a href="/cppcms/blog/post/27"&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>New Templates System</title>
			<link>http://art-blog.no-ip.info/cppcms/blog/post/14</link>
			<guid>http://art-blog.no-ip.info/cppcms/blog/post/14</guid>
			<description>
			&lt;div style=&quot;direction:ltr&quot;&gt;
			&lt;p&gt;New templates system was introduces to the CppCMS framework. It is based on ideas of dynamic typed languages inside static typed C++.&lt;/p&gt;

&lt;p&gt;The original template system had several problems:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The each template variable was referenced by and integer key that was generated during compilation of templates.&lt;/li&gt;
&lt;li&gt;The rendering process required from the developer some kind of activity &amp;ndash; update content values according to requests from rendering engine.&lt;/li&gt;
&lt;li&gt;The values of the entries where limited to string, integer and boolean values.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;In any case, the design of the first template system was just unacceptable, thus new template system was build.&lt;/p&gt;

&lt;p&gt;It introduced following features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dynamic typed variable values using boost::any. They allow assigning of any kind of objects to the variables and rendering them to the templates using custom engines.&lt;/li&gt;
&lt;li&gt;All the variables are references by their names.&lt;/li&gt;
&lt;li&gt;Content now has hierarchical structure when each variable can include list of items or callbacks that allow one step template rendering.&lt;/li&gt;
&lt;li&gt;The design of the engine is now much more modular.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Additional features I'm still working on them are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Support of different filters like &quot;html escaping&quot;, &quot;urlizing&quot; etc.&lt;/li&gt;
&lt;li&gt;Support of custom filters, including filter chains.&lt;/li&gt;
&lt;li&gt;Support of localization and translation.&lt;/li&gt;
&lt;/ul&gt;


			&lt;p&gt;
			&lt;a href="/cppcms/blog/post/14"&gt;more...&lt;/a&gt;
			&lt;/p&gt;
			&lt;/div&gt;
			</description>
		</item>
		
		<item>
			<title>SOCI or DBI, stage 2</title>
			<link>http://art-blog.no-ip.info/cppcms/blog/post/13</link>
			<guid>http://art-blog.no-ip.info/cppcms/blog/post/13</guid>
			<description>
			&lt;div style=&quot;direction:ltr&quot;&gt;
			&lt;p&gt;Discussing soci &lt;a href=&quot;http://sourceforge.net/mailarchive/forum.php?forum_name=soci-users&quot;&gt;performance&lt;/a&gt; with its developers I had found that soci is compiled without any optimizations by default.&lt;/p&gt;

&lt;p&gt;So, after recompiling soci with -O2 option I've got much better results. Simple comparison
of dbixx and soci had given very close result. I had run my tests once more and got following
results &amp;ndash; pages per second (no gzip):&lt;/p&gt;

&lt;pre name=&quot;code&quot; class=&quot;cpp&quot; &gt;DB        soci dbixx
--------------------
MySQL      710   800
Sqlite3    550   410
PgSQL      385   430
&lt;/pre&gt;

&lt;p&gt;We can clearly see that for MySQL and PostgreSQL dbixx is still faster in about 10% however
in case of Sqlite3 dbixx is significantly slower (25%).&lt;/p&gt;

&lt;p&gt;So it seems to me that both solutions are quite reasonable to use without clear advantage of
one over another.&lt;/p&gt;

			&lt;p&gt;
			&lt;a href="/cppcms/blog/post/13"&gt;more...&lt;/a&gt;
			&lt;/p&gt;
			&lt;/div&gt;
			</description>
		</item>
		
		<item>
			<title>SOCI or DBI</title>
			<link>http://art-blog.no-ip.info/cppcms/blog/post/12</link>
			<guid>http://art-blog.no-ip.info/cppcms/blog/post/12</guid>
			<description>
			&lt;div style=&quot;direction:ltr&quot;&gt;
			&lt;p&gt;One of the problematic issues in writing cross-SQL code is an API that differs from
one SQL to another.&lt;/p&gt;

&lt;p&gt;There are two open source libraries that provide unified API&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://soci.sourceforge.net&quot;&gt;soci&lt;/a&gt; &amp;ndash; C++ library.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://libdbi.sourceforge.net&quot;&gt;dbi&lt;/a&gt; &amp;ndash; C library.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;At the first point I had chosen soci as native solution of C++ programmer. After running some benchmarks on the new version of this blog I had found &lt;a href=&quot;http://art-blog.no-ip.info/cppcms/blog/post/11&quot;&gt;20% performance&lt;/a&gt; reduction for MySQL
database. But I also remembered that there should be &lt;a href=&quot;http://art-blog.no-ip.info/cppcms/blog/post/8&quot;&gt;negligible difference&lt;/a&gt; between MySQL and Berkeley DB.
This was mostly due to incorrect design of my BDB database layout I had done.&lt;/p&gt;

&lt;p&gt;That had seem to be strange and I stared benchmarking the system more and more.&lt;/p&gt;

			&lt;p&gt;
			&lt;a href="/cppcms/blog/post/12"&gt;more...&lt;/a&gt;
			&lt;/p&gt;
			&lt;/div&gt;
			</description>
		</item>
		
		<item>
			<title>The Cost of SQL - First Measurements</title>
			<link>http://art-blog.no-ip.info/cppcms/blog/post/11</link>
			<guid>http://art-blog.no-ip.info/cppcms/blog/post/11</guid>
			<description>
			&lt;div style=&quot;direction:ltr&quot;&gt;
			&lt;p&gt;There are the preliminary benchmarks comparing different DB backends.
I've measured pages per second ratio for fetching different pages from the blog
that includes 5,000 articles and 50,000 comments to them. The client and the server had run on the same PC.&lt;/p&gt;

&lt;p&gt;The settings and the database is the same that is used in this &lt;a href=&quot;http://art-blog.no-ip.info/cppcms/blog/post/4&quot;&gt;article&lt;/a&gt;.&lt;/p&gt;

&lt;pre name=&quot;code&quot; class=&quot;cpp&quot; &gt;Backend         gzip no-gzip   gzip   no-gzip %
------------------------------------------------
Berkeley DB     565  830       N/A    N/A
MySQL InnoDB    475  645       -16%   -22%
Sqlite3         410  515       -27%   -38%
PostgreSQL      305  360       -46%   -57%
&lt;/pre&gt;

&lt;p&gt;We can see:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;There is not negligible cost of using SQL Data Bases. However the price is not too high with fast data bases like MySQL.&lt;/li&gt;
&lt;li&gt;PostgreSQL had badly surprised me with its real performance. Maybe I'm doing something wrong?&lt;/li&gt;
&lt;/ol&gt;


			&lt;p&gt;
			&lt;a href="/cppcms/blog/post/11"&gt;more...&lt;/a&gt;
			&lt;/p&gt;
			&lt;/div&gt;
			</description>
		</item>
		
		<item>
			<title>BDB or not BDB - that is the question...</title>
			<link>http://art-blog.no-ip.info/cppcms/blog/post/8</link>
			<guid>http://art-blog.no-ip.info/cppcms/blog/post/8</guid>
			<description>
			&lt;div style=&quot;direction:ltr&quot;&gt;
			&lt;p&gt;At the beginning of the project I had several options for president storage for CppCMS:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use standard SQL databases like MySQL, PostgreSQL.&lt;/li&gt;
&lt;li&gt;Use embedded SQL data base like Sqlite3&lt;/li&gt;
&lt;li&gt;Use Berkeley DB&lt;/li&gt;
&lt;li&gt;Implement my own storage model.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;At the beginning I wanted to use MySQL. At certain point I decided to switch to Berkeley DB, and now I come back to the original question: &quot;what data storage to use?&quot;&lt;/p&gt;

&lt;p&gt;In order to make a proper design I had run lots of micro benchmarks and finally I had chosen Berkeley DB. However I never used queries from real DB. And now, when I had implemented a simple blog I decided to run benchmarks on the situation that is closer to real one.&lt;/p&gt;

&lt;p&gt;I had reimplemented an operation of fetching single post using MySQL and imported the database that included 5000 articles with 10 comments each one and tested.&lt;/p&gt;

			&lt;p&gt;
			&lt;a href="/cppcms/blog/post/8"&gt;more...&lt;/a&gt;
			&lt;/p&gt;
			&lt;/div&gt;
			</description>
		</item>
		
		<item>
			<title>Benchmarks, First Results</title>
			<link>http://art-blog.no-ip.info/cppcms/blog/post/4</link>
			<guid>http://art-blog.no-ip.info/cppcms/blog/post/4</guid>
			<description>
			&lt;div style=&quot;direction:ltr&quot;&gt;
			&lt;p&gt;&lt;em&gt;Updated 28/12/07, 17:00&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;In order to show that all the time I had spend on this system wasn&amp;rsquo;t wasted I had run a simple benchmark tests on following setup:&lt;/p&gt;

&lt;h4&gt; Server &lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Hardware: AMD Athlon XP 3000+ 64 bit, 1GB RAM.&lt;/li&gt;
&lt;li&gt;OS: Debian Etch 64 bit.&lt;/li&gt;
&lt;li&gt;Web server: Lighttpd 1.4.13&lt;/li&gt;
&lt;li&gt;CMS: This blog software, configured with 5 working threads.&lt;/li&gt;
&lt;li&gt;Data base of 85MB: 5,000 articles with 10 comments to each one.&lt;/li&gt;
&lt;/ul&gt;


&lt;h4&gt; Network devices&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;100Mbit network cards&lt;/li&gt;
&lt;li&gt;Edimax $75 home router&lt;/li&gt;
&lt;/ul&gt;


&lt;h4&gt; Client&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Hardware: Dell Latitude C400, PIII 750MHz, 256MB RAM&lt;/li&gt;
&lt;li&gt;OS: Debian Etch 32 bit&lt;/li&gt;
&lt;/ul&gt;


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