massive multitenancy with v8 isolates
play

Massive Multitenancy with V8 Isolates Kenton Varda - Tech Lead, - PowerPoint PPT Presentation

Massive Multitenancy with V8 Isolates Kenton Varda - Tech Lead, Cloudflare Workers The Challenge 165 Locations and growing Scalability can mean... Traffic (requests) Easy: More locations = more capacity. Tenants (apps) Hard: Every tenant in


  1. Massive Multitenancy with V8 Isolates Kenton Varda - Tech Lead, Cloudflare Workers

  2. The Challenge

  3. 165 Locations and growing

  4. Scalability can mean... Traffic (requests) Easy: More locations = more capacity. Tenants (apps) Hard: Every tenant in every location. Some locations are small!

  5. Needed: Efficiency

  6. I, , made or led: ● Protobufs v2 ● Cap'n Proto ● Sandstorm.io ● Cloudflare Workers Warning - I am : ● An experienced speaker ● A graphics designer

  7. Efficiency... App Code Footprint Baseline Memory Usage VM: 10GB VM: 1GB Container: 100MB Container: 100MB Needed: < 1MB Needed: < 5MB Context Switching Startup Time VM: low VM: 10s Container: medium Container: 500ms Needed: extreme Needed: < 5ms

  8. Other use cases APIs Run client code directly on API server. Big Data Processing Run code where the data lives. Web Browsers Run code from visited sites.

  9. We built this already!

  10. Browsers are optimized for...

  11. V8 JavaScript Runtime: An Extreme Multitenancy Engine

  12. Isolates and APIs

  13. VMs Containers Isolates Application Application Application Uncommon libraries Libraries Libraries Web Platform APIs Language Runtime Language Runtime JS Runtime Operating System Operating System Operating System Hardware (virtualized) Hardware Hardware Provided by host Provided by guest

  14. HTTP client: HTTP server:

  15. WebAssembly? WASM Isolates Application Language Libraries Language Runtime Application API Bindings Uncommon libraries Web Platform APIs Web Platform APIs JS Runtime JS Runtime Operating System Operating System Hardware Hardware Missing a way to share common runtimes...

  16. Resource Management

  17. OOM Killing as a First Resort OOM priority Isolate Isolate Isolate Isolate Isolate Isolate Isolate Isolate Isolate Isolate Isolate Desired total memory usage. Evict these. Prioritize: LRU, high memory usage

  18. Resource limits Isolates run on separate threads. CPU timer_create(CLOCK_THREAD_CPUTIME_ID) isolate.TerminateExecution() RAM Monitor with isolate.GetHeapStatistics() Evict isolates that go over limit.

  19. Code Distribution

  20. Security

  21. Is V8 secure enough for servers?

  22. V8 bugs... Deep in v8/src/compiler/typer.cc … Optimizer: " Math.expm1() can return real number or NaN." Forgot: -0 (negative zero) Full sandbox breakout! Awesome writeup: Google "Andrea Biondo V8 bug" Link: https://abiondo.me/2019/01/02/exploiting-math-expm1-v8/

  23. NOTHING IS "SECURE" Security is Risk Management

  24. Relatively more bugs than VMs. Reasons: ● Larger attack surface (Bad) ● More research (Good) ○ Bug Bounty ○ Fuzzing ○ Important target

  25. Risk Management VS Browser Server

  26. Risk Management VS Browser Server Install updates fast.

  27. Risk Management VS Browser Server Install updates fast. Install updates faster.

  28. Risk Management VS Browser Server Install updates fast. Install updates faster. Use separate profiles for trusted vs "suspicious" sites.

  29. Risk Management VS Browser Server Install updates fast. Install updates faster. Use separate profiles for Use separate processes for trusted vs "suspicious" sites. trusted vs. "suspicious" tenants.

  30. Risk Management VS Server Browser

  31. Risk Management VS Server Browser Store all scripts ever uploaded for forensic purposes. No eval().

  32. Risk Management VS Server Browser Store all scripts ever uploaded for forensic purposes. No eval(). Watch for segfaults, inspect scripts that cause them.

  33. Risk Management VS Server Browser Store all scripts ever uploaded … can't, privacy violation. for forensic purposes. No eval(). Watch for segfaults, inspect scripts that cause them.

  34. What about Spectre?

  35. We have no solution We can neither confirm except process nor deny that process isolation. isolation is enough.

  36. Thread 1 Thread 2 No (local) timers No (local) Freedom to (at all!) concurrency reschedule

  37. Big Picture

  38. Granularity Units of Mainframe Compute Commodity Server Virtual Machine Container Isolate

  39. Questions?

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend