Sunday, November 18, 2007

Vimagi Speedups

Vimagi was much slower than it should have been.

I had foolishly compiled Vimagi in production with {auto_compile, true}. This option tells ErlyWeb to scan the app's source files and recompile all the ones that have changed since the last request. This feature greatly speeds up development because you can edit your file, reload the page, and immediately see the effects of your changes. It was also convenient for me in production because after checking in some changes from my dev box I would just 'svn up' on the production server and the changes will be deployed automatically. Unfortunately, I didn't realize what a negative impact it has on performance. Thankfully, David King brought this to my attention on the ErlyWeb mailing list and I've since disabled auto_compile on the production server.

Vimagi performs much better now. Clicking around the site, most pages now load in 0.3 - 0.5 secs according to YSlow. It feels much faster. In fact, Vimagi's performance is now similar to BeerRiot's, which is no small feat.

By the way, I'm not sure about BeerRiot, but Vimagi's pages are all dynamically generated -- I haven't implemented any caching (my VPS can easily handle the current traffic levels, so implmeneting caching right now would be a premature optimization). For an entirely dynamic site, I think this is very good performance.


Bryan said...

Nicely done on the speedups. BeerRiot is the same: all dynamically generated with almost no caching yet. I've written some skeleton code to handle it in places I expect it to be useful, but I've left it out for simplicity's sake so far.

The only other thing I've done to my production system is recompiled ErlyDB such that it doesn't try to print out every SQL command. I don't know that I've seen a lot of speedup from that change, but it seemed unnecessary to send debugging messages to a console that isn't even attached.

Have you tried recompiling with HiPE yet? Developing on PPC Mac and deploying on x86 Linux, I wasn't sure if I'd see any discontinuities, so I haven't gone down that path yet.

Andy said...

I'd love to see some benchmark data of ErlyWeb against other frameworks. Would love to see if all the claims of performance and scalability holds up. Not that I'm skeptical, but empirical data is always nice :)

ErlyWeb against PHP, JSP, RoR, Python, .NET, and some Java framework would be awesome.

Please do it!

Yariv said...

I agree this benchmark would be very interesting. I'm curious, too, how ErlyWeb's performance compares to other frameworks'. However, I have a few other things on my plate right now so I can't promise I'll do this benchmarking in the near future. It would be great if someone else volunteered to do it.