iPerSec
internet Performance & Security

Switching to a new scripting language ?

septembre 1st, 2008 by jfbus

Why I don’t like PHP

After having spent quite a few years programming PHP (from functional to OO programming), I just realized I don’t really like this language. The main problems I think are with PHP being :

  • The lack of consistency : functions not always follow the same naming conventions (underscore, no undescore), and, more important, parameters are not always in the same order ($haystack, $needle or $needle, $haystack ?)
  • The lack of universality : PHP only really works in web-only environments (ie : using mod_php or FastCGI). But sometimes you would like to write daemons, servers (ie to asynchronously process data), and this is nearly impossible to do in PHP. The main reason : the memory footprint of any typical PHP program is too high (due to the lack of garbage collection or to memory leaks). I’m still amazed that PHP 5.2.6 just fixed a “huge memory usage” bug in string concatenations (!!!).

You can also add many less generic problems (ie : the fact that certain errors cannot be catched), but the list would be too long for this post.

Looking for an alternative

I spent a few days looking for an alternative that would :

  • be as productive as PHP (or better) - forget Java, or any other compiled languages like D
  • have a nice classical OO syntax - forget erlang & other
  • have a large user base and a nice framework
  • and of course cool

The two main languages that looked interesting were Ruby and Python (no tcl, sorry, anyone remember struggling with Vignette ?).

  • productivity: Python and Ruby look both good. Ruby might have a slight edge if you’re in the pure OO camp
  • OO syntax : Ruby IMHO is a clear winner : a nice, elegant pure OO syntax. Python is lacking real OO functions (it reminds me of PHP4), and I really don’t like the indentation-based syntax (I always have problems finding when a function finishes)
  • user base and framework : both languages have a large user base, and nice frameworks (ie Django for Python or Rails for Ruby)
  • coolness : Ruby wins easily this one (I really love the OO model, and really dislike the indentation-based syntax of Python)

The decision would have been pretty easy without Ruby’s little problem : performance. Where Python is pretty fast for a scripting language, Ruby 1.8 (aka MRI) really sucks (Ruby 1.8 is 2 to 3 times slower than PHP). Any twitter user has noticed that scaling a ruby website is not an easy task.
Yet there is a huge amount of work done by the community to address this problem : the recently-released Ruby 1.9 is nearly as fast as PHP, and a handful of alternative VM (JRuby, Rubinius, …) are getting better and faster every day. I bet that, in 2009, Ruby will be on par with Python.

You can expect to see some Ruby or Rails articles in the coming month…

Posted in PHP, Ruby | No Comments »

Quelques conseils de lecture…

septembre 1st, 2008 by jfbus

Me voici de retour après une longue absence loin d’ipersec (mais bien active par ailleurs).
En attendant de reprendre la publication de nouveaux articles techniques, voici quelques conseils de lecture hors-sujet :

  • Le blog de Maître Eolas, où officie un avocat qui ne manque pas de verve
  • Si la sécurité (au sens large) est votre dada, n’oubliez pas le blog de Bruce Schneier (en anglais) - ne le lisez pas si vous voulez conserver une totale confiance dans la sécurité des aéroports

Les deux derniers parlent de web, sans se tenir à des considérations techniques (d’où le hors-sujet) :

  • Le blog de Fred Cavazza parle de web 2.0, d’ergonomie, et de tout plein de choses intéressantes du même genre
  • L’incontournable TechCrunch, l’actualité du web 2.0

Bonne lecture !

Posted in French, Off-topic | No Comments »

Slides from “Forum PHP Paris”

novembre 22nd, 2007 by jfbus

I just talked at the Forum PHP Paris about tuning and cache. The talk was titled “Optimisation d’un site web 2.0 : le cas wat.tv“.

Here are the slides (in french).

Posted in PHP, Talks | No Comments »

varnish : simple and fast http acceleration

novembre 15th, 2007 by jfbus

I’ve been playing with varnish for a few days now. Until now, I have been using lighttpd as an HTTP accelerator, in front of my apache servers.

I love lighttpd a lot : it is simple, very efficient, and quite customizable through lua. But it is not a great HTTP accelerator :

  • it only uses non-persistent HTTP connections to the back-end,
  • it does not cache (a simple caching reverse-proxy can be written is lua using mod_magnet, but this solution is not satisfactory).

I had to find a better alternative…

Read the rest of this entry »

Posted in HTTP | 2 Comments »

Tuning slides from Ilia Alshanetsky

octobre 23rd, 2007 by jfbus

A friend of mine pointed me to some nice tuning slides, written by Ilia Alshanetsky (PHP 5.2 release manager).

Posted in PHP, Tuning | No Comments »

« Previous Entries