Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud...

22
Cloud Language Runtimes on IA - Challenges & Opportunities Suresh Srinivas Principal Engineer, Intel [email protected] @ssuresh Contributors: Uttam, Dunni, Ahmad, Pranitha, Florin, Sushma, Catalin, Vish

Transcript of Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud...

Page 1: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

Cloud Language Runtimes on IA -Challenges & Opportunities

Suresh SrinivasPrincipal Engineer, Intel

[email protected]

@ssuresh

Contributors:

Uttam, Dunni, Ahmad, Pranitha, Florin, Sushma, Catalin, Vish

Page 2: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

AgendaCloud Runtime Usage & Introduction

Cloud Runtime Challenges/Problems

Software/Hardware Optimization

Next Steps/Open Problems/Call To Action

Page 3: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

Cloud RuntimesUsage/Introduction

Title: Luna at Pittock MansionAuthor: Suresh Srinivas

License: Creative CommonsSource: @sweetlunatheyellowlab on Instagram

Page 4: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

Cloud Runtime: Usages/Language

Multiple Environments

IaaS->PaaS->FaaS

Languages

4 of top 5 are Runtimes

3 are dynamically typed.

Usages

Function As Service

WebTier

Analytics Node.js Node.js

*Other names and brands may be claimed as the property of others.

*

*

4https://octoverse.github.com/projects#languages

Page 5: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

Cloud Runtime: Web Tier Scale Out Usage

5

Each server running a Web Server Individual server can run at high

utilization (> 90%) Each server also running Cloud

Runtime Scale Out Example: Cluster of Dense

Computing Platform with Yosemite v2 (Four 1S servers)

PHP, Python, Node.js … Very different from SPEC

benchmarks (Large Scattered Code, JITting, Type Checks, …)

Customer Data Center

Page 6: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

Cloud RuntimesChallenges/Problems

Title: Luna at Cannon BeachAuthor: Suresh Srinivas

License: Creative CommonsSource: @sweetlunatheyellowlab on Instagram

Page 7: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

High CPU bottlenecks ~35-45% stalled I-Cache Misses

I-TLB Misses

Branch Mispredicts

Problem gets worse for bigger function

FaaS JavaScript: Challenges

Anagram Ghost.js

51% retiring 34% retiring

1.18% I-TLB misses 6% I-TLB Misses

1.25% I-$ misses 10% I-$ Misses

26%

9%14%

51%

Alexa* Anagram

Frontend(%) Bad_Speculation(%) Backend(%) Retiring(%)

33%

11%22%

34%

Ghost.js*

*Other names and brands may be claimed as the property of others. 7

FrontEnd

FrontEnd

Branch

Page 8: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

Problem gets worse Bigger Functions

When multiple functions executing concurrently

Frontend Stalls increase from 33% to 41%

Cycles/work much higher

FaaS JavaScript: Characteristis & Challenges

*Other names and brands may be claimed as the property of others.

33%

11%22%

34%

Ghost.js*

Frontend(%) Bad_Speculation(%) Backend(%) Retiring(%)

41%

11%15%

33%

Ghost.js Multi

8

FrontEnd

Branch

FrontEnd

Branch

Page 9: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

WebTier: Characteristics & Challenges

9

Runtime with High CPU bottlenecks

Front End Bottlenecks: I-Cache

Misses, I-TLB Misses

Interpreters with high Branch

Mispredicts

Accounting for 50% of Stalls

Long Pathlength

• 10s of millions of instructions executed per request

5043 41

3341

3625

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

Cloud Runtime Workloads

Frontend_Bound BadSpeculation BackendBound Retiring

*Other names and brands may be claimed as the property of others.

Page 10: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

Cloud RuntimesHardware & Software Optimization

Title: Luna on bed of flowersAuthor: Suresh Srinivas

License: Creative CommonsSource: @sweetlunatheyellowlab on Instagram

Page 11: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

Cloud Runtime: Hardware

Hardware Improvements

• 17% Improvement in Retirement

• 2M Code Pages in shared 2nd level structure

• Larger L2 helps with I$ Misses

40% L2 miss reduction

25% Frontend Improvement

*Other names and brands may be claimed as the property of others.

MediaWikiBDX-D

MediaWikiSKX-D

Topdown Frontend bound (%)

43 32

Topdown Retiring (%) 35 41

metric_L2 misses per txn (includes code+data+rfo w/ prefetches)

1,139,373 674,635

RPS 1.0 1.40

Cores 16 18

Package Power70W 85W

Page 12: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

Reduce I-TLB misses and cycles by using large pages for code

Remap a subset of .text segment to 2M pages

Relies on THP through madvise

Reduce 4K walks and Reduce cycles

30% Reduction in 4K Walks

Benefits longer running workloads Ghost.js*: 5%, WebTooling: 3%

Cloud Runtime: Software

Using 2M Pages reduces I-TLB misses 20-30% & improves

perf 3-5%

0.8

1.9

0.70.7

1.3

0.7

WALK_COMPLETED WALK_COMPLETED_2M_4M WALK_COMPLETED_4K

Effect on I-TLB Misses

