Friday, January 28, 2011

Day 8 - nginx scripts : another name for templates ?

Discovered about scripts (the chapter I'm translating). Surprisingly, scripts look like
some basic template mechanism. It's built into the "HTTP3 part of nginx. You give it a string with
${variable_name} references in it and it will create some "byte-code" that
you can later run to produce strings. Of course, the variable referenced by "variable_name" must
have been previously extracted. And this is where you use the variables I
mentioned yesterday.

This definitely looks like another hardcore, performance-oriented implementation
of a "simple" feature. beyond the fact that it confirms that "devil is in the
details", it also makes me wonder "up to what point are you ready to go to
make something fast" (the ngx_http_script.c file itself is almost 2000 lines
long)? To me, this is another proof that Igor is not much of a compromise guy. But then
again, with compromises he wouldn't have written the fastest web server on
the surface of the planet...

No comments:

Post a Comment