Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
tofuCOOKPAD’s image systemIssei NarutaCOOKPAD Inc.2 Nov 2011
about meIssei Naruta (             )Engineer, COOKPAD Inc.Infrastructure Team  image system / high performance webtwitter:...
cookpad.com900 million PV/monthOver 1 million recipesRails 3AWS(Amazon Web Services)
COOKPAD.has_many(:thumbnails)                    280x280                     144x216original image (1000x1000)
When/How do wegenerate thumbnails?
BEFORE TOFU (a year ago)  User                        Generate thumbnailsuploadsan image                app (rails)     or...
ProblemWe should generate thumbnails ofall existing images as new sizewhen another size thumbnails are needed(We have 7 mi...
AFTER TOFU (now)  User                         Store original imageuploadsan image                 app (rails)     origina...
AFTER TOFU (now)Store original image     Generate thumbnails                            On demand                       to...
tofu architecture             akamai (cdn)                  ELBApache        Apache            Apache(mod_tofu)    (mod_to...
mod_tofu.soC (Apache module)ApacheImageMagick
thumbnail url         category thumbnail sizehttp://hostname/recipes/1/280/0e473ffbce0eb1e28a892fe4086b65b6.jpg           ...
resizing                                    height=free                    width=280 /recipes/1/280/0e473ffbce0eb1e28a892f...
cropping                                  100 x 100                               & center cropping/recipes/1/100x100c/819...
jpeg quality (for mobile)    low        ‘100x100cq10’               ‘100x100cq30’               ‘100x100cq50’             ...
On-demand resizing by urlFastScalable
On-demand resizing by urlFastScalable
Peak traffic             akamai (cdn)                    7000 req/sec                  ELB              800 req/sec        ...
fetch images   from S3  resize byImageMagick
On-demand resizing by urlFastScalable
tofu scalability = AWS scalability                         akamai (cdn)                                                 au...
tofu effect Our prototyping workflow became more fast and flexible Save storage diskspace Maintenance becomes easily
Thank you for your listening
Upcoming SlideShare
Loading in …5
×

tofu - COOKPAD's image system

10,111 views

Published on

A slide which I talked about "tofu" at TOKYO Rails Meetup #5
http://www.tokyorails.org/events/39774252/

Published in: Technology, Self Improvement

tofu - COOKPAD's image system

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

×