Hacker News new | past | comments | ask | show | jobs | submit login

To achieve this performance we made some rather big changes to Webmachine. Basho will be looking into incorporating those changes into the mainstream Webmachine code.

Having worked with Webmachine, I'm really excited to see these big changes - does anyone know what they are?




The most important things we changed are:

- Pluggable dispatcher, as the original webmachine copies all dispatch rules for every request. This gave us the greatest speedup as a Zotonic server typically has hundreds of dispatch rules.

- Removal of all process dictionary use. This makes testing easier and also gave a nice speedup.

- Use proplists instead of dicts for small dictionaries.

- Use a memocache for the resource callback functions.

- Removed the use of parametrized modules, this enables us to copy less data (and gives simpler code).

- Added support for protocol upgrades (for Websockets)

Our dispatcher also accepts regular expression checking on uri parameters. And it uses a different approach to vhost handling, allowing a redirect to the main hostname (which is needed when you set browser cookies).


Altogether these optimizations make quite a big difference, removing over 1ms from every request.

if you're interested you can clone zotonic's webmachine from deps/webmachine in the zotonic hg repo.

we sent these changes to basho (justin sheehy) but up until now they never took a look at it although they promised it. We're still hoping they include the changes however.


Justin is just super busy. I understand that he didn't merge it yet, as our delta is touching major parts of almost every file.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: