First S3 Usage

I have successfully used Amazon’s Simple Storage Service for the first time. It’s one of those things that’s been on my to do list, but I just never got around to it. However, in the next week or two, I’ll be contracting to build a really simple small website and I thought it would be a perfect opportunity to use S3. But before that, I needed to test it out, and this morning was the perfect time to do so:

So I created a bucket on S3, and uploaded some of the stylesheets from this site to format it. Looks pretty good if you ask me. Although to really get it right I need to tweak the html some more, but for testing purposes it was perfect.

I had some starts and stop with S3 trying to figure out how to use it. Some of the references I used are:

Next step on the learning curve is to think about using the Amazon Simple Storage Service code for django and trying to integrate it into an application. I’ll need that for the end user of the website I’m going to be developing.

YSlow Experiment

Yesterday I was watching this video from Google I/O and one of the first things that mentioned is that the presenter is Steve Souders, former Chief Performance Yahoo! (joining a long list of former yahoo execs(Techcrunch)). The talk is interesting, but while Steve as at Yahoo he developed something called YSlow. I had heard of it before and I vaguely knew what it does. But I had never tried it.

So I downloaded the firefox extension and gave it a try. I tried using it here on this site to see how it would go. First run, I get a D. Which isn’t suprising since I am basically using the web-brains theme from byteflow with some tweaking. If you notice, the web-brains site also gets a “D”.

After trying to fix the various things that it recommends, I got my rating up to a “C”. C minus really since I’m sitting at 71 74. But that’s almost a 10 point improvement. Unfortunately, at the same time I created two javascript errors from two scripts in jquery. To be honest, they may have been there before, but I didn’t notice them until after I made the changes so I’m assuming that I did something wrong. But I was too tired last night to try and figure out what went wrong so I went to bed.

Another thing you may be interested in is that it was easier for me to get a higher score using nginx as the webserver rather than lighttpd. By a point or two better rating. I think it’s because it was easier to configure some of the web options for nginx than it was for lighttpd, though I don’t think I have either of them really properly configured. Actually, I generally have more problems with nginx than I do with lighttpd normally — largely because I really haven’t used it much so my knowledge of the configuration for ngnix is very superficial. But in this particular case, getting etags, gzipping, and expire working seemed like it “just worked”. There are a couple of directories on the server that for some reason I can’t get gzipped or set with expire. I’ll get there, but last night I gave up, largely because the configuration file was awfully blurry. ^_^;

One of the things that I noticed, though is that on a couple of the “rankings” it’s really hard to do anything about. For example, I use picasa for my images and embed them in a post. This has a couple of effects;

  1. I can’t control expire dates or whether they are gzipped and get down graded.
  2. secondly since it’s “off site” it causes a host lookup, getting me another bad grade. Now think about the way django works with a “media” web server, and you’re pretty much guaranteed a bad grade on this one. In the case of picasa, each picture is from a “different host”, making that much worse
  3. Until configured properly, you get downgraded for not using a “cdn”. By default, Yslow only uses yahoo I think, so any other location you server content from (your own media server, amazon, whatever) needs to get added to the profile or you get a bad grade.

So pretty much if you are embedding something from another site, like google analytics, pictures, or the Magnolialinks box I have on my sidebar, you are most likely going to get “downgraded”. But more importantly, it’s just something you can’t control unless you remove it.

After making the changes, I think there is a “slight” improvement. The real fundamental problem in this particular site’s case is more “backend” I think. I’ve got too many things running on a low-end box.

Video Take Aways

While I’m at it, let be give a brief overview of the take aways from Steve’s presentation.

Generally Javascript before CSS
Browsers block other “gets” until javascript is downloaded and executed
However, only that javascript that is required for rendering the page
Javascript should be lower in the page, i.e, right before body
This refers to javascript not required for rendering, a la google analytics
Use “Link” not @import for stylesheets
Avoid inline scripts if possible
put inline scripts before stylesheets
avoid long executing inline scripts

That’s all I can remember at this point. The video goes into some depth on the topic of speeding up rendering, but I got distracted by trying YSlow and didn’t really pay attention to the whole thing yet.

Japanese Django Book

Just found out that one of the developers of Monologista SA (stand alone) and Monologista GAE has written a book on Django in Japanese. A full 520 pages based on the trunk version and not 0.96. Very cool.

