This document summarizes Marcelo Pinheiro's keynote presentation on Celluloid, an actor model library for Ruby. Celluloid allows Ruby programs to take advantage of concurrency through an actor-based approach inspired by Erlang. It provides features like automatic synchronization, fault tolerance through supervisors and supervision groups, linking of actors, futures for lazy computation, and actor pools. The presentation covered the basics of the actor model, how Celluloid implements it in Ruby, and examples of using key Celluloid features.
A introduction about main functionalities of Celluloid, a Ruby Actor Model implementation, and some of famous libraries that uses it - Celluloid::IO, DCell and Reel.
KCDC 2018 - Rapid API Development with SailsJustin James
Creating a RESTful API should be the easiest part of your development. You should not have to be a rocket scientist to successfully create a RESTful API. With Sails, you can create a full featured RESTful API in just a few minutes without writing any code. You get create, destroy, update, find, paginate, sort, and filtering out of the box. If you need to add your business logic to any of the methods or create your own methods, you can do that by writing simple JavaScript functions. Once you are ready to implement security, Sails provides policies that can be applied to any REST action to implement email/password, social login or Windows authentication. For data storage, Sails bundles the power ORM, Waterline, which provides a simple data access layer that just works, no matter which one of the more than 30 data storage providers you are using.
This talk will be code heavy as we walk through getting started with Sails and demonstrate how to implement the features of Sails through the creation of an API. As well, I will share the tips and tricks that I have learned using Sails at a Fortune 100 company. You will walk away understanding how and why you should use Sails on your next project. All code covered in the talk with be immediately available for download.
JavaScript - Like a Box of Chocolates - jsDayRobert Nyman
This presentation aims to give you information about the JavaScript language itself; pros, cons and pitfalls. It will cover the basics and then go into objects, scope, closure and some performance bits.
В рамках магистерского курса "Параллельные вычисления" на кафедре КСПТ прочитал лекцию "Actor Model":
* Actor Model
* Futures and Promises
* Примеры систем
FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...Haris Mahmood
As front-end developers become more and more capable of building web applications, the value of testing front-end code is now more valuable than ever. Unfortunately, the testing ecosystem can be confusing, and daunting to those just getting started with the vast number of libraries and testing frameworks offering various tools and capabilities.
This talk aims to navigate the world of testing front-end code, and provide steps for front-end developers to incorporate testing into their work and projects quickly and with ease!
An Introduction to the World of Testing for Front-End DevelopersFITC
Presented at Web Unleashed 2017. More info at www.fitc.ca/webu
Presented by Haris Mahmood, Shopify
Overview
As front-end developers become more and more capable of building web applications, the value of testing front-end code is now more valuable than ever. Unfortunately, the testing ecosystem can be confusing, and daunting to those just getting started with the vast number of libraries and testing frameworks offering various tools and capabilities.
This talk aims to navigate the world of testing front-end code, and provide steps for front-end developers to incorporate testing into their work and projects quickly and with ease!
Objective
Provide an introduction and overview of the world of testing for front-end development, and tips and steps to get started today.
Target Audience
Front-end developers with no or little experience with testing.
Five Things Audience Members Will Learn
Understanding on why testing is important
What options exist for testing today
What type of tests are best for what scenario
How to assess what frameworks and libraries to use
Steps on getting started with testing
A introduction about main functionalities of Celluloid, a Ruby Actor Model implementation, and some of famous libraries that uses it - Celluloid::IO, DCell and Reel.
KCDC 2018 - Rapid API Development with SailsJustin James
Creating a RESTful API should be the easiest part of your development. You should not have to be a rocket scientist to successfully create a RESTful API. With Sails, you can create a full featured RESTful API in just a few minutes without writing any code. You get create, destroy, update, find, paginate, sort, and filtering out of the box. If you need to add your business logic to any of the methods or create your own methods, you can do that by writing simple JavaScript functions. Once you are ready to implement security, Sails provides policies that can be applied to any REST action to implement email/password, social login or Windows authentication. For data storage, Sails bundles the power ORM, Waterline, which provides a simple data access layer that just works, no matter which one of the more than 30 data storage providers you are using.
This talk will be code heavy as we walk through getting started with Sails and demonstrate how to implement the features of Sails through the creation of an API. As well, I will share the tips and tricks that I have learned using Sails at a Fortune 100 company. You will walk away understanding how and why you should use Sails on your next project. All code covered in the talk with be immediately available for download.
JavaScript - Like a Box of Chocolates - jsDayRobert Nyman
This presentation aims to give you information about the JavaScript language itself; pros, cons and pitfalls. It will cover the basics and then go into objects, scope, closure and some performance bits.
В рамках магистерского курса "Параллельные вычисления" на кафедре КСПТ прочитал лекцию "Actor Model":
* Actor Model
* Futures and Promises
* Примеры систем
FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...Haris Mahmood
As front-end developers become more and more capable of building web applications, the value of testing front-end code is now more valuable than ever. Unfortunately, the testing ecosystem can be confusing, and daunting to those just getting started with the vast number of libraries and testing frameworks offering various tools and capabilities.
This talk aims to navigate the world of testing front-end code, and provide steps for front-end developers to incorporate testing into their work and projects quickly and with ease!
An Introduction to the World of Testing for Front-End DevelopersFITC
Presented at Web Unleashed 2017. More info at www.fitc.ca/webu
Presented by Haris Mahmood, Shopify
Overview
As front-end developers become more and more capable of building web applications, the value of testing front-end code is now more valuable than ever. Unfortunately, the testing ecosystem can be confusing, and daunting to those just getting started with the vast number of libraries and testing frameworks offering various tools and capabilities.
This talk aims to navigate the world of testing front-end code, and provide steps for front-end developers to incorporate testing into their work and projects quickly and with ease!
Objective
Provide an introduction and overview of the world of testing for front-end development, and tips and steps to get started today.
Target Audience
Front-end developers with no or little experience with testing.
Five Things Audience Members Will Learn
Understanding on why testing is important
What options exist for testing today
What type of tests are best for what scenario
How to assess what frameworks and libraries to use
Steps on getting started with testing
See conference video - http://www.lucidimagination.com/devzone/events/conferences/ApacheLuceneEurocon2011
In this talk, Lucene/Solr committer Mark Miller will discuss some of the new features and advancements that users can look forward to in Solr 4. The list of topics will include: performance optimizations, further support for near-realtime search, SolrCloud, DirectSolrSpellChecker, and more.
In which Richard will tell you about some things you should never (probably ever) do to or in Python. Warranties may be voided. The recording of this talk is online at http://www.youtube.com/watch?v=H2yfXnUb1S4
Akka and the Zen of Reactive System DesignLightbend
In order to be successful with asynchronous programming, when coming from synchronous execution models you need to change your mindset and look at things from a slightly different perspective. In order to use Akka at it's best, you will have to change the way you think about application design (loosen coupling in space and time between components), and re-think what you've maybe learned in the past.
In this talk we uncover a number of rules that serve as a guide in designing concurrent distributed applications, how those apply to Akka, and how they can help you in daily app development.
Aimed at developers through architects, Akka team happy hAkker, Konrad Malawski, bends your parameters with regards to application design and asynchronous execution models.
There are more smart people building software now than there have been at any point in the past, which means that it's more important than ever to stay on top of new developments, libraries, frameworks, and everything else. To really take advantage of this wealth of innovation, however, you've got to look beyond your normal community -- what's going on in Python? And how can we use that to make our Ruby lives easier? In this session, we'll explore that question. We'll look at actual examples of code and concepts borrowed and reimplemented to form a better idea of when it's appropriate and when it'll fall flat.
Changing the wheels on the bus at 80 mph
Andrew Bloomgarden and Julian Giuca
RailsConf 2013
Long-running branches are painful, but upgrading to Rails 3 requires one if you can't stop development, right? Wrong! At New Relic, we worked on upgrading to Rails 3 on master while letting development continue in Rails 2. We patched Bundler, built a backwards-compatible boot sequence, and punched ActiveScaffold in the face. Other developers, meanwhile, released 1400 commits worth of work without noticing any changes. We talk about what we did, why we did it, and why we think this approach can help developers get over the hurdle into the Rails 3 promised land.
Jenkins User Conference 2012
Only by the third plugin do you get the hang of writing a plugin. I thought as a developer coming to the build side of things it'd be easy to jump in and write some plugins. I was wrong. Don't be fooled by the extremely friendly Jenkins community, writing a plugin from scratch is harder than they let on. This talk will explain the hurdles that I had to cross to make writing plugins easy.
Programming languages must be implemented in Java or C, everybody knows this. Sure, a prototype in Ruby, but that would be unusable. After all, Ruby is made for web development, right? Hard tasks, like implementing a compiler, have to happen in far more manly languages. But wait, the Rubinius compiler is written completely in Ruby, and it seems to get pretty decent performance, maybe we can use that.
In this talk, we will explore the possibilities of using the Rubinius compiler tool chain to implement our own programming language targeting the Rubinius VM. We get all the hard work that went into Rubinius for free and above all, can do the heavy lifting in Ruby, everyone's favorite programming language.
As an example we'll use Reak, a Smalltalk implementation running on Rubinius.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
See conference video - http://www.lucidimagination.com/devzone/events/conferences/ApacheLuceneEurocon2011
In this talk, Lucene/Solr committer Mark Miller will discuss some of the new features and advancements that users can look forward to in Solr 4. The list of topics will include: performance optimizations, further support for near-realtime search, SolrCloud, DirectSolrSpellChecker, and more.
In which Richard will tell you about some things you should never (probably ever) do to or in Python. Warranties may be voided. The recording of this talk is online at http://www.youtube.com/watch?v=H2yfXnUb1S4
Akka and the Zen of Reactive System DesignLightbend
In order to be successful with asynchronous programming, when coming from synchronous execution models you need to change your mindset and look at things from a slightly different perspective. In order to use Akka at it's best, you will have to change the way you think about application design (loosen coupling in space and time between components), and re-think what you've maybe learned in the past.
In this talk we uncover a number of rules that serve as a guide in designing concurrent distributed applications, how those apply to Akka, and how they can help you in daily app development.
Aimed at developers through architects, Akka team happy hAkker, Konrad Malawski, bends your parameters with regards to application design and asynchronous execution models.
There are more smart people building software now than there have been at any point in the past, which means that it's more important than ever to stay on top of new developments, libraries, frameworks, and everything else. To really take advantage of this wealth of innovation, however, you've got to look beyond your normal community -- what's going on in Python? And how can we use that to make our Ruby lives easier? In this session, we'll explore that question. We'll look at actual examples of code and concepts borrowed and reimplemented to form a better idea of when it's appropriate and when it'll fall flat.
Changing the wheels on the bus at 80 mph
Andrew Bloomgarden and Julian Giuca
RailsConf 2013
Long-running branches are painful, but upgrading to Rails 3 requires one if you can't stop development, right? Wrong! At New Relic, we worked on upgrading to Rails 3 on master while letting development continue in Rails 2. We patched Bundler, built a backwards-compatible boot sequence, and punched ActiveScaffold in the face. Other developers, meanwhile, released 1400 commits worth of work without noticing any changes. We talk about what we did, why we did it, and why we think this approach can help developers get over the hurdle into the Rails 3 promised land.
Jenkins User Conference 2012
Only by the third plugin do you get the hang of writing a plugin. I thought as a developer coming to the build side of things it'd be easy to jump in and write some plugins. I was wrong. Don't be fooled by the extremely friendly Jenkins community, writing a plugin from scratch is harder than they let on. This talk will explain the hurdles that I had to cross to make writing plugins easy.
Programming languages must be implemented in Java or C, everybody knows this. Sure, a prototype in Ruby, but that would be unusable. After all, Ruby is made for web development, right? Hard tasks, like implementing a compiler, have to happen in far more manly languages. But wait, the Rubinius compiler is written completely in Ruby, and it seems to get pretty decent performance, maybe we can use that.
In this talk, we will explore the possibilities of using the Rubinius compiler tool chain to implement our own programming language targeting the Rubinius VM. We get all the hard work that went into Rubinius for free and above all, can do the heavy lifting in Ruby, everyone's favorite programming language.
As an example we'll use Reak, a Smalltalk implementation running on Rubinius.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
The field of Information retrieval (IR) is currently undergoing a transformative shift, at least partly due to the emerging applications of generative AI to information access. In this talk, we will deliberate on the sociotechnical implications of generative AI for information access. We will argue that there is both a critical necessity and an exciting opportunity for the IR community to re-center our research agendas on societal needs while dismantling the artificial separation between the work on fairness, accountability, transparency, and ethics in IR and the rest of IR research. Instead of adopting a reactionary strategy of trying to mitigate potential social harms from emerging technologies, the community should aim to proactively set the research agenda for the kinds of systems we should build inspired by diverse explicitly stated sociotechnical imaginaries. The sociotechnical imaginaries that underpin the design and development of information access technologies needs to be explicitly articulated, and we need to develop theories of change in context of these diverse perspectives. Our guiding future imaginaries must be informed by other academic fields, such as democratic theory and critical theory, and should be co-developed with social science scholars, legal scholars, civil rights and social justice activists, and artists, among others.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
3. Topics
Intro to Actor Model
Rubinius: cores 4 Ruby
Celluloid: AM in Ruby
How it works
Supervisors, Supervision Groups
Linking, Observers
Futures, Pools, Notifications
Celluloid + Rails = ?
Simple Fractal Demo
Sunday, October 20, 13
4. Intro to Actor Model
Carl Hewitt paper from 1973
[OT] Two processors with
native support:
J-Machine
Cosmic Cube
Inspired well-known
languages:
Smalltalk
Erlang (embraces at all)
Sunday, October 20, 13
5. Intro to Actor Model
Actor Model provides a abstraction to concurrency
Threads
Locks
Gained popularity today with multi-core programming
challenge
Better CPU use
More CPUs
Massive concurrency
Sunday, October 20, 13
6. Intro to Actor Model
Everything is a actor
Actors communicates between self by asynchronous
message exchange
Does sound familiar?
Mailbox to buffer incoming messages
Mailbox processing with pattern matching
Each actor runs as independent, lightweight process
No shared state
Sunday, October 20, 13
7. Intro to Actor Model
It sounds good, but is not a silver bullet (as
anything in Planet Earth)
Data *must* be immutable
Requires multi-core support to be effective
You need to be comfortable to change your way
of thinking :)
Sunday, October 20, 13
9. Rubinius: cores 4 Ruby
Created by Evan Phoenix
Implements concurrency support for Ruby (no GIL)
Better Garbage Collector
Uses LLVM for aggressive bytecode optimization with JIT
(Just-In-Time) machine code compiler
Written mainly in C++
Ruby STDLIB in pure Ruby (rubysl*)
Wraps native gems with FFI
Sunday, October 20, 13
10. Rubinius: cores 4 Ruby
Supports MRI 2.0 features, focusing on 2.1
horizon
Rubinius implementation was created RubySpec,
a executable specification for Ruby Programming
Language
Used by JRuby too
Sunday, October 20, 13
11. Rubinius: cores 4 Ruby
To install in your computer:
$ rbenv install rbx-2.0.0
$ rvm install rbx
To install in your server:
No available OSs packages at this moment :’(
But I create one for Debian Wheezy 64 bits :D
https://github.com/salizzar/rubinius-debian
Next target: CentOS ;)
Sunday, October 20, 13
12. Rubinius: cores 4 Ruby
HOT NEWS: Rubinius X was created in last week
Created by Brian Shirai
Roadmap to modernize Ruby
@polemiquinho: Ruby is dying
Sunday, October 20, 13
14. Celluloid: AM in Ruby
Created by Tony Arcieri
Inspired from Erlang
concurrency approach
Gooby pls, only thread-safe
libs
Requires Ruby 1.9 support
MRI >= 1.9
JRuby >= 1.6
Rubinius >= 1.2
Sunday, October 20, 13
15. Celluloid: AM in Ruby
Celluloid contains a lot of features, check on Github Wiki Page
Main Features
Automatic Synchronization
Celluloid manages method dispatch and threads
Abstraction layer to Threads / Fibers, don’t worry to manage it
Fault-Tolerance
Let it crash Erlang philosophy
Celluloid offers mechanisms to handle crashed actors
Sunday, October 20, 13
16. Celluloid: AM in Ruby
require 'celluloid'
class FredFlinstone
include Celluloid
def scream(to)
@scream = "#{to}#{to[-1] * 10}"
@screamed_at = Time.now
end
def resume
"Screamed [#{@scream}] at #{@screamed_at}"
end
end
Sunday, October 20, 13
17. Celluloid: AM in Ruby
[1] pry(main)> fred = FredFlinstone.new
=> #<Celluloid::ActorProxy(FredFlinstone:0x1164f94)>
[2] pry(main)> fred.async.scream("Wilma")
=> nil
[3] pry(main)> fred.resume
=> "Screamed [Wilmaaaaaaaaaaaa] at 2013-10-13 17:12:59 -0300"
Sunday, October 20, 13
18. Celluloid: AM in Ruby
Fault-Tolerance
Let-it-crash Erlang philosophy
A crashed actor *must* be handled or your application will
be down
Celluloid have the following mechanisms:
Supervisors
Supervision Groups
Linking
Sunday, October 20, 13
19. Celluloid: Supervisors
How actors crash? Simple, unhandled exceptions
Warning #1: async calls that raises an error
crashes the message receiver; posterior calls NOT
RAISES ANYTHING
Warning #2: each actor spawn a native Thread,
that is not automatically cleaned by GC; you
MUST explicitly terminate this if not crashed
Supervise to the rescue
Sunday, October 20, 13
20. Celluloid: Supervisors
require 'celluloid'
class Devops
include Celluloid
def initialize(name)
@name = name
end
def up_to_no_good
@bad_cmd = 'rm-f /'
@command = `#{@bad_cmd}`,
@executed_at = Time.now
end
end
Sunday, October 20, 13
22. Celluloid: Supervision
Groups
Supervise many actors at once
Able to supervise other groups too
You can create pools of supervised actors
Transparent GC cleaning (automagically
terminates all supervised actors)
Sunday, October 20, 13
23. Celluloid: Supervision
Groups
require 'celluloid'
class QuarryWorker
include Celluloid
def initialize(sound) ; @sound = sound ; end
def explode ; puts @sound.upcase ; end
end
class EyeOfSauron < Celluloid::SupervisionGroup
supervise FredFlinstone, as: :fred
pool
QuarryWorker, as: :quarry_pool, args: [ 'boom' ]
end
Sunday, October 20, 13
25. Celluloid: Linking
Suppose that you have two interdependent actors
and wants to be notified if one fails
Association by linking actor that commonly dies
and the receiver enables a simple callback when
failure occurs
Useful to catch exceptions
Sunday, October 20, 13
26. Celluloid: Linking
require 'celluloid'
class RobertoBaggio
include Celluloid
class KickedFarAwayError < StandardError; end
def kick_penalty
raise(KickedFarAwayError, "OH MAMMA MIA! :'(")
end
end
Sunday, October 20, 13
27. Celluloid: Linking
require 'celluloid'
class GalvaoBueno
include Celluloid
trap_exit :penalty_kick
def penalty_kick(player, reason)
puts "#{player.inspect} will kick and... #{reason.class}!"
2.times { puts "ACABOOOOOOU! "; sleep(1) }
3.times { puts "EH TETRAAAA! "; sleep(1) }
end
end
Sunday, October 20, 13
29. Celluloid: Futures
Lazy computation: calling method with .future
returns a Future object, that will be executed
when .value is called
When value is required, Celluloid synchronously
call method and returns
Transparent error raising
Sunday, October 20, 13
30. Celluloid: Futures
require 'celluloid'
require 'restclient'
class LazyConsumer
include Celluloid
def retrieve
RestClient.get('http://www.locaweb.com.br').body
end
end
Sunday, October 20, 13
32. Celluloid: Pools
Generalized pool mechanism
Default size: number of processors (Celluloid.cores)
Delegates method call to a worker in pool to execute
In MRI, performance is OK with async I/O
Two tips:
Synchronous call with concurrent actors accessing pool
Asynchronous call or Futures with parallel computation
Sunday, October 20, 13
33. Celluloid: Pools
require 'celluloid'
require 'complex'
class ComplexFactory
def create(seed)
factor = seed + 0.1
a, b = 2.times.collect { srand() % factor }
Complex(a, b)
end
end
Sunday, October 20, 13
35. Celluloid: Notifications
typeof Observer Pattern
Subscribe / Publish topics to be handled by actors
without need to explicitly make them known
Ideal for long-lived subscriptions, be careful with
short-lived
Sunday, October 20, 13
36. Celluloid: Notifications
require 'celluloid'
class HardWorker
include Celluloid, Celluloid::Notifications
def work(factor)
fibo = lambda do |x|
return x if (0..1).include?(x)
fibo[x - 1] + fibo[x - 2]
end
result = fibo.call(factor)
publish('factorial_created', factor: factor, value: result)
true
end
end
Sunday, October 20, 13
37. Celluloid: Notifications
require 'celluloid'
class LazyStudent
include Celluloid, Celluloid::Notifications
def on_creation(*args)
data = args.last
puts "Factorial of #{data[:factor]} is #{data[:value]}"
end
end
Sunday, October 20, 13
38. Celluloid: Notifications
[1] pry(main)> student = LazyStudent.new
=> #<Celluloid::ActorProxy(LazyStudent:0xda16c8)>
[2] pry(main)> student.subscribe('factorial_created', :on_creation)
=> #<Celluloid::Notifications::Subscriber:0x00000001ac20f0
@actor=#<Celluloid::ActorProxy(LazyStudent:0xda16c8)>,
@method=:on_creation,
@pattern="factorial_created">
[3] pry(main)> worker = HardWorker.new
=> #<Celluloid::ActorProxy(HardWorker:0xce6d64)>
[4] pry(main)> fibo = [ 30, 25, 28, 34, 11, 5 ]
=> [30, 25, 28, 34, 11, 5]
[5] pry(main)> fibo.each { |i| worker.async.work(i) }
=> [30, 25, 28, 34, 11, 5]
Factorial of 30 is 832040
Factorial of 25 is 75025
Factorial of 28 is 317811
Factorial of 34 is 5702887
Factorial of 11 is 89
Factorial of 5 is 5
Sunday, October 20, 13
40. Celluloid: and Rails?
Honestly? Forget it when using MRI.
Rack not handle Fibers well
Since Celluloid uses Fibers a lot, it may be a big problem
Fibers in MRI 1.9 have 4kb of stack size, when exceeds Celluloid mad
With apps that uses ActiveRecord, you will work hard due for
concurrency issues related to DB connection management
Sidekiq have a AR middleware to handle DB connections
Some people runs Rails apps mounted in a Reel (Celluloid::IO
webserver) using reel-rack, but only with MRI 2.0 because of Fiber
stack size
Sunday, October 20, 13
41. Celluloid: and Rails?
It sounds very bad for MRI, but if you use JRuby or
Rubinius...
No fear, but checks Celluloid Gotchas Github Page for
your sanity :)
In general, you can use it if:
Precise Timing is not a requirement (fire and forget)
Work is CPU bound
Work can be parallelizable
Sunday, October 20, 13
42. Celluloid: and Rails?
Here are some useful links talking about it:
http://rubyrogues.com/088-rr-concurrency-andcelluloid-with-tony-arcieri/
https://groups.google.com/d/topic/celluloidruby/y5gSm2VjVJw
https://github.com/celluloid/celluloid/wiki/
Gotchas
Sunday, October 20, 13
43. Celluloid: Fractal Demo
Time to show!
http://fractal.rubinius.salizzar.net
Source code available on:
https://github.com/salizzar/celluloid-fractal
Sunday, October 20, 13