1. June 2008, 21:15, by Silvan Mühlemann

Unit testing makes coding more fun

“unit testing is a test that validates that individual units of source code are working properly”, that’s what Wikipedia says about unit testing. That’s general knowledge.

But what motivates me even more than the increased software quality is that it saves me development time. This sounds odd as you might believe that TDD means writing more code.

Here’s a real-life example:

Filed under: PHP,Programming,Web Development
20. May 2008, 11:11, by Leo Büttiker

tilllate.com is now all Zend Framework.

Trevi FountainWe made it! Last Friday we have replaced the last two legacy components with their Zend Framework based counterpart: The gallery an the user registration. The whole site tilllate.com is now running on Trevi, our extension of Zend Framework. With a reach of 2.5 million unique clients a month, tilllate.com is one of the world’s biggest installation of Zend Framework.

Ciprian, Ivan, Jia-Yong, Kevin, Leo, Riv, Roger, Sanja, Thilo, Vanja, Vladimir and project manager Maarten have done a wonderful job reverse engineering the old, smelly spaghetti code and refactoring everything in a clean and solid MVC architecture: 115’480 Lines of code (Thanks StatSVN).

Filed under: PHP,tilllate.com,Web Development
11. May 2008, 12:54, by Silvan Mühlemann

Unit test practice at tilllate.com

For now over three years we are working with unit tests. I’d like to share some of those experiences.

As we have two frameworks in place for our website, I can compare two different strategies for unit tests.

In our homemade legacy framework we were using SimpleTest. Mainly because I read PHP|Architect’s Guide to PHP Design Patterns and Simpletest was Jason‘s framework of choice.

We have a cron job running which runs all tests every hour. The results of the tests are being shown on a page. The results are also displayed in Nagios.


Filed under: PHP,Programming,Web Development
18. March 2008, 03:44, by Maarten Manders

Enterprise Manboobs!

Martin Fowler and Jim Webber doing stand-up comedy Last week, I was lucky to go to QCon 2008 in London to meet with all the big names in the software industry. This was a great opportunity to see what everyone’s working on and to get a feeling for the newest trends in software development. Here’s what my gut says about the world of software development after QCon 2008 (part 1):


Filed under: PHP,Web Development
7. January 2008, 08:39, by Leo Büttiker

Trevi is online!

Trevi FountainTrevi is not only a fountain in Italy, it’s our new application framework as well. We migrated our first pages to this new platform and brought them online three weeks ago. But let me explain the story of Trevi.

Another Framework?

There’re already thousands of web frameworks out there so I would sink into the ground if we really wrote another one. But serving pages for 2 million unique clients, it would also not have been a solution to just go to a shop and take the beautiful looking, nice boxed xyz framework from a big company. So my co-worker (and Trevi project lead) Maarten started a year ago to evaluate a framework that fits our needs best.

Filed under: Management,PHP
5. January 2008, 22:16, by Leo Büttiker

Why paging needs a lot of performance

On the view of your database the worst thing you can do in your web app is paging. Paging is horrible in the view of performance. To explain let me make a little example:

        [... some more fields...]
FROM member_gold_guestbook gb
LEFT JOIN users u ON u.uid=gb.uid_from
[... some more left joins...]
WHERE gb.uid_to='22152'
AND visible='1'
LIMIT 0,10;

That’s not that bad at all, but when you go to page 300 your database server will hate you for this. The database server has not only to calculate the 10 items you want to show but also all 3000 previous items.

Sure you may argue nobody will ever go to page 300. Somebody will not, but “googlebot” and his evil brothers will. And the bad thing is that you can do nothing against it, as long as you need paging. There are just a few tricks that may reduce your server load a bit.


Filed under: Database,PHP
20. December 2007, 11:30, by Vladimir Tišma

Graceful degradation of AJAX controls (Thank You Tube)

In many companies, management decides to setup a web proxy server to be able to control/disable the non-busines-related content. YouTube could probably be blamed for many hours spent doing non-business stuff.

Well, I use YouTube myself. Sometimes when taking a break and sometimes to listen to music that goes with the video, and you don’t have to watch it at all, but it’s probably the fastest way find and listen to a certain song if it’s available. Well, this time, YouTube will be a critical factor to finding the elegant solution.


Filed under: PHP,Web Development
30. November 2007, 10:20, by Maarten Manders

Caching of Dynamic Data Sets

Consider you have a set of data that is changing dynamically for each page request and you need to cache that data the fastest way possible. You can’t cache dynamic and unpredictable data as a whole, can you? Hence, we would put each data entry into cache separately to be able to fetch it separately and dynamically. But this means bombing your cache infrastructure with with requests.

Caching Text Elements

Let’s get more concrete. To translate tilllate.com into all different languages, we use text elements (like gettext). For storage we are using MySQL and thus each text element is a row in the translation table. While this storage is very easy to maintain, it is quite silly to use in production, where you have ~100 text elements per page and peaks of 1500 page requests per second with a resulting 150’000 MySQL queries per second. Don’t even ask, we don’t do it. But even for a highly scalable memcached infrastructure, a 150’000 requests per second just isn’t easy to digest.

Let’s talk about a better solution. It consists of three concepts: Two-Tiered Caching, Incremental Caching and Cache Versioning.

Filed under: PHP,Web Development
11. November 2007, 18:01, by Silvan Mühlemann

Squid and Mysql metric scripts for Ganglia

Ganglia Title imageAfter a long day of meetings and other tedious manager work the perfect way to relax is to code. The best is a mini-projects where you see your results after an hour or so. I call these tasks “Plausch-Projekte” (“plah-oosh project” =”fun projects”).

This week my plah-oosh projects were two metric tools for Ganglia. Besides Nagios Ganglia is the main monitoring tool for our cluster. We monitor something like 20 metrics like load, memory, disk usage, network activity.

Ciprian and Stefan recently built a script to monitor apache (bytes/sec, hits/sec, idle processes etc.) via the /server-status interface. Based on their work I hacked two scripts:

ganglia_mysql_metrics.php monitors multiple mysql parameters like queries/sec, slow queries/sec, threads connected:
Screenshot of mysql_* metrics in Ganglia

ganglia_squid_metrics.php reports regularly about squid metrics: Requests/sec, service time, available file descriptors:

Screenshot squid metrics in Ganglia

The scripts are quick and dirty code. Procedural. Not well documented. Does only read the mcast_port from the config file and ignores the rest. But it might be a good base to be used on your cluster too. Just call them every minute via the crontab.

29. September 2007, 08:44, by Silvan Mühlemann

Sharedance, Memcached and Cache_Lite

Treasure ChestWith 125 million page impressions a month and highly dynamic content, caching is essential for tilllate.com. At tilllate, we have worked with several different caching techniques. Before we used caching, we just pre-generated the data: A nightly cron job populates a database table or generates a file containing the expensive data. Usually expensive queries, like the Most viewed pictures.

Then we are using Cache_Lite a lot. For example our homepage: If you look at the source code of our homepage you will notice the string <!--cache id a:4:{i:0;s:1:-->. This means that the page is coming out of the cache. There are a few disadvantages of Cache_Lite:

Filed under: PHP,Programming,Web Development
« Previous PageNext Page »

© 2018 tilllate Schweiz AG - Powered by WordPress