The Developer Day | Staying Curious

Archive for December 2008



Benchmarks battle: Yii vs. Zend Framework

While browsing through like every morning I’ve found this blog post promoting Yii framework. Interested I took a look at Yii benchmarks page and got really surprised.

To be honest benchmarking frameworks on a hello world application is a bit unfair. A hello world application requires very little complexity from the the framework. Zend Framework is a very powerful framework that has many strengths. A test should do something realistic. For example connecting to a database, having a configuration file, properly rendering a view, having a model to retrieve data, doing something with it, rendering a layout, trying some plugins or other components like pagination. It requires more work to do such applications, but that is a good way to do a fair benchmark.

Not related to benchmarking but I couldn’t help but notice that Yii benchamarks die in controller actions. It is not best the best thing to do. It does not allow the framework to completely shutdown and do whatever it has to do. For example executing post dispatcher methods.

The benchmarks say that Yii 1.0 is 800% faster with APC than ZendFramework 1.7.2. That is trully amazing. A huge difference. And.. I don’t really believe it is true. So let’s run the same benchmark on our own metal ;)

Let’s start with server configurations.

Yii server:

Operating System: Red Hat Enterprise Linux Server release 5.2
Web Server: Apache httpd 2.0.40
PHP: 5.2.6, any non-essential extensions are disabled
CPU: Dual Intel Xeon 3.2GHz
Main Memory: 2GB
Hard Drive: 73GB 15K RPM SCSI/SAS HDD

Our server:

Operating System: CentOS 5.2
Web Server: Apache/2.2.3 Default configuration
PHP: PHP Version 5.2.6 Default configuration + APC
CPU: Intel(R) Pentium(R) 4 CPU 3.00GHz
Main Memory: 1GB
Hard Drive: 250GB 7200 RPM SATA2

