Afluentes - Concurrent I/O Made Easy with Lazy Evaluation
-
Upload
saulo-araujo -
Category
Software
-
view
91 -
download
1
Transcript of Afluentes - Concurrent I/O Made Easy with Lazy Evaluation
![Page 1: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/1.jpg)
CIn.ufpe.br
AfluentesConcurrent I/O Made Easy With Lazy Evaluation
Saulo Medeiros de Araujo
![Page 2: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/2.jpg)
CIn.ufpe.br
A Little Bit About Me
• I have been working in the Brazilian software industry for almost 20
years now
• I cofounded a startup (1999-2004)
• I worked in medium and large sized companies (2004-2006)
• Currently, I am working at the Brazilian Central Bank (2006-Present)
• I have been acting mainly as a software architect for object-oriented
web applications backed by relational databases
• This experience is the starting point of the Afluentes framework
![Page 3: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/3.jpg)
CIn.ufpe.br
Context
• Many systems are I/O intensive
• Several I/O intensive systems exhibit few dependencies among data transfer and processing tasks
• The performance of these systems may be significantly improved by requesting I/O operations concurrently
• This is because these operations will be performed in parallel, if the necessary resources are available
• Despite this huge potential, most systems request I/O operations sequentially
![Page 4: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/4.jpg)
CIn.ufpe.br
![Page 5: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/5.jpg)
CIn.ufpe.br
Context
• Mainstream mechanisms for concurrent I/O make programming harder
• Synchronous I/O primitives with multithreaded programming– Race conditions
– Deadlocks
– Scalability issues
• Asynchronous I/O primitives– Callback hell
– Pyramid of doom
![Page 6: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/6.jpg)
CIn.ufpe.br
Calculating b2-4ac with Synchronous Methods
![Page 7: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/7.jpg)
CIn.ufpe.br
![Page 8: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/8.jpg)
CIn.ufpe.br
Asynchronous Methods and Callbacks Issues
• More lines of code
• The programmer has to manually coordinate the execution of asynchronous methods manually
• Callbacks should be just a mechanism for asynchronous methods deliver their executions results
• In the absence of further programming language support, programmers end up using callbacks to manage communication and synchronization among different execution contexts
• This is how things become nasty
![Page 9: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/9.jpg)
CIn.ufpe.br
Synchronous and Asynchronous Methods
• Synchronous Methods– Deliver their results through return values
– Easily composed
– The runtime system coordinates their executions
– Are sequentially executed
• Asynchronous methods– Deliver their results through callbacks
– Composing them is hard
– The programmer has to manually coordinate their executions
– Are concurrently executed
• Is it possible to combine the advantages of synchronous and asynchronous methods?
![Page 10: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/10.jpg)
CIn.ufpe.br
![Page 11: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/11.jpg)
CIn.ufpe.br
The Afluentes Framework Strategy
AsynchronousMethods
SynchronousMethods
Evaluators
Adapters
Adapters
![Page 12: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/12.jpg)
CIn.ufpe.br
Evaluators
• Evaluators are synchronous methods, therefore, composing them is
easy
• They receive evaluations as parameters
• They produce evaluations as results
![Page 13: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/13.jpg)
CIn.ufpe.br
(Lazy) Evaluations
• Evaluations are objects built by evaluators
• They encapsulate
– A method to be invoked
– The parameters (other evaluations) with witch this method must be invoked
• When executed, an evaluator composition builds an evaluation tree
![Page 14: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/14.jpg)
CIn.ufpe.br
![Page 15: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/15.jpg)
CIn.ufpe.br
Problem in the Paradise
• Methods are not first class citzens in Java
• They cannot be stored in attributes, passed as parameters, etc.
• This is a necessary condition for implementing evaluations
![Page 16: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/16.jpg)
CIn.ufpe.br
The Afluentes Framework Strategy
• The Afluentes framework represents methods, both
synchronous and asynchronous, and callbacks through objects
that implement specific interfaces
![Page 17: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/17.jpg)
CIn.ufpe.br
Synchronous Functions
![Page 18: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/18.jpg)
CIn.ufpe.br
Calculating b2-4ac with Synchronous Functions
![Page 19: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/19.jpg)
CIn.ufpe.br
Asynchronous Functions
![Page 20: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/20.jpg)
CIn.ufpe.br
Callbacks
![Page 21: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/21.jpg)
CIn.ufpe.br
![Page 22: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/22.jpg)
CIn.ufpe.br
Experimental Evaluation
• Java web application that allows its users to exchange messages
– Sort of e-mail
• Persists objects in a relational database (MySQL)
• Interacts with this database through an object-relational mapper
(Hibernate)
![Page 23: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/23.jpg)
CIn.ufpe.br
Concurrent I/O Opportunities
![Page 24: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/24.jpg)
CIn.ufpe.br
Introducing the Afluentes Framework
![Page 25: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/25.jpg)
CIn.ufpe.br
Evaluation Results
![Page 26: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/26.jpg)
CIn.ufpe.br
What We Are Cooking
![Page 27: Afluentes - Concurrent I/O Made Easy with Lazy Evaluation](https://reader033.fdocuments.in/reader033/viewer/2022052909/5597a27d1a28abce218b466f/html5/thumbnails/27.jpg)
CIn.ufpe.br
Thanks!
github.com/afluentes