Tuesday, April 8, 2008

HTTP Traffic Monitoring and more with Charles

Just stumbled across this post discussing monitoring network traffic for Grails applications. It's not really Grails specific, but I was surprised that my favorite monitoring Swiss Army Knife, Charles, wasn't mentioned until the comments (though to be fair, it is a shareware product costing $50 after the trial).

If you haven't looked at Charles, and you do web development or testing, you should do so. It's basically a local proxy server that gives you a great set of tools for monitoring and manipulating how your applications communicate via HTTP (if you are behind another proxy server, no worries, Charles can delegate it's calls to that proxy server).

You can see the feature list here, but the highlights for me are request/response capturing (the core of the tool), bandwidth throttling (to test applications at various "internet" speeds), and new in the 3.2 release is breakpoint support. Breakpoints are AFAIK a unique feature to Charles and they allow you to "interactively change requests or responses as they pass through Charles".

I also use Charles for a non web development purpose on my laptop to simplify dealing with proxy settings. Basically, I point all applications on my machine to Charles (e.g. Firefox, IE, Eclipse, etc.) and then I just change Charles to enable/disable the use of an external proxy depending on where I'm connected.

Anyway, it's a very useful tool that is well worth checking out.

2 comments:

Unknown said...

... Interesting: Charles also supports HTTPs sniffing. I've used Apache's tcpmon (bundled with Axis) in the past, and it was always useless when doing anything over SSL.

Also, I think it's also important to mention how valuable HTTP monitoring can be when doing web services. For anyone who has had to muck with the Commons HTTP Client 'wire' logger, a monitor is a Godsend.

Jim LoVerde said...

Yes, there are numerous tools for packet sniffing, with WireShark probably being the most feature rich that I've seen.

But packet sniffers aren't specialized for HTTP traffic and they generally only support monitoring and not manipulating the interaction.

The Firebug plugin for Firefox has a lot of the monitoring features, but again, even it doesn't have the feature set that Charles supports. Plus with Firebug you're limited to interaction from Firefox which doesn't help with cross browser testing.

Like I said, I use Charles for my normal day to day activity, not just for web development (though I usually have recording turned off). I can't tell you how many times something pops up where I want to see what's happening across the HTTP wire (even just seeing how many active HTTP connections are open) and having Charles right there makes it trivial to look at.