YAWS caching issue

Experiencing strange delays between editing source files (like .html, .css, .js, .yaws etc.) and having those changes appear (or take effect) when you view the page in a browser served through YAWS?  I did, and it was annoying.

It’s also working as it is supposed to.  For performance reasons, when you launch YAWS on a development machine in the usual way…

$ sudo yaws

…the web server will cache content in RAM and only periodically check to see if the version on disk has been updated.  Depending on where in the cycle you make your change, you could be waiting up to about 30s before your edit finally propagates through the system.

If you’re like me, and used to making lots of small edits and quickly testing them before moving on, then the delay will annoy you.  You won’t know whether the edit has been recognised at all, or whether it has but isn’t working as intended.

Fortunately it is really easy to stop YAWS from caching so aggressively.  Just turn on interactive mode and, not only will you get extra diagnostic feedback in the terminal, but you’ll see the effect of changes to your edited files straight away.

$ man yaws

-i | --interactive
  Interactive mode. This will start yaws in interactive mode
  with an erlang prompt. All error_logger messages will be
  written to the tty as well in this mode. Use this when
  developing yaws code.

$ sudo yaws -i


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s