Shellac
A distributed web accelerator.
Kalan MacRow
Data at Scale ‘13
Slide 2
Slide 2 text
Shellac. (noun)
Lac bug resin melted into thin flakes, used for making varnish
Kalan MacRow
Data at Scale ‘13
Slide 3
Slide 3 text
Shellac. (verb)
To defeat or beat (someone) decisively
Kalan MacRow
Data at Scale ‘13
Slide 4
Slide 4 text
5.2% of the top 10,000
sites.
Kalan MacRow
Data at Scale ‘13
Slide 5
Slide 5 text
Kalan MacRow
Data at Scale ‘13
!
Script interpreters
50+ SQL queries
Localization
Personalization
Template rendering
….
!
3 sec.
Slide 6
Slide 6 text
• HTTP/1.1 proxy server for Linux 2.5+
• Distributed RAM cache built on Memcached
• Level-triggered edge-polling architecture
• 1K lines of Python
Kalan MacRow
Data at Scale ‘13
Design
Slide 7
Slide 7 text
Kalan MacRow
Data at Scale ‘13
“The key to making programs fast is to make them do practically nothing”
— Mike Haertel, original author of GNU grep
Design
Slide 8
Slide 8 text
Kalan MacRow
Data at Scale ‘13
• I/O bound and largely avoids the GIL
• Substantial function/method/syscall call overhead
• Iteration with while, for expensive
• Event dispatch really suffers, but…
Design
Slide 9
Slide 9 text
Load
Balancer
Web Server
Accelerator
Cache
Web Server
Accelerator
Cache
Web Server
Accelerator
Cache
Typical HA
Kalan MacRow
Data at Scale ‘13
Slide 10
Slide 10 text
Shellac HA
Kalan MacRow
Data at Scale ‘13
Load
Balancer
Web Server
Shellac
Web Server
Shellac
Web Server
Shellac
Cache
Dedicated
Cache
Slide 11
Slide 11 text
Kalan MacRow
Data at Scale ‘13
• Interested in performance both
• as a proxy / load balancer
• as a caching proxy / accelerator
• Graphs: best of Apache, Varnish and worst for
Shellac over 3 runs
Evaluation
Slide 12
Slide 12 text
Kalan MacRow
Data at Scale ‘13
• 4 x m1.large instances (4 core Xeon, 8GB)
• Elastic Load Balancer
• Master for running benchmarks
• One availability zone, one region
Slide 13
Slide 13 text
Kalan MacRow
Data at Scale ‘13
Evaluation
Apache Benchmark (-n 10k -c 1000)
Slide 14
Slide 14 text
Evaluation
Kalan MacRow
Data at Scale ‘13
Apache Benchmark (-n 10k -c 1000)
Slide 15
Slide 15 text
Evaluation
Kalan MacRow
Data at Scale ‘13
Apache Benchmark (-n 10k -c 1000)
Slide 16
Slide 16 text
Kalan MacRow
Data at Scale ‘13
Static
Dynamic 1
Dynamic 2
Requests / sec. (mean)
Evaluation
10K requests, 1K clients
Slide 17
Slide 17 text
Static
Dynamic 1
Dynamic 2
Transfer Rate (KB/s)
Kalan MacRow
Data at Scale ‘13
Evaluation
10K requests, 1K clients
Slide 18
Slide 18 text
Static
Dynamic 1
Dynamic 2
Peak Memory Usage (MB)
Kalan MacRow
Data at Scale ‘13
Evaluation
Slide 19
Slide 19 text
Kalan MacRow
Data at Scale ‘13
Conclusions
• Shellac 0.1.0a is competitive
• as a proxy / load balancer
• as a caching proxy / accelerator
• A C port might shellac Varnish!
Slide 20
Slide 20 text
Future
• HTTP/1.1 compliance
• Try with PyPy JIT’ing, eventually port to C
• Binary format for cache entries
• Tighter integration of cache node with proxy
Kalan MacRow
Data at Scale ‘13
Slide 21
Slide 21 text
https://github.com/kmacrow/Shellac
Kalan MacRow
Data at Scale ‘13