The book is a collaborative effort of four folks, including Masuda-san who lead the translation of django documentation into Japanese at Django-JP. Another one is from a blog I’ve been reading for a while, largely due to this post. I recognize the last name but can’t say I know much about him.

The book is not on sale quite yet, but will be available any day now. Of course, if you don’t read Japanese it may not be very helpful. ^_^; I think I’d like to get one. Wonder if my credit card in Japan is still active…..

As we were talking about it, voluntas mentioned that he had finished coding version 2 of Monologista GAE. They are working on some design changes before they update the live version. He also mentioned that he’s writing up deployment/installation documentation and I agreed to translate it into English for him. Actually, I was one of the first translators of Plone into Japanese way back when.

GAE Monologista — API Use

Yesterday, I saw over on GAE Monologista that voluntas submitted an update using the api (JSON only for the gae version). I did some googling but couldn’t figure out how to do it. So, I broke down and asked…..

Voluntas was kind enough to point me in two directions. The first was a firefox addon called poster. By the time I got it downloaded and installed into firefox, he then pointed my to a small python program he created, here. So I did that first. Works like a charm!

What To Do with Planet NEO

Planet NEO is killin’ me. Particularly on this low-memory vps.

Planet NEO has close to 500 feeds now. I have the update running hourly still. As I said in this post I dumped all the archived articles from before April 1, 2008, but I’m still sitting at 16,000 posts. So I have two problems.

Feed Updates

The first is when the feed updates. Due to the number of feeds being pulled, it’s taking a long time. And when the cron job runs, it just eats memory of which there is not much of to begin with. Almost invariably, the site doesn’t respond or you get a server error when the feed update is running.

Number of Posts and Tags

I think the other thing is probably just the sheer number of posts, and probably more importantly, the tags. When I run planet neo (it’s run as a standalone django app, powered by Feedjack), it eats up almost half of the total memory available. I’m not sure there is anything I can do about it other than eliminating the tag portion of the Planet.

GAE to the Rescue?

One of the feeds I am now following is called “GAE Planet“. Not surprisingly, it’s a “planet” running on top of gae, or google app engine. Perhaps, moving Planet NEO to use the GAE planet may be the solution. It’ll get it off of this box which will speed up my other planets. I am a little concerned that it will easily outstrip the “free” usage limitations of gae though. Then again, it may not be a huge deal. May be worth trying on small scale basis to start with…

I’ll need to check whether the gae planet code is available…

GAE Monologista

In the lost version of this blog, I had a post on monologista, a twitter-like clone built in Django. I even had a screenshot and I had begun a simple english how-to. Then, came along GAE and I got distracted.

Monologistaの皆様、ごめんなさいね。しかも、GAE版がある気がつくのも遅かったな。 

So the other day I posted about Meow, a twitter-like clone running on GAE. I thought it was pretty darn cool until about 15 minutes ago. Since Twitter was done (suprise), I decided to go take a look at monologista. I noticed that some one had mentioned a version that ran on GAE, so I headed over to the monologista trac.

Sure enough there was a link to http://monologista.appspot.com/. Sure enough, monologista running on google app engine. As far as I poked around, there isn’t any “following” on the GAE version while there is on the django version. Thinking about it, moew and twig don’t have it either. There must be something about GAE that makes it difficult. <-- you would think that somebody who is "watching" 4 people would realize that monologista does in fact have "following. Dunce. What it doesn't have are the little profile pics that twitter has. Then again, that my be part of twitters problem, eh?

On the trac server there is an API thingie for monologista and you get an API Key when you register for the monologista on gae. In fact, you, as with all GAE applications, login with a google account, but then create a “username” or nickname used for posting. To the right of the posts, there is a little profile box that tells you who you ware watching, etc. In that box, is your API Key.

I haven’t read the documentation yet, so I’m not really sure what you can do with the API Key.

Would be nice if there was a rss feed or something that I could plug into my webpage or blog. Then again, just the existence of monologista on GAE is more than I could have every asked.

Debugging Django

I’ve put the link up to this post by Simon Willison on both Ma.gnolia.com and Delicious. Great tips for debugging python. They are additional notes and tips to go along with this presentation on Slideshare.