-
Notifications
You must be signed in to change notification settings - Fork 5
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
Addressing non-deterministic behavior of post/leave? #9
Comments
Would it help if we delayed activity in the chat until all expected clients joined? Not sure if it is feasible to buffer actions (post, leave) in the chat until then, but when a chat is created we already know how many clients are expected to participate: match behavior(_dice)
| Post => _chats(index)?.post(None, accumulator)
| Leave => _chats(index)?.leave(this, false, accumulator)
| Compute => Fibonacci(35) ; accumulator.stop(Compute)
| Invite =>
var invitations: USize = s.next().usize() % _friends.size()
if invitations == 0 then
accumulator.stop(Invite)
else
let created = Chat(this, invitations)
_chats.push(created)
// Again convert the set values to an array, in order
// to be able to use shuffle from rand
let f = _friends.clone()
_rand.shuffle[Client](f)
accumulator.bump(invitations)
for k in Range[USize](0, invitations) do
try f(k)?.invite(created, accumulator) end
end
end
else
accumulator.stop()
end Just a thought. It might be cleaner to look into the ordering of actions as you suggested. |
I don't think delaying is sufficient. The problem is the ordering of Post => _chats(index)?.post(None, accumulator) Here we have the non-determinism of |
As noted here, the Newspeak implementation may have an issue with the poker/act message design. In Newspeak, I do have issues with identity. I can not compare promises, I need to unwrap the value in the promise first. This means, I have to defer an operation until a turn after the promise is resolved. |
@RG-707 @josephnoir in CAV, do you see the same issue described in my last post here? That is, there are very few post/leave operations ever executed? I am thinking the Poker/Directory loops are just aggressively sending messages, where Pony's support for back-pressure, helps so that the other operations can actually succeed. I do not have support for back-pressure, and, worse, I need to resolve promises (an extra turn, possibly scheduled after all operations). It seems to me, that the benchmark needs to specify what exactly it wants without relying on back pressure support (which could be different enough to not help as expected). |
Yeah, I think we observer the same. CAF doesn't implement scheduling back-pressure either. Although I can't say if these actions never happen or if it is only the recoding of actions that fails. Do you have a configuration you want numbers for? With a single thread we observe neither posts nor leaves. With the default configuration on a quad-core processes I get: |
The probabilities say:
I think your numbers are also sufficiently far off to indicate that there might be an issue for implementations without back-pressure support. At least my expectation would be that for large enough numbers, which you have, they should be roughly in proportion to these probabilities. And, yeah, the number of None actions is just too high. |
Yeah, I think too. I get on my X240 numbers that are near @josephnoir numbers. But the pony numbers for post are too high too compared to the probabilities:
|
The numbers on my MacBookPro are almost the same for Pony:
What's a bit concerning is that the results are printed and then it is still working for another 5seconds or longer. So, it's apparently doing stuff, which is outside of the timed interval, but perhaps should not be outside of it. |
@smarr @josephnoir @RG-707 The counts for post messages also currently include the messages sent because of buffered chat forwards. That is, it is expected to this not match the probabilities. Also, @smarr, the stuff that Pony does after printing out the stats its purely doing cycle detection on a large graph of blocked actors, at a point in time where the program is quiescent. Running with |
What do you think about counting post and delivery-of-a-post separately? |
Done and pushed. Standard configuration:
Execution with a single thread:
|
When I change it the same way @sblessing did it for pony, I don't get post any more only post_delivery. See https://github.com/RG-707/chat-app/tree/caf_post_count |
To me it seems we need to somehow specify that there is room for the actor to actually perform turns between We might need a request/reply for the I am not sure how that fits with the goal to 'saturate' the system, though. But as long as the number of clients is a multiple of the cores in the system, it might satisfy this goal? |
@smarr I think you are referring to the fact, that currently, the system allows that turns overlap? I.e turn j+1 could finish before turn j. For saturating the system (and simulating realistic external events) I was the opinion that this nice - but I might be wrong. |
No, sorry for the terminological confusion. The problem I see is that I need extra turns, for instance for unwrapping promises, and I don't get a chance for performing these turns before the next act message, because the mailbox is already full of act messages, and everything else will simply go to the back of it. So, in all of this issue, when I referred to turn, I was meaning it in the event-loop context. |
I am not familiar in detail with newspeak, but would your problem go away if you wouldn't use promises? |
The Newspeak version of ChatApp currently does not use promises, except where it absolutely has to, because there's simply no other way to do it. For instance, to create a chat actor, we create an actor In practice this means, the reference to the So, in these languages, this can simply not be avoided. And, I think, this isn't just a problem for these languages. CAF clearly has also very different numbers caused by how the communication is structured. |
And just to put a little bit more weight on this: if anyone wants to implement this benchmark for instance JavaScript, perhaps based on web workers, they'll run into the very same issues, because operations simply don't have synchronous return values. |
@smarr we have made some changes to counting and bumping 773a5c0. Some of it was broken after not well thought-out changes and a merge fail. The most important change, i guess, is that we are now making sure that befriending did happen before the first poke. Also, back pressure is, for small configurations, not an issue for CAF nor Newspeak. The core problem in the Newspeak implementation is actor creation promises. |
Pony results after 773a5c0
The actual distance to the total numbers alongside the probabilities is now coming from the fact that at the start, clients are in not chats. That is, the picked posts and leaves from the first couple of turns are ending in |
My understanding is that the size of a chat depends on the client, who invites all its friends.
The number of clients corresponds then also to the number of messages send as a consequence of a post action.
To allow comparisons of different benchmark executions, I assume the overall number of messages needs to be identical.
So, this means, a post action needs to predictably pick chats with the same sizes, which is currently not given since chat membership is racy, and the ordering of the chat list in a client also reflects execution order and timing.
For a moment, I was thinking, perhaps, chats need to be ordered by size, and that would be sufficient, but I don't think this would work, because the random picking of a chat would still be subject to the invitation/leave/membership race.
So, now I am thinking, actions need to follow a pattern such as:
Invite (Post | Compute)* Leave?
, wherePost
andLeave
or only done on chats the client created directly.I am unsure about the impact of this, and the dynamic behavior that would get lost.
One thing that would certainly get lost is that the number of messages triggered by a client is not changing anymore.
A very simple change would be to have one chat created per client on client creation, which can't be left, as well as making sure we distinguish client-created from invited-to chats.
The text was updated successfully, but these errors were encountered: