Skip to content

lighty developer blog

mod_cml is dead, long live mod_cml

Yep, mod_cml will vanish from the distribution of lighttpd 1.5.0. It will get a new name and will get a full blown set of functions to manipulate the execution of a request in lighty.

It reason to rename mod_cml is that the focus of this module has changed from the its first implementation. It is not about checking if a request is a cache-hit or not. It is about deciding how to handle a request. Any status code can be returned, any content source will be able to be queried to assemble the content (files, memcache).

The main reason is to allow us to change the names like ‘trigger_handler’ and ‘CACHE_HIT’ to something more appropriate. In the end no big change, but a neccesary one to make the use of this powerful module more obvious. … Perhaps the new name will be mod_cml … what would be the new meaning of this abbreviation ? Any suggestions ?

1.4.12 becomes 1.5.0

moo poked me today and was so right: “With all the changes going into SVN we shouldn’t call the next release 1.4.12, but 1.5.0”. Lifting the restriction on ‘try to stay compatible to the 1.4.x plugin-API I started right away on ripping the internals apart and put them together sliglty different.

If you are developing a plugin for 1.4.x right now, be asured that it won’t work without changes in 1.5.0. Let me explain what is changing.

X-Sendfile’s new friend: X-Rewrite-*

Today on IRC I got a question on:

Fobax can you x-send-file from fast-cgi to a proxy request?

Or asked in another way:

Can you use a mod_proxy_core backend to rewrite a URL or a Host header?

After 30 minutes of coding… Yes, you can …

Hash Balancing with mod_proxy_core

mod_proxy and mod_proxy_core support 3 balancers to spread the load over multiple backends. One of them is Hash balancing which is very good for balancing the load of caching proxies like Squid.

If you compare the performance of Hash-Balancing to the classic round-robin balancing you should see a increase of the performance as the backends can use their caches a lot better. With RR each backend has to handle the full URL namespace, with Hash-Balancing only a part. This increases the cache-locality and the overall performance.

mod_proxy_core commited to svn

mod_proxy_core just got commited to SVN and is now available to testers.

server.modules = ( ..., "mod_proxy_core", .. )

## works
$HTTP["url"] =~ "^/proxyme/" {
  proxy-core.balancer = "round-robin"
  proxy-core.protocol = "http"
  proxy-core.backends = ( "wikipedia.org" )

  ## to be done
  proxy-core.rewrite-response = (
    "Location" => ( 
      "^http://en.wikipedia.org/(.*)" => "http://127.0.0.1:1025/$1" ) )
  proxy-core.rewrite-request = (
    "URI" => (
      "^/proxyme(/.*)" => "$1" ) )
}

Reverse-Proxying mod_proxy_core

I just added and commited the header rewriting support for mod_proxy_core.

$HTTP["url"] =~ "^/proxyme(/|$)" {
  proxy-core.balancer = "round-robin"
  proxy-core.protocol = "http"
  proxy-core.backends = ( "en.wikipedia.org" )
  proxy-core.rewrite-response = (
    "Location" => ( "^http://en.wikipedia.org/(.*)" => "http://127.0.0.1:1025/proxyme/$1" ),
  )
  proxy-core.rewrite-request = (
    "_uri" => ( "^/proxyme/?(.*)" => "/$1" ),
    "Host" => ( ".*" => "en.wikipedia.org" ),
 )
}

The New mod_proxy_core

One thing I heard from everyone at the railsconf was: Please fix mod_proxy. In my talk I presented a look into the future and how mod_proxy will evolve in lighty 1.5.x, unification of the backend-plugin, .,.

Well, perhaps it will be a bit earlier than 1.5.0