Tutorial :User uploaded images on google app engine?


Say you are creating a facebook style app for the app engine. How would you handle user profile pics?

As far as I know, you would have to either store the images in the datastore or blobstore. Which means every fetch to a picture would require going through a dynamic handler and using up at least 20ms cputime.

Is there an efficient way to do this? Or is this just something the app engine can't currently handle?


You don't have this issue anymore, since get_serving_url() doesn't use any of your CPU quota (only outgoing bandwidth and storage). Plus it gives you scaling and cropping for free.


Let's compare a few different options:

Google App Engine:

  • $0.10 per CPU hour
  • $0.12 per gigabyte outgoing bandwidth

Google Storage for Developers:

  • $0.01 per 10,000 GET requests
  • $0.15 per gigabyte downloaded for Americas and EMEA

Amazon S3:

  • $0.01 per 10,000 GET requests
  • $0.15 per gigabyte up to 10 TB / month data transfer out

Say you're serving 10 million images at 50KB each.

On App Engine, with a dynamic handler using 20ms per request, this is going to cost you $57.22 in outgoing bandwidth plus $5.55 in CPU time. On Google Storage or S3, you'll pay $71.52 for the outgoing bandwidth plus $10 for the GETs.

So basically if your handler uses less than 36ms CPU time, it's cheaper on App Engine than on services designed for this exact purpose. Somebody double-check my math, please. =)


And cache the most recently used images in the memcache. That's pretty much all the platform affords.

GAE is a good tool for the class of applications it was built for. Making a Flickr clone is outside its design intentions.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »