Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Actors Quickstart #775

Closed
1 of 4 tasks
paulyuk opened this issue Jan 14, 2023 · 11 comments
Closed
1 of 4 tasks

Proposal: Actors Quickstart #775

paulyuk opened this issue Jan 14, 2023 · 11 comments
Assignees
Labels
area/actors enhancement New feature or request
Milestone

Comments

@paulyuk
Copy link
Contributor

paulyuk commented Jan 14, 2023

I propose we have a new quickstart for Actors that does something cool in five mins, but also drives home some concepts of actors like: many stateful objects at once, autonomous behavior, timers and reminders, actors that can notify others, aggregates.

The theme in mind here is IoT twins for "Smart" smoke detectors. This would show off these features or concepts:

  • Start with 3 SmokeDetector Actors instances at first, but shows it could trivially scale out to 1000+. We would only have 1-2 Actor types to keep things simple.
  • Each SmokeDetector actor has stateful properties like status, battery, name, location, firmware version
  • When a SmokeDetector actor alarms, it can notify the other actors
  • A Control actor can command/control/View all actors, like initiate a test after receiving a slow signal from one, and can also view battery status (e.g. 1 of 3 low).

The quickstart will meet all the usual requirements:

  • Full documentation
  • Full MMD tests
  • Available in Python, C#, Java, and Golang [+ Node.js when available]

SDK implementation status.

@dapr/maintainers-dapr @greenie-msft @msfussell

@marcduiker (from Discord), I'd love to collab.

@paulyuk paulyuk added the enhancement New feature or request label Jan 14, 2023
@paulyuk
Copy link
Contributor Author

paulyuk commented Jan 14, 2023

There is a related ask for an Actors "starter" and we can consider one after this feature gets some steam.

@codeputer
Copy link

May I suggest why this DAPR Actor would be used on what is now becoming a crowded field in Virtual Actors. I started with ServiceFabric (where is that now???), and a few others. I now know that NewOrleans is in .Net7, so why not use that? I know that DAPR is an abstraction layer, but I have long learned via WCF that being everything to everyone is a failing value proposition - and we got stuck with REST - no data or service contract other than HTTP verbs and a crappy serialization format called JSON. Highest level of abstraction is one that does nothing!

@yaron2
Copy link
Member

yaron2 commented Jan 14, 2023

Hi @codeputer, this issue is not the place to discuss your questions, however:

I now know that NewOrleans is in .Net7, so why not use that?

Dapr actors are available for Python, Javascript, Golang, PHP, Dotnet and Java, giving a consistent actor programming model experience to both dotnet and non-dotnet developers.

I know that DAPR is an abstraction layer,

Dapr actors are in fact not an abstraction layer, but its own programming model exposed via strongly typed SDKs.

and we got stuck with REST - no data or service contract other than HTTP verbs and a crappy serialization format called JSON. Highest level of abstraction is one that does nothing!

Users using Dapr actors do not need to deal with REST or HTTP at all. As a semi-related side note, most Dapr SDKs use gRPC under the hood.

@marcduiker
Copy link
Contributor

Hi @paulyuk, please add me to the fork you're planning to create as you mentioned on Discord. I'm most comfortable with C# and JavaScript, but I should be able to figure out Java and Python as well.

@paulyuk
Copy link
Contributor Author

paulyuk commented Jan 15, 2023

Hi @marcduiker - will do - I would like to get a bit more community feedback and approvals from maintainers too before we get too far down implementation. Will keep you in loop!

@cgillum
Copy link
Contributor

cgillum commented Jan 19, 2023

I wonder if there's too much going on in the smart smoke detector quickstart to where it might distract from the value prop of actors. It's also not immediately obvious to me why you'd use an actor and not an API + database for this scenario. Yes, actors give you concurrency control for free but is it really solving a critical problem in this example, is it?

I wonder if there's a simpler example that could be used. What about an actor that counts votes? The example I have in mind is that I have a voting app where users can submit votes on some topic/question, and I deploy an actor that keeps a running tally. A web frontend can periodically query the actor state to get the current tally. Concurrency in cases like this makes a huge difference, which helps readers understand why they should consider actors. The example is also something that anyone can understand (you don't need to know anything about smart devices or IoT).

Thoughts?

@msfussell
Copy link
Member

I have the same feedback as Chris, that we should keep this understandable. Can we simplify the IoT scenario?

  1. Have 3 IoT devices at most.
  2. Have an aggregate "View/Control" actor which gathers the information from each of the three devices to show an aggregate view of the devices and can be used to send updates to each of the device actors. This shows that Actor to actor communication

@paulyuk
Copy link
Contributor Author

paulyuk commented Jan 31, 2023

Updated to simplify based on feedback from @cgillum and @msfussell .

I still prefer this device example over voting, because I would still imagine voting being better handled or handled well by plain old HTTP or pubsub.

@msfussell
Copy link
Member

@paulyuk - Approved

@paulyuk
Copy link
Contributor Author

paulyuk commented Feb 1, 2023

Hey @marcduiker I created this fork/branch and added you as a collaborator.
https://github.com/paulyuk/quickstarts/tree/feature/actors

@paulyuk paulyuk mentioned this issue Mar 4, 2023
4 tasks
@msfussell msfussell changed the title Proposal: New Actors Quickstart Proposal: Actors Quickstart May 22, 2023
@paulyuk paulyuk added this to the 1.11 milestone Jun 2, 2023
@paulyuk
Copy link
Contributor Author

paulyuk commented Jun 2, 2023

New feature merged with #804. Done!

@paulyuk paulyuk closed this as completed Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/actors enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants