Sloooow - Faster
real 0m3.337s
user 0m0.456s
sys 0m0.056s
Slide 36
Slide 36 text
Problem #1: Not cacheable
Slide 37
Slide 37 text
every user has different query params
http://rubygems.org/api/v1/dependencies?gems=foo,bar,baz
http://rubygems.org/api/v1/dependencies?gems=foo,bar,boo
Slide 38
Slide 38 text
new gem version every 5 mins
Slide 39
Slide 39 text
Not cacheable in
HTTP
Datastore (Redis)
Slide 40
Slide 40 text
Problem #2: Large Queries
Slide 41
Slide 41 text
SELECT rv.name, rv.number, rv.platform, d.requirements,
for_dep_name.name dep_name
FROM
(SELECT r.name, v.number, v.platform, v.id AS version_id
FROM rubygems AS r, versions AS v
WHERE v.rubygem_id = r.id
AND v.indexed is true
AND r.name IN ?) AS rv
LEFT JOIN dependencies AS d ON
d.version_id = rv.version_id
LEFT JOIN rubygems AS for_dep_name ON
d.rubygem_id = for_dep_name.id
AND d.scope = 'runtime';
Sizes
Deps (202mb) vs all marshalled gemspecs (1.1gb)
Gzipped (2.7mb) vs (20mb)
Slide 51
Slide 51 text
Performance of Whole Index
(new) 0.70s user 0.13s system 99% cpu 0.838
total
(old) 0.70s user 0.12s system 95% cpu 0.858
total
(just rails) 0.08s user 0.04s system 96% cpu 0.126
total
Slide 52
Slide 52 text
HTTP Cacheable
Slide 53
Slide 53 text
CDN
Currently Trying Fastly
Fastly (< 1s) vs S3 (> 2s)
Global Reach