开发者

User uploaded images on google app engine?

开发者 https://www.devze.com 2023-01-09 04:57 出处:网络
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开发者_如何学C datastore or blob

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开发者_如何学C 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?


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. =)


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消