Posted by alex on Feb 1st, 2013

This post will expose benchmarks I've ran on Windows 7 Pro running a mSata M4 SSD. Full disk encryption is accomplished with DiskCryptor 1.0.757.115 and TrueCrypt 7.1a. If you don't care about my intro, jump to the pictures!

For a few years I've seen a lot of disinformation regarding SSD software encryption on the Internet. So let's make it clear:

  • Yes, wear leveling might expose unencrypted data on the drive, that is why it is important to encrypt the drive before moving secure data to it.
  • No, encryption will not shorten the useful life of the drive. Traditionally, the operating system works at the sector level. Change one single bit and the whole sector needs to be rewritten. A sector is usually 512 bits. Encryption is usually performed on blocks ranging from 128 to 512 bits.
  • Yes, hibernation time will suck big time. With both tools.
  • Bonus: You'll be disappointed if you buy a Sandforce based ssd hoping to get announced performance. Sandforce compresses data to achieve its impressible performance. Sadly encryption is incompressible.

I found two issues in DiskCryptor: Its filter driver approach breaks Resmon disk access monitoring, and encrypted hard drives never spin down. I've reported these in 2008 and it's not yet fixed (if fixable). Also the author use lowercase "mb" "gb" while it's "MB" "GB". Nitpicking, but the guy is supposedly knowledgeable about disk drivers and cryptography...

Test protocol:

  1. The SSD is installed in the mSata port (only sata II) of a Thinkpad x220 i7 and it has been filled with random data to make sure all sector were written to at least once.
  2. Windows 7 Pro was installed on the SSD.
  3. Superfetch, Windows Search, Media streamer, and Defragmenter were disabled.
  4. SSD optimizations were enabled in both encryption software.
  5. I've in turn encrypted and decrypted the ssd with truecrypt and diskcryptor using hardware accelerated AES.

The benchmarks were done with AS SSD Benchmark 1.7.4739 because it is file based, directly testing the underlying encryption.

Each benchmark was ran three times, with reboot between each run. For this post, I picked only the best performance in each category because the results were very consistent with a difference of at most 5%.


No encryption

No encryption-2





As we can see DiskCryptor is pretty darn close to native performance while TrueCrypt doesn't scale very well to threaded random accesses. With both results you'd get that snappy feeling typical for SSDs, but for certain applications DiskCryptor certainly has an edge.

Posted by alex on Sep 2nd, 2012

As I was looking for a javascript and css minification plugin solution to reduce the size and number of requests needed to view this page, I stumbled upon W3 Total Cache. Its feature set is impressive, it does static file caching and "minifying", exactly what I wanted.

However, its setup was not as straightforward as Wp Super Cache. See, with this kind of caching tool what you really want is a way to serve static cached files directly from the web server. PHP can serve cached files, but it is much slower (although faster than re-generating the page). On a properly configured server and caching tool, it usually go as this:

IF visitor has a login cookie OR the url contains a query string (?param=value):
the visitor might require specific content, call php to serve a dynamic page
ELSE IF a static version of the requested url exists:
serve it
call php who will generate the missing static page.

Wp Super Cache tries to detect if Apache's mod_rewrite is enabled, but we can force it to use static file caching anyway. This is not possible with W3 Total Cache and it refuses to create static files unless it detects apache, nginx or litespeed. I was a bit annoyed that they decided for me what my server could or couldn't do. But the pros of the tool were enough for me to keep digging.

First I tried to create the test rewrite rules present in nginx or .htaccess example files, maybe W3 would see this as a sign of rewrite support:

url.rewrite-if-not-file = ( 
    "^/wp-content/w3tc/min/w3tc_rewrite_test$" => "wp-content/w3tc/min/index.php?w3tc_rewrite_test=1",
    "^(.*\/)?w3tc_rewrite_test$" => "$1?w3tc_rewrite_test=1",

But "Disk: Enhanced" option was still grayed out. Apparently it doesn't even care about its own test rules, so they can be forgotten. Next simple solution was to trick W3 and make it believe I was running nginx. This is done by adding a single line to your wp-config.php:

$_SERVER['SERVER_SOFTWARE'] = 'nginx 2.2';

And it worked! Usually it is not good practice to manipulate PHP's super globals, but I suggest it anyway because it's easier to maintain. If you were to edit W3, you'd have to remember to edit it every time it is updated.

Now that we fooled W3, we can enable "Disk: Enhanced" option for Page Cache and "Disk" for Minify.

Only thing missing to make it all work are the rewrite rules (Note: they must be inside your virtual host if you have one). One to generate missing minified files and one to serve cached pages.

server.error-handler-404 = "index.php"
#minify doesn't depend on cookies
url.rewrite-if-not-file = ( "^/wp-content/w3tc/min/(.+\.(css|js))$" => "wp-content/w3tc/min/index.php?file=$1")
$HTTP["cookie"] !~ "^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$" {
    url.rewrite-once = ( "^/wp-admin(.*)(?:\?(.*))?$" => "wp-admin$1?$2" )
    url.rewrite-if-not-file += ("^/([^\?]*)$" => "wp-content/w3tc/pgcache/$1/_index.html")

This is not a complete 1:1 translation of W3's nginx rewrite rules, however it was all I needed. If you have problems, take a look at the nginx.conf file generated by W3 Total Cache in your base directory, you might use a feature that I do not.

Posted by alex on Aug 29th, 2012

montrealminimakerfaireA couple days ago, I attended the first Maker Faire to happen in Montréal and it was awesome! Apparently it was a great success, I sure hope this success translates to more Maker events nearby! I did not take pictures myself, but luckily Pascal did. Some nice projects are missing from the following album like the échoFab, Réseau Libre, and the team of arcade cabinet artwork makers The Buttonmashers.

Posted by alex on Jan 20th, 2011

I was not able to find a simple way to use wp-super-cache with lighttpd, some were using 100 lines lua script and the others were unreliable at best. After an hour of fiddling, I came with the following configuration.

What it does:

Go to Top