Your SlideShare is downloading. ×
  • Like
tofu - COOKPAD's image system
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

tofu - COOKPAD's image system


A slide which I talked about "tofu" at TOKYO Rails Meetup #5 …

A slide which I talked about "tofu" at TOKYO Rails Meetup #5

Published in Technology , Self Improvement
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. tofuCOOKPAD’s image systemIssei NarutaCOOKPAD Inc.2 Nov 2011
  • 2. about meIssei Naruta ( )Engineer, COOKPAD Inc.Infrastructure Team image system / high performance webtwitter: @mirakui
  • 3. cookpad.com900 million PV/monthOver 1 million recipesRails 3AWS(Amazon Web Services)
  • 4. COOKPAD.has_many(:thumbnails) 280x280 144x216original image (1000x1000)
  • 5. When/How do wegenerate thumbnails?
  • 6. BEFORE TOFU (a year ago) User Generate thumbnailsuploadsan image app (rails) original thumbnails storage
  • 7. ProblemWe should generate thumbnails ofall existing images as new sizewhen another size thumbnails are needed(We have 7 million original images!)
  • 8. AFTER TOFU (now) User Store original imageuploadsan image app (rails) original original storage
  • 9. AFTER TOFU (now)Store original image Generate thumbnails On demand tofu original storage
  • 10. tofu architecture akamai (cdn) ELBApache Apache Apache(mod_tofu) (mod_tofu) … (mod_tofu) S3
  • 11. mod_tofu.soC (Apache module)ApacheImageMagick
  • 12. thumbnail url category thumbnail sizehttp://hostname/recipes/1/280/0e473ffbce0eb1e28a892fe4086b65b6.jpg id SHA1(category+id+size+SECRET_WORD)
  • 13. resizing height=free width=280 /recipes/1/280/0e473ffbce0eb1e28a892fe4086b65b6.jpg
  • 14. cropping 100 x 100 & center cropping/recipes/1/100x100c/819d7abe2a8b9261aa3c43e948abe7b3.jpg
  • 15. jpeg quality (for mobile) low ‘100x100cq10’ ‘100x100cq30’ ‘100x100cq50’ ‘100x100cq70’ ‘100x100cq90’ high
  • 16. On-demand resizing by urlFastScalable
  • 17. On-demand resizing by urlFastScalable
  • 18. Peak traffic akamai (cdn) 7000 req/sec ELB 800 req/sec EC2 c1.xlargeApache Apache Apache(mod_tofu) (mod_tofu) … (mod_tofu) (8cores) 8 instances 100 req/sec per instance S3
  • 19. fetch images from S3 resize byImageMagick
  • 20. On-demand resizing by urlFastScalable
  • 21. tofu scalability = AWS scalability akamai (cdn) autoscaling ELBmore instances, by itselfmore capacity Apache Apache Apache (mod_tofu) (mod_tofu) … (mod_tofu) Oh yeah S3 It has a huge capacity!
  • 22. tofu effect Our prototyping workflow became more fast and flexible Save storage diskspace Maintenance becomes easily
  • 23. Thank you for your listening