Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

17
Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

Transcript of Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

Page 1: Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

Determina, Inc.

Persisting Information Across Application Executions

Derek BrueningDetermina, Inc.

Page 2: Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

2Determina, Inc.

Dynamic vs. Static Program Analysis

• Dynamic analysis has advantages:– Access to entire app: libraries, generated code– Visibility on exact use cases (data used and

control flow followed)– Applicable to any binary

• But…costly to do– Analysis cost is part of the runtime of the app– Analysis is applied every time the app is run

Page 3: Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

3Determina, Inc.

Analysis Challenges

• Monitoring values of application variables is performance-intensive– Transparent instrumentation expensive on x86– May need to monitor more than just function

parameters

• Difficult to obtain enough data from short-lived applications

Page 4: Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

4Determina, Inc.

Solution: Persistent Data

• Store results from prior application executions on disk

• Instrument different part of application in each run to keep costs down

• Combine results of each new run with stored data

• Once have enough data for analysis, send to central server

Page 5: Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

5Determina, Inc.

Common Persistence Infrastructure

• Underlying execution engine can also benefit from persistence

• Can share the same validation and consistency models to ensure persisted state corresponds to current application code and behavior

Page 6: Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

6Determina, Inc.

Managed Program Execution Engine

• Manipulate, at runtime, every instruction an arbitrary application executes, with:– Minimal performance penalty– Full transparency

• Exports interface for building custom tools

• No modifications to the hardware, operating system, or application

• Foundation of Determina Memory Firewall

Page 7: Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

7Determina, Inc.

executable

Native Execution

library A library B

hardware platform

APPLICATION

Page 8: Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

8Determina, Inc.

Execute From Code Cache

hardware platform

code cache

EXECUTION ENGINE

executable library A library B

APPLICATION

Page 9: Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

9Determina, Inc.

basic block builder trace selectorSTART

dispatch

context switch

BASIC BLOCK CACHE

TRACE CACHE

non-control-flow instructions

non-control-flow instructions

indirect branch lookup

indirect branch stays on trace?

Managed Program Execution Engine

Page 10: Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

10Determina, Inc.

Non-Amortized Overhead

• In steady-state, overhead is amortized• Overhead does show up in non-steady-state:

– Application start-up– Short-lived applications– Extensive new code execution

• Not an issue on servers (long-running apps)• A major issue on desktops

– Startup time is directly visible and perceived as a slowdown

Page 11: Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

11Determina, Inc.

Traces

• Combine frequently executed sequences of basic blocks into traces– Superior code layout– Eliminate indirect branches

• Traces provide ~10% performance boost on longer-running applications

• Will they help startup performance, with its once-executed code?

Page 12: Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

12Determina, Inc.

Solution: Persistent Code Cache

• Goals:– Improve start-up performance– Support process-shared code caches

• Challenges:– Re-design data structures to support persistence– Efficiently validate persisted files– Safely allow persistent file updates

Page 13: Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

13Determina, Inc.

Prototype Implementation

• Supports both no-traces mode and trace building mode

• Persists at end of run to application-specific files, loaded in for the next run

• Does not support relocation

• Validates only the module base

Page 14: Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

14Determina, Inc.

Per-Module Caches

hardware platform

cache exe cache libA cache libB

EXECUTION ENGINE

executable library A library B

APPLICATION

Page 15: Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

15Determina, Inc.

Persistent Caches

hardware platform

cache exe cache libA cache libB

EXECUTION ENGINE

executable library A library B

APPLICATION

cache exe

cache libA

cache libB

PERSISTED CACHES

Page 16: Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

16Determina, Inc.

Persistent Caches

hardware platform

cache exe cache libA cache libB

executable library A library B

APPLICATION

cache exe

cache libA

cache libB

PERSISTED CACHES

EXECUTION ENGINE

Page 17: Determina, Inc. Persisting Information Across Application Executions Derek Bruening Determina, Inc.

17Determina, Inc.

Summary

• Persisting information across application executions has many advantages– Reduce overhead– Enable inter-process sharing– Enable accumulation of data from multiple runs

for broader view of application with less instrumentation or in presence of varying workloads

• Many challenges remain