Finally: WordPress Benchmark

So, there are no real benchmarks of a WordPress running in the wild available ( couldn’t believe it either.. ). So I got my ab and gnuplot friends and created one. The reason why I’m doing this that while developing ( or forking, to be honest, marc’s work ) i was curious what php can achieve. The answer is, as you will see, very sad.

I ran the benchmarks on two different machines. One of them is a xen-based virtual machine with 4gb of RAM and a dedicated CPU. The MySQL server runs on a seperate VM on the same physical device. The first graph shows the results at a concurrency level of 2, the second one a concurrency level of 5.

test1_s
test2_sThe second run was performed on the machine where this blog is hosted. All benchmarks are running against WordPress’ index.php, to not allow caching to falsify the results. The machine is also a virtual machine, enough RAM, slow cpu though. Please keep in mind that most people are using that kind of machines for their blogging, because dedicated machines are not exactly.. cheap. Anyhow, concurrency level 2. I didn’t bother to check what level 5 would have changed, because the time taken for the first one was already 20 minutes.

test1_m

For the sake of being mean to all PHP-lovers, I included a bench of an Rails-Application served from the very same VM as the first benchmarks. Of course, you can’t compare Rails to PHP. But still interesting, I think.

test1_k

Finally: ActiveResource with Service Discovery and Authentication

Yay. In case you’re looking for a release, there is none. Not yet, we are maybe going to release one, but it’s a question of time rather than a lack of good will.

Why. In my current position, I am building a set of applications ( most of them rails based ) communicating with each other in a RESTful manner. This is, well, just continue reading my ActiveResource rant here. It’s not really nice to use the official ActiveResource thing. It’s a lot of hardcoding ( e.g. you have to set the remote service’ URL in the model, not in some kind of configuration file, which makes switching from development to testing and production a pain ) and other shortcomings. It’s a good idea, yet far from being perfect. And the two things that bothered me most were service discovery, meaning, the easy ability to resolve a service by its name than by its url, and authentication. Both of them are crucial for a system exceeding the hello world boundaries. That is, what I’m doing. So, utilizing all of Ruby’s beauty, a) a Rails plugin was developed and b) a standalone Server acting as a Central Authentication Service and Service Discovery instance. And from what I can tell, it’s beautiful ( not the codebase, at the moment, but the functionality ).

What is this thing able to do? Well, for the simple parts, it handles all your authentication needs. No more password juggling, just do it in one place, and nowhere else. OpenID compatibility is on the way, both as consumer and provider. It’s nice to have this kind of functionality by only installing a plugin and create a before_filter.

The next big thing is the service discovery. ActiveResource wasn’t used as an entry point for customizations, it was HyperactiveResource. I extended it to provide the ability to connect to the above mentioned central instance ( the address of this instance is defined in a configuration file, by the way ) to retrieve a services’ address. A simple thing, yet it makes life so much easier.

Is there a clue? Yes. Bundling the two features above, you are able to allow and disallow communication between two services at your will. Bidirectional, so assuming you do have an E-Mail-service and an AddressBook-service, you now can allow the E-Mail to access your AddressBook, without allowing the other direction. Authentication is handled completely transparent to the developer, and the rest of the usage is like HyperactiveResource. Just a charm.

And for me? Fun is back :-)

Rails Plugin: Superdumper, helps you visualize your database schema

You know the problem. You are agile like hell. You don’t bother doing complicated diagrams to show somebody what you’re doing. That’s okay. But sometimes, you need to show off what you’ve been struggling with, and if that day comes, this little rakefile can save some time.

Simply , Unpack this file ( tar bz btw ) in your rails app’s root folder and call rake db:superdumper. This will create a file called database.dot in your root folder, containing your database scheme, including associations, in the so-called “dot” format, used by the open-source GraphViz package as input. If you don’t have that package, install it, via ports or apt or whatever applies to your platform. 

In Detail what you have to do is here ( assuming you unpacked the file already.. )
 

rake db:superdumper

This task will automatically dump your scheme and call GraphViz, resulting in a pdf file in the root of your app with the name database.pdf. If it’s not your database schema smiling at you, let me know.

Rails Development: Comparing platforms

And I know what I’m talking about! I’ve been doing heavy rails development lately, on all three major platforms. Start with OS X.

It seems every serious Screencast for Rails was recorded using the famous Textmate Editor on OS X. At first sight, Textmate may seem to be a pretty ordinary Text Editor. Well, it isn’t. It’s very powerful and highly customisable. It’s one of the products I’d buy always again, simply because it’s worth it’s price. Development is rather flawless, not only because of Textmate, but also because OS X is based on a Unix System, giving one the ability to run all utilities natively, avoiding perfomance issues. It’s absolutely my favorite.

After my MacBook commited suicide, I was forced to use XP. I wasn’t happy. There are good code editors for sure ( I used vim nevertheless ) but the overall speed of testing tasks and so on is .. poor. Very poor. Those perfomance problems are well-known, though no one knows the exact reason ( at least I wasn’t able to figure it out ). I don’t want to flame here, but Windows is just not suitable for serious Rails development.

After deciding that the above mentioned system was a pain in the ass rather than a solid solution, I switched to Ubuntu. And I’m amazed, really. Gedit with a few plugins seems to be a good alternative compared to TextMate, and all the packages run like a charm. And it’s free and runs everywhere. It’s my recommendation for every Windows+Rails developer. Install VMWare or VirtualBox and develop there, it’s faster. Trust me.

Tomorrow ( assuming UPS isn’t lying ) my new iMac will arrive, and I’m so looking forward to it. What is your prefered platform for developing with rails?

Online Password Storage

The user home screen.I wrote one. Based on Rails, working reliable. The encryption is designed in way that prohibits even the database administrator to access them. I showed it to a few people. The response was that it seems that no one is willing to give away passwords.
But the project is cool. By installing a bookmarklet you can easily login to any page you registered at _my_ service by simply clicking on that bookmarklet.. works mostly. Maybe I’m going to put it online someday, but not until I fixed the encryption so that it happens only in the browser, to prevent any passwords being sent in plain.
I would really appreciate some comments.