-
Notifications
You must be signed in to change notification settings - Fork 24
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
Avoid using fixed-seed prng #29
Conversation
libc's `rand` is seeded with `1` unless otherwise seeded with `srand`. In particular this was causing all tgen clients with the same peer list to choose peers in the same order.
This was definitely causing perf clients to all hit the same servers in lockstep:
I'm not sure yet whether it affects markov clients. Strangely in the sim I'm looking at I only see the "Created new stream" string in |
Ah, it looks like that's because only markovclient1's tgen logs at
|
FWIW this doesn't seem to ultimately make much difference, at least in a scale=0.001 network. There are some other things going on here (like locally adding more perf nodes), but the only difference between these 2 sims is using this patch or not in tgen. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woo! Good find :)
For posterity:
I don’t think it affects the Markov clients because in that case we are seeding the Markov process using values that are set in the config file that are different for every client.
The Markov model seed is called markovmodelseed
in the tgen config file. The explanation from the docs :
The seed that will be used to initialize a pseudorandom number generator (prng) that will generate seeds for all Markov models created for this action. If unspecified, tgen initializes the prng using a seed generated by a global prng that was randomly seeded.
So as long as we're setting that seed from the config file, and are using a different seed for each client, we'll generate different delays on their streams so they won't exactly overlap.
Discussed some more out of band - it's not clear that |
libc's
rand
is seeded with1
unless otherwise seeded withsrand
.In particular this was causing all tgen clients with the same peer list
to choose peers in the same order.