riskable
07-31-2009, 02:26 PM
I just thought I'd post an update regarding something rather pertinent: I finally got my hands on a RouterStation and loaded up PyCI on it moments after I had it up and running...
It didn't work :(
...at all. Period. It appears that there's something broken with the math libraries or some math part of the Linux kernel on the image that ships with the RouterStation that causes Python to completely crap out on anything more complex than 1+1.
So I spent some time building and loading a firmware image from the latest OpenWRT SVN repository... That fixed the math problem! PyCI was now running on an actual RouterStation!
INCREDIBLY SLOWLY
Yes, it was PAINFUL to sit there while it took 30+ seconds to load the login page. Ouch! However, being the resourceful guy that I am I tried a few things to see if I could figure out what was slowing it down...
Was it the number of threads? No. Increasing them was still ridiculously slow.
Was it Python? No. Benchmarking Python revealed that it was plenty fast enough.
Was it CherryPy on MIPS? Not that either. It seemed to run everything ELSE just snappy.
Was it the compression I was using? YES! It turns out that the flash filesystem on a RouterStation is just too slow at reading/decompressing gzipped tarballs.
So I changed the code and the build script to just gzip each file individually (skip the tarball part) and see if that had an impact... That fixed it (!) and it gave me a chance to try something I've had in my TODO list: Would it be possible to serve the gzip-compressed files to a browser without first decompressing them?
After about 10 minutes of trying various things I had it working: The files are just served up pre-compressed to the web browser--skipping the decompression part completely (and everything displays fine since every browser supports gzip these days--even IE6)! How did it impact performance? Here's a rundown on what I did to speed everything up:
1) Switching from tarballs to individually gzip-compressed files cut the average page load time from 30+ seconds to about 8 seconds. MUCH better but still kinda slow. This increased the size of PyCI by about 100k but that isn't enough to be a big deal. There's still plenty of room left on the RS (4.5MB free as I write this with many extras installed).
2) Switching from decompressing the gzip files to sending them as-is brought the average page load time down to about 2-3 seconds. That's pretty good! Some complicated AJAX pages still take 5-7 seconds and there's one page that takes 10 seconds but I can fix it (just need to have the page do a bit more on-demand loading of things hidden from view when the page loads). Regardless, the pages that take longer still load quite fast--it just takes an extra second or two to finish loading things like extra informational panels (which, from a usability perspective, is precisely how it should work).
Testing shows that just about every page displays the relevant/important pieces under 2 seconds so I'm pretty happy with the performance. Of course, things can be tweaked further :) .
So I went from freaking out (PyCI doesn't work!) to being pleasantly pleased. I wish I had time to post a new screencast since I've added like 90% of the remaining required features.
I just finished the speed test requirement and I really like how it turned out!
It didn't work :(
...at all. Period. It appears that there's something broken with the math libraries or some math part of the Linux kernel on the image that ships with the RouterStation that causes Python to completely crap out on anything more complex than 1+1.
So I spent some time building and loading a firmware image from the latest OpenWRT SVN repository... That fixed the math problem! PyCI was now running on an actual RouterStation!
INCREDIBLY SLOWLY
Yes, it was PAINFUL to sit there while it took 30+ seconds to load the login page. Ouch! However, being the resourceful guy that I am I tried a few things to see if I could figure out what was slowing it down...
Was it the number of threads? No. Increasing them was still ridiculously slow.
Was it Python? No. Benchmarking Python revealed that it was plenty fast enough.
Was it CherryPy on MIPS? Not that either. It seemed to run everything ELSE just snappy.
Was it the compression I was using? YES! It turns out that the flash filesystem on a RouterStation is just too slow at reading/decompressing gzipped tarballs.
So I changed the code and the build script to just gzip each file individually (skip the tarball part) and see if that had an impact... That fixed it (!) and it gave me a chance to try something I've had in my TODO list: Would it be possible to serve the gzip-compressed files to a browser without first decompressing them?
After about 10 minutes of trying various things I had it working: The files are just served up pre-compressed to the web browser--skipping the decompression part completely (and everything displays fine since every browser supports gzip these days--even IE6)! How did it impact performance? Here's a rundown on what I did to speed everything up:
1) Switching from tarballs to individually gzip-compressed files cut the average page load time from 30+ seconds to about 8 seconds. MUCH better but still kinda slow. This increased the size of PyCI by about 100k but that isn't enough to be a big deal. There's still plenty of room left on the RS (4.5MB free as I write this with many extras installed).
2) Switching from decompressing the gzip files to sending them as-is brought the average page load time down to about 2-3 seconds. That's pretty good! Some complicated AJAX pages still take 5-7 seconds and there's one page that takes 10 seconds but I can fix it (just need to have the page do a bit more on-demand loading of things hidden from view when the page loads). Regardless, the pages that take longer still load quite fast--it just takes an extra second or two to finish loading things like extra informational panels (which, from a usability perspective, is precisely how it should work).
Testing shows that just about every page displays the relevant/important pieces under 2 seconds so I'm pretty happy with the performance. Of course, things can be tweaked further :) .
So I went from freaking out (PyCI doesn't work!) to being pleasantly pleased. I wish I had time to post a new screencast since I've added like 90% of the remaining required features.
I just finished the speed test requirement and I really like how it turned out!