webtooling ghost.js

*Other names and brands may be claimed as the property of others. 12

Page 13: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

Reduce I-Cache Misses through Code Layout Optimization Intel CPUs have a feature called last branch records (LBR) where the CPU can continuously

log branches to a set of model-specific registers (MSRs).

Profile guided reordering of the static code in .text reduces L1-I, L2, LLC Code Misses.

5-7% Performance improvement

Combining Optimization:

1.05

1.10

Large Pages Large Pages + Code Layout

Ghost.js*

Cloud Runtime: Software

*Other names and brands may be claimed as the property of others. 13

1.28

1.31

1.29

metric_L1I code read misses(includes prefetches) per txn

metric_L2 demand codemisses per txn

metric_LLC code referencesper txn (L3 prefetch excluded)

Code Layout I$-Miss Improvement

Page 14: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

Cloud RuntimesNext Steps, Open ProblemsCall to Action

Page 15: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

Intel Focus:

Continue to optimize Cloud Runtimes

Collaborate to address Runtime Bottlenecks

Enhance our Products

Develop runtime performance optimization

blue print(s)

Next Steps

15

Software

2M Pages.Code Layout

HardwareXeon Scalable (Skylake & Beyond)

Page 16: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

• Address Frontend problems (I$, I-TLB) in JITs

• Better locality of Native & JIT code

• Better use of SIMD & u-architecture

• Sharing dynamic code across JIT instances

• HW/SW Communication• SW Controlled Instruction Fetch• SW Control for Indirect Branches

Open Problems

16

Page 17: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

Call to Action

• Diagnose uarch bottlenecks• Apply known solutions• Collaborate on Open Problems

• Contact me [email protected]

African Proverb: If you want to go fast, go alone. If you want to go far, go together.

Title: Going Far in Forest ParkAuthor: Suresh Srinivas

License: Creative CommonsSource: @sweetlunatheyellowlab on Instagram

*Other names and brands may be claimed as the property of others. 17

Collaborate to Solve these Cloud Runtime problems on Intel Architecture

Page 18: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

Q&A

18

https://youtu.be/a3e3JBRX1FI

Page 19: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

Disclaimers

No license (express or implied, by estoppel or otherwise) to any intellectual property rights is granted by this document.

Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade.

This document contains information on products, services and/or processes in development. All information provided here is subject to change without notice. Contact your Intel representative to obtain the latest forecast, schedule, specifications and roadmaps.

The products and services described may contain defects or errors known as errata which may cause deviations from published specifications. Current characterized errata are available on request. No product or component can be absolutely secure.

Copies of documents which have an order number and are referenced in this document may be obtained by calling 1-800-548-4725 or by visiting www.intel.com/design/literature.htm

Intel, the Intel logo, Intel Atom, Intel Optane, and Intel Xeon are trademarks of Intel Corporation or its subsidiaries in the U.S. and/or other countries.

*Other names and brands may be claimed as the property of others.

© Intel Corporation.

19

Page 20: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

Cloud Runtime: FaaS

Evolution

IaaS->PaaS->FaaS

FaaS business model vs. IaaS business model

Pay for Useful Work (Duration of Execution)

No effort for server management

Autoscaling & CSP determines platform for execution

Function

From 5 lines to multiple megabytes

Triggered from an event source

JavaScript* (with Node.js*) and Python* are leading FaaS languages 63%21%

6%

6%4%

68%27%

3%1%

1%Node

Python

Java

Go

.NETNode.js Node.js

Ep

sa

go

n*

AW

S

Se

rve

rless

.co

m*

*Other names and brands may be claimed as the property of others.

*

*

20

Page 21: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

JavaScript* on Server

libuvV8 JavaScript Engine

C/C++ AddOnsNode.js Bindings

Node.js APIs

Function API’s/Libraries (eg alexa-sdk, …)

Function

Node.js* is a JavaScript Server runtime built

on top of the Chrome* v8 JavaScript engine

FaaS Function built with Function

APIs/Libraries (eg. Alexa-sdk, others)

FaaS Alexa* Anagram Skillhttps://github.com/evanchiu/alexa-anagramNode.js* Stack

const Alexa = require('alexa-sdk');const anagrams = require('./anagrams');var handlers = {

getAnagrams: function() {… }, …};

export.handler = function (event, c, l) {var alexa = Alexa.handler(event, c, l);alexa.registerHandlers(handlers);alexa.execute();

}

*Other names and brands may be claimed as the property of others. 21

Page 22: Cloud Language Runtimes on IA - Challenges & … › cloudruntimes › slides › suresh.pdfCloud Runtime: Usages/Language Multiple Environments IaaS->PaaS->FaaS Languages 4 of top

• Runtimes need high performance primitives Memory & String Operations (memcpy, memchr, …)

Compression

IA Encoder/Decoder

Several rely on system (glibc: In 2019 people are still using glibc 2.17 from 2014)

Runtimes need tooling and common infrastructure LBR Samples decorated to IR

Processor-Trace -> JIT

Runtimes Libraries don’t expose optimized native JavaScript/PHP dont expose IA optimized libs

Common Runtime Challenges

22