As you can see there is no big difference. Actually our server is slower :( Less CPU power, less RPMs on HDD, more not needed modules and extensions enabled, less memory.

I used the same APC settings as the Yii folks.


I’ve downloaded Yii 1.0 and zend framework 1.7.2. I’ve setup the same applications the Yii folks provide. Except I’ve removed the die and replaced it with an echo. And changed the ZF bootstrap file to work in no view renderer mode. The bootstrap file looks like this:

require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();$front = Zend_Controller_Front::getInstance();
$front->addControllerDirectory(dirname(__FILE__)."/application/controllers", 'default');
$front->setParam('noViewRenderer', true);

And then I ran the same AB test: “ab -t 30 -c 10 URL” as the Yii guys. I also want to note that I ran the tests a few times to warm up the APC cache. Let’s look at the results:

  • Zend Framework 1.7.2: 184 RPS (requests per second)
  • Yii 1.0: 275 RPS
  • Yii 1.0 with yiilite.php: 235 RPS

And now lets evalue these test results:

  1. Even on a slower machine ZendFramework is more than 3 times faster with APC than in the Yii benchmark. (strange)
  2. In comparison Yii is not 800% faster than ZF like shown on the Yii benchmark page.

It’s possible I’ve made a mistake somewhere. It would be nice to see more people testing this.

, , , Hide



Certification to be continued

I’ve recently got listed on the Zend yellow pages. Even managed to get a comment from a Zend employee on my last blog post about PHP5 certification.

I’m also interested in MySQL developer and MySQL DBA exams. I have been working with MySQL for more than 5 years and I still don’t feel that I know all it’s angles really well. Recently I’ve started reading the MySQL 5.0 certification study guide. It will be interesting to compare the Zend and MySQL certification programs. While reading the book it was odd to find out that MySQL Query Browser was the third chapter of the book. And you must be able to know your way around the tool to take the developer exam. I have never used MySQL Query Browser and phpmyadmin has allways sufficed my needs as a web applications developer. Though I agree it is very useful tool. The study guide book comes with a CD that has training exercises in it. I was a little disappointed when I didn’t find a mock exam application to test what I’ve learned but instead found a PDF e-book with questions from every chapter. Still better than nothing. Even though the guide states that it is designed to make you think instead of memorize the material I think it is more effective to learn by taking tests.

, , , Hide



Percona offers XtraDB to replace InnoDB

Who could have guessed Percona would decide to release their own storage engine named XtraDB for MySQL. It’s a drop in replacement for InnoDB. They are forking a version of InnoDB and applying patches of their own. Not only that they are going to put more effort to it to make it something more than just a small variation of InnoDB. Even now it seems to offer better performance and scalability than InnoDB. It also frees XtraDB from Oracle that did an awesome job creating InnoDB but it seems percona want’s to go to the next level. Happy to see XtraDB will be available for others to modify and submit patches. It’s also interesting to find out Percona will be trying to sponsor future changes of XtraDB through their customers.

It is also nice too see that there are some thoughts to merge XtraDB into Drizzle.

, , , Hide



Finally a Zend Certified PHP5 Engineer!

Zend the PHP company Finally! After months of battles with myself delaying the day out of pure laziness I took the PHP 5 Zend Certificate exam and passed it! Should be visible in the yellow pages in the following 7 days. I’m really happy I have done this and I hope this will help me in the future to prove my worth to current and future employers.

I’d love to share some details about my experiences with my readers who might one day take the exam themselves.

First of all.. It’s sad that companies such as Zend or PearsonVUE can’t store my firstname and lastname with a proper encoding. Surprising that such world famous international companies don’t use UTF8 encoding. The paper I got after taking the exam had my name written as “?ilvinas ?altys”. When I forgot my password and had to fill in my first name and last name to get a new one I had to use question marks to make it work.

Before taking the exam I’ve done about 13 mock exam tests. I also had problems to order them and had to contact Zend and wait for weeks to complete my order, the tests them selves aren’t very good. You get 70 questions and 90 minutes to answer them. Tests had lots of mistakes and sometimes rather dumb questions. For example .. Which methods are required to implement when implementing the Iterator interface. Tests give 5 choices and ask to select 5 choices. Then there are questions which you cannot answer correctly because either they are out of date or they are wrong from the start. Then there are questions that ask you questions about the PHP virtual machine implementation or PDO extension options or Sqlite performance configuration settings. Good luck knowing all that. After 10 tests you start shooting answers like darts because questions start to repeat a lot. The most frustrating thing is that it’s really hard to learn from these mock tests. They don’t tell you which questions you have answered correctly and why were you wrong. When you start doing a test you look for answers on the internet to find out what is the correct answer and it may some time to do it for any single question. Funny enough I have never got a completely excellent score from the mock exams. I always failed in at least one category and couldn’t figure out why.

Mock exam results

About the exam itself. A heard a lot of poeple saying. “Oh it’s easy!”, “Oh it’s easier than the mock exams!”, “It’s basic level!” If you can complete that exam and you are confident that you have answered atleast 90% of the questions correctly you are a walking bible of PHP that knows the manual really well, all the possible configuration options, all the nonsense tricks in PHP and have some profesional experience. It’s not that easy. A lot of questions are hard to answer. Most of the time you can be only 80% sure. Unless of course you have a very good memory and can remember all the details. Not many developers know what PHP does with floating point array keys or how exactly PHP handles type juggling. When I was about to end the exam I was not sure I will pass it. I knew for sure that there were a lot of questions that I wasn’t 100% sure of. There are tons of questions where the exam tries to TRICK you. For example .. You have a lot of code with classes, abstractions and it asks you what does it output? And you can get confused and not notice that there is no echo statement anywhere and there’s no output. Somewhere I’ve found that noone completed the exam with perfect score and I think it was a statement by Zend itself but I’m not completely sure. You have to answer about 50 - 60% of the questions correctly to pass the test.

A few things were disappointing and could have been better but in the end I’ve achieved my goal and would like to thank Zend for making it possible. Certificates can’t tell if someone is a great developer or a nice person but they can definitely tell how much someone knows about the details of a programming language.

, , , Hide



Review of php|architect / September 2008

Again. A few months late. Happy to see the magazine is going through some new exciting changes.

ATK - A Business Framework

I’m lost in the development world about what a framework is these days. But ATK seems more like a CMS to me. Or atleast you can build one in minutes. ATK itself is quite interesting. It wants developers to write as little code as possible. And you don’t call ATK, it calls you! Meaning that you create something unique to your application like a data node description file and ATK will know when to use it. It’s very easy to create various entities and describe their relationships with ATK so it’s bassically a web application bakery. The article does not say much about the performance or extendability of ATK itself. I was sceptical at first but then I changed my mind that this software project sounds like a worthy tool.

Messaging The Web

It’s an interesting idea to use email as middle communication layer between your phone and your PHP applications. Was nice to find out that you can feed emails using sendmail directly to php scripts instead of using crons. Though I wouldn’t use it for server control like in the article itself. Most phones have email support today and can send emails themselves. I think this is more of a poor man’s solution anyway. But I still believe it is a nice idea and could be useful for something.

Working with the Zend Platform

A great article. Never checked what Zend Platform has to offer and I was suprised. Too bad it can’t work together with Xdebug and APC but Zend offers some replacements. The Zend Platform is great for a web developer using windows to quickly setup a dev environment. All you need is Zend Core and Zend Platform which are free for development purposes. Zend Platform itself is like a web application that allows you to do a lot of neat things. I think that the most valuable thing is the events logger. It logs php errors, execution times and other things, agregates it and presents it in a very nice interface and allows you to find and investigate problems quickly. The cache feature in the Zend Platform is also nice for some quick caching solutions. It has never been easier to cache a page. Just provide the URLs you want to cache and it’s done. Zend sessions clustering is also a nice thing. I think it would be great to have it as a free extension. It’s easy to setup shared sessions when you can’t afford storage servers or sticky sessions and must have high availability.

HTTP Streaming

This article explains how to create an application that connects to a socket. Using telnet you can write messages which popup in a web browser which is constantly buffering messages from a socket using php and ajax. I like the main idea to use this for monitoring. For example you could stream your web server cluster error logs into a single browser page and try to investigate potential problems.

Creating Web Interfaces with Stickleback

Yet another framework named stickleback and developed by Yahoo. Stickleback is a general purpose plug-in framework. I missed the reason behind this framework. What are it’s strengths and weaknesses compared to other frameworks. It says it’s extremely extensible. Anything else? Article shows how to create an application that displays a few headers and a table and show some of the framework components. Looks like a “Hello World” program. Would have loved to understand why this framework stands out from all the other frameworks.


One of my most favorite columns. I sympathize with the idea that to show something using a programming language and choosing a hello world program to do it is not the most effective way to do it.

, , , Hide



MySQL Top N Sort Algorithm

While reading planetmysql I’ve found a very interesting article about Top N Sort algorithm. It would be nice to have this implemented in MySQL. There are millions of applications that have sorted and paginated lists of data. Some of those lists are really big. For example company that I work for has a web application with a report that has milions of rows and it has to be sorted and it only shows a few hundred rows in a single page. This would definitely be a great improvement to MySQL.

, , Hide



MySQL character sets and collations

Another great article I’ve found about MySQL character sets and collations that demystifies all the so often found problems in projects made by confused developers. This also can help you to save some space your database takes and improve your queries performance because more of your database can fit into memory.

, , , Hide

Find it!

Theme Design by