September 15th, Finagle + Java. A love story (

Similar documents
Java Without the Jitter

Transitioning from C# to Scala Using Apache Thrift. Twitter Finagle

Executive Summary. It is important for a Java Programmer to understand the power and limitations of concurrent programming in Java using threads.

How Rust views tradeoffs. Steve Klabnik

Creating Ultra-fast Realtime Apps and Microservices with Java. Markus Kett, CEO Jetstream Technologies

Managed runtimes & garbage collection. CSE 6341 Some slides by Kathryn McKinley

Managed runtimes & garbage collection

The G1 GC in JDK 9. Erik Duveblad Senior Member of Technical Staf Oracle JVM GC Team October, 2017

Swift 5, ABI Stability and

The Fundamentals of JVM Tuning

A Brief History of Distributed Programming: RPC. YOW Brisbane 2016

Fiji VM Safety Critical Java

CMSC 330: Organization of Programming Languages

Using Automated Network Management at Fiserv. June 2012

JAVA PERFORMANCE. PR SW2 S18 Dr. Prähofer DI Leopoldseder

Foundations of Software Engineering

Apple. Massive Scale Deployment / Connectivity. This is not a contribution

How Rust is Tilde s Competitive Advantage

Windows Java address space

OS-caused Long JVM Pauses - Deep Dive and Solutions

Servlet Performance and Apache JServ

PERFORMANCE ANALYSIS AND OPTIMIZATION OF SKIP LISTS FOR MODERN MULTI-CORE ARCHITECTURES

Java Internals. Frank Yellin Tim Lindholm JavaSoft

CMSC 330: Organization of Programming Languages

Evolution of Virtual Machine Technologies for Portability and Application Capture. Bob Vandette Java Hotspot VM Engineering Sept 2004

Top Ten Enterprise Java performance problems. Vincent Partington Xebia

Cs703 Current Midterm papers solved by Naina_Mailk. Q: 1 what are the Characteristics of Real-Time Operating system?

Runtime Application Self-Protection (RASP) Performance Metrics

Thread Safety. Review. Today o Confinement o Threadsafe datatypes Required reading. Concurrency Wrapper Collections

Agenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1

Kotlin/Native concurrency model. nikolay

Habanero Extreme Scale Software Research Project

Performance of Non-Moving Garbage Collectors. Hans-J. Boehm HP Labs

Distributed Systems. The main method of distributed object communication is with remote method invocation

Benchmarking/Profiling (In)sanity

Extensibility, Safety, and Performance in the Spin Operating System

CS558 Programming Languages

CMSC 330: Organization of Programming Languages. Memory Management and Garbage Collection

Chapter 4: Threads. Operating System Concepts. Silberschatz, Galvin and Gagne

Multiuser Environment Social-oriented Online System: Requirements, Examples, Futures

Java Performance: The Definitive Guide

Running class Timing on Java HotSpot VM, 1

Course introduction. Advanced Compiler Construction Michel Schinz

A developer s guide to load testing

Application Management Webinar. Daniela Field

Designing for Scalability. Patrick Linskey EJB Team Lead BEA Systems

<Insert Picture Here> Get on the Grid. JVM Language Summit Getting Started Guide. Cameron Purdy, VP of Development, Oracle

MRI Internals. Koichi Sasada.

Learning from Bad Examples. CSCI 5828: Foundations of Software Engineering Lecture 25 11/18/2014

EE/CSCI 451: Parallel and Distributed Computation

DNWSH - Version: 2.3..NET Performance and Debugging Workshop

Structure of Programming Languages Lecture 10

IX: A Protected Dataplane Operating System for High Throughput and Low Latency

The Generational Hypothesis

Programmer Directed GC for C++ Michael Spertus N2286= April 16, 2007

Cliff Moon. Bottleneck Whack-A-Mole. Thursday, March 21, 13

NUMA in High-Level Languages. Patrick Siegler Non-Uniform Memory Architectures Hasso-Plattner-Institut

Scalable Streaming Analytics

10/10/ Gribble, Lazowska, Levy, Zahorjan 2. 10/10/ Gribble, Lazowska, Levy, Zahorjan 4

Outline. Threads. Single and Multithreaded Processes. Benefits of Threads. Eike Ritter 1. Modified: October 16, 2012

PyPy - How to not write Virtual Machines for Dynamic Languages

Future of JRockit & Tools

CS558 Programming Languages

What s in a process?

Project Loom Ron Pressler, Alan Bateman June 2018

A JVM Does What? Eva Andreasson Product Manager, Azul Systems

Introduction to Concurrent Software Systems. CSCI 5828: Foundations of Software Engineering Lecture 08 09/17/2015

Threads. Computer Systems. 5/12/2009 cse threads Perkins, DW Johnson and University of Washington 1

OpenACC Course. Office Hour #2 Q&A

IBM s statements regarding its plans, directions, and intent are subject to change or withdrawal without notice at IBM s sole discretion.

STARCOUNTER. Technical Overview

Recitation 10: Malloc Lab

5 Distributed Objects: The Java Approach

Software Speculative Multithreading for Java

Compiler construction 2009

CSC Operating Systems Fall Lecture - II OS Structures. Tevfik Ko!ar. Louisiana State University. August 27 th, 2009.

Announcements. Computer System Organization. Roadmap. Major OS Components. Processes. Tevfik Ko!ar. CSC Operating Systems Fall 2009

Lambda Correctness and Usability Issues

Introduction to Concurrent Software Systems. CSCI 5828: Foundations of Software Engineering Lecture 12 09/29/2016

Shenandoah: Theory and Practice. Christine Flood Roman Kennke Principal Software Engineers Red Hat

Complex, concurrent software. Precision (no false positives) Find real bugs in real executions

Architecture or Parallel Computers CSC / ECE 506

Questions answered in this lecture: CS 537 Lecture 19 Threads and Cooperation. What s in a process? Organizing a Process

CUDA GPGPU Workshop 2012

Scaling Up Performance Benchmarking

IBM Monitoring and Diagnostic Tools for Java TM...

The Z Garbage Collector Low Latency GC for OpenJDK

Multicore OCaml. Stephen Dolan Leo White Anil Madhavapeddy. University of Cambridge. OCaml 2014 September 5, Multicore OCaml

LANGUAGE RUNTIME NON-VOLATILE RAM AWARE SWAPPING

Twitter Heron: Stream Processing at Scale

Microservices Smaller is Better? Eberhard Wolff Freelance consultant & trainer

Modern app programming

CS558 Programming Languages

Attila Szegedi, Software

Rsyslog: going up from 40K messages per second to 250K. Rainer Gerhards

Capriccio: Scalable Threads for Internet Services

Chapter 4: Threads. Chapter 4: Threads. Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues

Java On Steroids: Sun s High-Performance Java Implementation. History

Pause-Less GC for Improving Java Responsiveness. Charlie Gracie IBM Senior Software charliegracie

C# Syllabus. MS.NET Framework Introduction

Transcription:

September 15th, 2016 Finagle + Java A love story ( ) @mnnakamura

hi, I m Moses Nakamura

Twitter lives on the JVM When Twitter realized we couldn t stay on a Rails monolith and continue to scale at the rate we were scaling, we decided to make the leap to the JVM. Since that time, we haven t looked back. The open source community, the runtime, the standard library, the tools, the stability, and the performance have been excellent since our switch.

Scaling an Organization Asynchronous Everything* Performance

Twitter Couldn t Scale ౦ Teams getting in each other s way ౦ Debugging scaling problems ౦ Debugging in general ౦ Low cap for maximum throughput ౦ Meh latency at scale

Half of these were architectural. The other half were runtime.

Architectural Problems

Microservices The problems we got were less bad than what we started with \_( ツ )_/

Teams getting in each other s way ౦ Managing deploys in a monolith ౦ Cross-team mutable state ౦ Cognitive load from fast-moving abstractions

Teams getting in each other s way ౦ Each team controls their own destiny ౦ Your team owns their mutable state ౦ You own your abstractions (except for shared library abstractions) and negotiate APIs with callers and receivers

Debugging scaling problems ౦ Hard to know which team should work on a throughput degradation ౦ Tragedy of the commons ౦ If one team gets capacity, every team gets capacity

Debugging scaling problems ౦ If your service breaks, it s your fault ౦ The buck stops with you ౦ If another team gets capacity, you still don t have extra leeway

Debugging in general ౦ Logs are hard to use ౦ Too many changes per-deploy ౦ Inconsistent tracing ౦ Inconsistent metrics

Debugging in general ౦ Your logs are only for your service ౦ Deploys usually only have a handful of changes, and you understand them all (except for shared libraries) ౦ All services use a shared library so tracing is uniform ౦ All services use a shared library so metrics are uniform

New (but different!!) Problems ౦ Small pockets of weird ౦ Moves work to library owners ౦ Network traffic ౦ Duplicated code ౦ Protocol migration ౦ Security ౦ Reliability

Runtime Problems

JVM Pretty much a strict improvement

Low cap for maximum throughput ౦ Profiling is hard, and not that useful ౦ Synchronous networking model ౦ Single-threaded ౦ Rails is not geared for scale

Low cap for maximum throughput ౦ Great profiling tools ౦ Asynchronous network model (hi netty!) ౦ Multi-threaded ౦ Java has many users who care about throughput

Meh latency at scale ౦ Difficult to parallelize network requests ౦ Ruby s garbage collector wasn t great ౦ Concurrency model not that fine-grained ౦ Lots of magic ౦ Ruby is interpreted

Meh latency at scale ౦ Asynchrony makes it easy to parallelize requests ౦ Rock-solid garbage collectors ౦ Java Memory Model ౦ Less magic* ౦ Java is compiled, and JITted

Type Safety Doesn t really fit in anywhere but it s increasingly useful

Scaling an Organization Asynchronous Everything* Performance

Your Server as a Function* ౦ Futures ౦ Services ౦ Filters

Futures ౦ Similar to CompletableFutures ౦ Represents an asynchronous value ౦ Stack-safe, efficient ౦ Models failures explicitly

Services ౦ Req => Future<Rep> + Closable ౦ Represents an async RPC Req Service Rep

Filters ౦ (Req1, Service<Req2, Rep2>) => Future<Rep1> ౦ Lets us wrap and modify services Req Filter Service Rep

Filters ౦ (Req1, Service<Req2, Rep2>) => Future<Rep1> ౦ Lets us wrap and modify services Req Filter Filter Service Rep

Clients ౦ Services we import off the network ౦ Load balancing ౦ Connection pooling ౦ Naming ౦ Failure Detection

Servers ౦ Services we export to the network ౦ Circuit breakers ౦ Nacking ౦ Draining

Asynchronous Programming ౦ API we expose for concurrent programming ౦ Most engineers do concurrent programming but don t need to learn the JMM ౦ Teach engineers to make data dependencies explicit ౦ Solves many of the problems with synchronous RPC

Asynchronous Programming Perils ౦ Breaks profiling ౦ Stack traces are unreadable ౦ Closures add GC pressure

Cheap Stack Traces ౦ Can be used as a cheap way of doing profiling ౦ We could use it to stitch together a meaningful asynchronous stack trace ౦ Throwing exceptions gets cheaper

Second Class Functions ౦ Many functions don t close over any variables ౦ We don t need a full object if egress is 0

Scaling an Organization Asynchronous Everything* Performance

Performance wins ౦ JIT ౦ GC tuning ౦ Thread affinity ౦ Java.util.concurrent ౦ Jmh ౦ Excellent profilers ౦ Eclipse MAT! ౦ Metrics!

Performance pangs ౦ Garbage collection throughput ౦ Garbage collection tail latency ౦ Asynchronous programming ౦ Network IO ౦ Scala

Finer control over memory management ౦ Choose between stack and heap ౦ Value objects! (JEP 169) ౦ Better tools for understanding memory layout ౦ Better tools for understanding where we re spending time in GC (Twitter JVM helps)

Network IO ౦ Synchronization in stdlib network API ౦ Synchronization in direct buffers ౦ Too coarse control over off-heap memory (eg even off-heap ends up managed by GC)

questions?