SlideShare uma empresa Scribd logo
1 de 21
Baixar para ler offline
© Marcus Denker
Unanticipated Partial
Behavioral Reflection
David Röthlisberger
Marcus Denker
Eric Tanter
© Marcus Denker
Roadmap
> Example
> Behavioral Reflection
— Smalltalk / Metaclasstalk
— Unanticipated Reflection
— Partial Reflection
> Unanticipated Partial Behavioral Reflection
> Example revisited
> Benchmarks
> Conclusion
© Marcus Denker
Running Example
> Typical web application (e.g. Wiki)
> Shows performance problem under high load
> Goals:
— Profile and fix the problem
— No restart / interruption of service
© Marcus Denker
Towards a Solution
> Analyse the problem
— Install profiler
— Analyze
— Retract profiler
> Solve the problem
— Introduce a caching mechanism
— Experiment with multiple solutions
© Marcus Denker
Reflection
> Reflection: computation about computation
— base level / meta level
— causally connected
> Structural Reflection
— Reification of structure
> Behavioral Reflection
— Reification of execution
© Marcus Denker
Unanticipated Reflection
> “Unanticipated Use” means:
— No need to know in advance (and plan for) reflection
— Possible to be done at runtime
> Java: reflection only at load time
— No runtime change in general
— Need to compile in hooks for reflection
> Smalltalk reflection is unanticipated
— taken for granted. But it’s quite cool!
© Marcus Denker
Reflection in Smalltalk
> Structural Reflection
— Classes / Methods are objects
— Can be changed at runtime
> Behavioral Reflection
— No model of execution below method body
— message sending / variable access hard coded by VM
— #doesNotUnderstand / MethodWrappers
> Reflective capabilities of Smalltalk should be improved!
© Marcus Denker
MetaclassTalk
> Extends the Smalltalk metaclass model
> Metaclass defines
— message lookup
— access to instance variables
> Problems:
— Reflection only controllable at class boundaries
— No fine-grained selection (e.g. single operations)
— Protocol between base and meta level is fixed
© Marcus Denker
Partial Reflection
> Hooksets: collection of operation occurrences
> Links
— Bind hooksets to metaobjects
— Define Protocol between base and meta
> Goals
— Highly selective reification
— Flexiblel metalevel engineering
– Protocol specification
– Cross-cutting hooksets
activation
condition
hookset
metaobject
links
© Marcus Denker
Geppetto
> Partial Behavioral Reflection pioneered in Java
— Code transformation at load time
— Not unanticipated (it’s Java...)
> Geppetto: Partial Behavioral Reflection for Smalltalk
> For Squeak 3.9 with ByteSurgeon
— but portable to other dialects
> Let’s see an example!
© Marcus Denker
Solving the Problem
> Operation:
— Method Execution (around)
> Hookset:
— All execution operations in the wiki package
> Metaobject:
— A profiling tool activation
condition
hookset
metaobject
links
© Marcus Denker
Solving the Problem: Hookset + Link
> Hookset
allExecs := Hookset new.
allExecs inPackage: ’Wiki’; operation: MethodEval.
profile := Link id: #profiler
hookset: allExecs
metaobject: Profiler new.
profile control: Control around.
> Link
© Marcus Denker
Solving the Problem: Protocol
profile callDescriptor:
(CallDescriptor
selector: #profileMethod:in:withArguments:
parameters: {Parameter selector.
Parameter self.
Parameter arguments.}
passingMode: PassingMode plain).
> Protocol
> Install / Retract
profile install.
profile uninstall.
© Marcus Denker
Solving the Problem: Caching
> Operation:
— Method Execution (around)
> Hookset:
— The one slow method (#toughWorks:)
> Metaobject:
— A Cache activation
condition
hookset
metaobject
links
© Marcus Denker
Caching II
toughWorks := Hookset new.
toughWorks inClass: Worker; inMethod: #toughWork:;
operation: MethodEval.
> Hookset:
> Link:
cache := Link id: #cache
hookset: toughWorks
metaobject: Cache new.
cache control: Control around.
cache callDescriptor:(CallDescriptor
selector: #cacheFor:
parameters: {Parameter arg1}
passingMode: PassingMode plain).
© Marcus Denker
Geppetto
> Operations:
— MethodEval (like MethodWrappers)
— MsgSend, InstVarAccess, TempAccess
> Control
— Before, After, Around, Replace
> Activation condition per Link
© Marcus Denker
Benchmarks I
> Slowdown for reification of message send
System Slowdown
Geppetto 10.85
Iguana/J 24
Metaclasstalk 20
© Marcus Denker
Benchmarks II
Metaclasstalk
(ms)
Geppetto
(ms)
Speedup
message
send
108 46 2.3x
instance var
read
272 92 2.9x
> Geppetto Vs. Metaclasstalk
© Marcus Denker
Future Work
> Pluggable backends
— Bytecode
— AST based transformation
— VM Support
> Use for typical ByteSurgeon based projects
— e.g. Tracing, Unstuck-Debugger
> Experiment with advanced Scoping
© Marcus Denker
Conclusion
> Example for the need of Partial Behavioral Reflection
> Overview of Geppetto
> Solution of the Example
> Benchmarks
© Marcus Denker
Conclusion
> Example for the need of Partial Behavioral Reflection
> Overview of Geppetto
> Solution of the Example
> Benchmarks
Questions?

Mais conteúdo relacionado

Mais procurados

Lcj pg sql-lt-kaigai
Lcj pg sql-lt-kaigaiLcj pg sql-lt-kaigai
Lcj pg sql-lt-kaigai
Kohei KaiGai
 

Mais procurados (9)

Replication in the Wild - Warsaw Cloud Native Meetup - May 2017
Replication in the Wild - Warsaw Cloud Native Meetup - May 2017Replication in the Wild - Warsaw Cloud Native Meetup - May 2017
Replication in the Wild - Warsaw Cloud Native Meetup - May 2017
 
DOTNET 2013 IEEE CLOUDCOMPUTING PROJECT Error tolerant resource allocation an...
DOTNET 2013 IEEE CLOUDCOMPUTING PROJECT Error tolerant resource allocation an...DOTNET 2013 IEEE CLOUDCOMPUTING PROJECT Error tolerant resource allocation an...
DOTNET 2013 IEEE CLOUDCOMPUTING PROJECT Error tolerant resource allocation an...
 
Error tolerant resource allocation and payment minimization for cloud system
Error tolerant resource allocation and payment minimization for cloud systemError tolerant resource allocation and payment minimization for cloud system
Error tolerant resource allocation and payment minimization for cloud system
 
Error tolerant resource allocation and payment minimization for cloud system
Error tolerant resource allocation and payment minimization for cloud systemError tolerant resource allocation and payment minimization for cloud system
Error tolerant resource allocation and payment minimization for cloud system
 
SQL Server Query execution. Why my query is slow?
SQL Server Query execution. Why my query is slow?SQL Server Query execution. Why my query is slow?
SQL Server Query execution. Why my query is slow?
 
Lcj pg sql-lt-kaigai
Lcj pg sql-lt-kaigaiLcj pg sql-lt-kaigai
Lcj pg sql-lt-kaigai
 
Distributed Systems Theory for Mere Mortals - GeeCON Krakow May 2017
Distributed Systems Theory for Mere Mortals -  GeeCON Krakow May 2017Distributed Systems Theory for Mere Mortals -  GeeCON Krakow May 2017
Distributed Systems Theory for Mere Mortals - GeeCON Krakow May 2017
 
Distributed Systems Theory for Mere Mortals - Java Day Istanbul May 2017
Distributed Systems Theory for Mere Mortals - Java Day Istanbul May 2017 Distributed Systems Theory for Mere Mortals - Java Day Istanbul May 2017
Distributed Systems Theory for Mere Mortals - Java Day Istanbul May 2017
 
Client-centric Consistency Models
Client-centric Consistency ModelsClient-centric Consistency Models
Client-centric Consistency Models
 

Destaque (6)

VA Smalltalk Going Forward
VA Smalltalk Going ForwardVA Smalltalk Going Forward
VA Smalltalk Going Forward
 
Xtreams
XtreamsXtreams
Xtreams
 
A Glimpse at Pomodoro
A Glimpse at PomodoroA Glimpse at Pomodoro
A Glimpse at Pomodoro
 
LOOP
LOOPLOOP
LOOP
 
Change-Oriented Software Engineering
Change-Oriented Software EngineeringChange-Oriented Software Engineering
Change-Oriented Software Engineering
 
Slaps - a Smalltalk LDAP server
Slaps - a Smalltalk LDAP serverSlaps - a Smalltalk LDAP server
Slaps - a Smalltalk LDAP server
 

Semelhante a Unanticipated Partial Behavioral Reflection

Building an OpenMRS Distribution - Lessons from KenyaEMR
Building an OpenMRS Distribution - Lessons from KenyaEMRBuilding an OpenMRS Distribution - Lessons from KenyaEMR
Building an OpenMRS Distribution - Lessons from KenyaEMR
rowanseymour
 

Semelhante a Unanticipated Partial Behavioral Reflection (20)

Reflection
ReflectionReflection
Reflection
 
Lecture: Reflection
Lecture: ReflectionLecture: Reflection
Lecture: Reflection
 
Reflection and Context
Reflection and ContextReflection and Context
Reflection and Context
 
Lecture: Reflection
Lecture: ReflectionLecture: Reflection
Lecture: Reflection
 
Refactoring
RefactoringRefactoring
Refactoring
 
Sub-Method Reflection
Sub-Method ReflectionSub-Method Reflection
Sub-Method Reflection
 
Sub-method Structural and Behavioral Reflection
Sub-method Structural and Behavioral ReflectionSub-method Structural and Behavioral Reflection
Sub-method Structural and Behavioral Reflection
 
Presentation about my Research
Presentation about my ResearchPresentation about my Research
Presentation about my Research
 
Software Evolution from the Field: an Experience Report
Software Evolution from the Field: an Experience ReportSoftware Evolution from the Field: an Experience Report
Software Evolution from the Field: an Experience Report
 
Behavioral Reflection
Behavioral ReflectionBehavioral Reflection
Behavioral Reflection
 
The Reflectivity
The ReflectivityThe Reflectivity
The Reflectivity
 
05 seaside
05 seaside05 seaside
05 seaside
 
What You Should Know About WebLogic Server 12c (12.2.1.2) #oow2015 #otntour2...
What You Should Know About WebLogic Server 12c (12.2.1.2)  #oow2015 #otntour2...What You Should Know About WebLogic Server 12c (12.2.1.2)  #oow2015 #otntour2...
What You Should Know About WebLogic Server 12c (12.2.1.2) #oow2015 #otntour2...
 
DDD, CQRS and testing with ASP.Net MVC
DDD, CQRS and testing with ASP.Net MVCDDD, CQRS and testing with ASP.Net MVC
DDD, CQRS and testing with ASP.Net MVC
 
Command Design Pattern
Command Design PatternCommand Design Pattern
Command Design Pattern
 
Container orchestration from theory to practice
Container orchestration from theory to practiceContainer orchestration from theory to practice
Container orchestration from theory to practice
 
Apache Cassandra Lunch #41: Cassandra on Kubernetes - Docker/Kubernetes/Helm ...
Apache Cassandra Lunch #41: Cassandra on Kubernetes - Docker/Kubernetes/Helm ...Apache Cassandra Lunch #41: Cassandra on Kubernetes - Docker/Kubernetes/Helm ...
Apache Cassandra Lunch #41: Cassandra on Kubernetes - Docker/Kubernetes/Helm ...
 
Crafted Design - GeeCON 2014
Crafted Design - GeeCON 2014Crafted Design - GeeCON 2014
Crafted Design - GeeCON 2014
 
Talk: Practical, Pluggable Types
Talk: Practical, Pluggable TypesTalk: Practical, Pluggable Types
Talk: Practical, Pluggable Types
 
Building an OpenMRS Distribution - Lessons from KenyaEMR
Building an OpenMRS Distribution - Lessons from KenyaEMRBuilding an OpenMRS Distribution - Lessons from KenyaEMR
Building an OpenMRS Distribution - Lessons from KenyaEMR
 

Mais de ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
ESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
ESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
ESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
ESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
ESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
ESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
ESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
ESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
ESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
ESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
ESUG
 

Mais de ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 

Unanticipated Partial Behavioral Reflection

  • 1. © Marcus Denker Unanticipated Partial Behavioral Reflection David Röthlisberger Marcus Denker Eric Tanter
  • 2. © Marcus Denker Roadmap > Example > Behavioral Reflection — Smalltalk / Metaclasstalk — Unanticipated Reflection — Partial Reflection > Unanticipated Partial Behavioral Reflection > Example revisited > Benchmarks > Conclusion
  • 3. © Marcus Denker Running Example > Typical web application (e.g. Wiki) > Shows performance problem under high load > Goals: — Profile and fix the problem — No restart / interruption of service
  • 4. © Marcus Denker Towards a Solution > Analyse the problem — Install profiler — Analyze — Retract profiler > Solve the problem — Introduce a caching mechanism — Experiment with multiple solutions
  • 5. © Marcus Denker Reflection > Reflection: computation about computation — base level / meta level — causally connected > Structural Reflection — Reification of structure > Behavioral Reflection — Reification of execution
  • 6. © Marcus Denker Unanticipated Reflection > “Unanticipated Use” means: — No need to know in advance (and plan for) reflection — Possible to be done at runtime > Java: reflection only at load time — No runtime change in general — Need to compile in hooks for reflection > Smalltalk reflection is unanticipated — taken for granted. But it’s quite cool!
  • 7. © Marcus Denker Reflection in Smalltalk > Structural Reflection — Classes / Methods are objects — Can be changed at runtime > Behavioral Reflection — No model of execution below method body — message sending / variable access hard coded by VM — #doesNotUnderstand / MethodWrappers > Reflective capabilities of Smalltalk should be improved!
  • 8. © Marcus Denker MetaclassTalk > Extends the Smalltalk metaclass model > Metaclass defines — message lookup — access to instance variables > Problems: — Reflection only controllable at class boundaries — No fine-grained selection (e.g. single operations) — Protocol between base and meta level is fixed
  • 9. © Marcus Denker Partial Reflection > Hooksets: collection of operation occurrences > Links — Bind hooksets to metaobjects — Define Protocol between base and meta > Goals — Highly selective reification — Flexiblel metalevel engineering – Protocol specification – Cross-cutting hooksets activation condition hookset metaobject links
  • 10. © Marcus Denker Geppetto > Partial Behavioral Reflection pioneered in Java — Code transformation at load time — Not unanticipated (it’s Java...) > Geppetto: Partial Behavioral Reflection for Smalltalk > For Squeak 3.9 with ByteSurgeon — but portable to other dialects > Let’s see an example!
  • 11. © Marcus Denker Solving the Problem > Operation: — Method Execution (around) > Hookset: — All execution operations in the wiki package > Metaobject: — A profiling tool activation condition hookset metaobject links
  • 12. © Marcus Denker Solving the Problem: Hookset + Link > Hookset allExecs := Hookset new. allExecs inPackage: ’Wiki’; operation: MethodEval. profile := Link id: #profiler hookset: allExecs metaobject: Profiler new. profile control: Control around. > Link
  • 13. © Marcus Denker Solving the Problem: Protocol profile callDescriptor: (CallDescriptor selector: #profileMethod:in:withArguments: parameters: {Parameter selector. Parameter self. Parameter arguments.} passingMode: PassingMode plain). > Protocol > Install / Retract profile install. profile uninstall.
  • 14. © Marcus Denker Solving the Problem: Caching > Operation: — Method Execution (around) > Hookset: — The one slow method (#toughWorks:) > Metaobject: — A Cache activation condition hookset metaobject links
  • 15. © Marcus Denker Caching II toughWorks := Hookset new. toughWorks inClass: Worker; inMethod: #toughWork:; operation: MethodEval. > Hookset: > Link: cache := Link id: #cache hookset: toughWorks metaobject: Cache new. cache control: Control around. cache callDescriptor:(CallDescriptor selector: #cacheFor: parameters: {Parameter arg1} passingMode: PassingMode plain).
  • 16. © Marcus Denker Geppetto > Operations: — MethodEval (like MethodWrappers) — MsgSend, InstVarAccess, TempAccess > Control — Before, After, Around, Replace > Activation condition per Link
  • 17. © Marcus Denker Benchmarks I > Slowdown for reification of message send System Slowdown Geppetto 10.85 Iguana/J 24 Metaclasstalk 20
  • 18. © Marcus Denker Benchmarks II Metaclasstalk (ms) Geppetto (ms) Speedup message send 108 46 2.3x instance var read 272 92 2.9x > Geppetto Vs. Metaclasstalk
  • 19. © Marcus Denker Future Work > Pluggable backends — Bytecode — AST based transformation — VM Support > Use for typical ByteSurgeon based projects — e.g. Tracing, Unstuck-Debugger > Experiment with advanced Scoping
  • 20. © Marcus Denker Conclusion > Example for the need of Partial Behavioral Reflection > Overview of Geppetto > Solution of the Example > Benchmarks
  • 21. © Marcus Denker Conclusion > Example for the need of Partial Behavioral Reflection > Overview of Geppetto > Solution of the Example > Benchmarks Questions?