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

Word to the wise - live sites, high demand #4

Open
adaddinsane opened this issue Feb 28, 2017 · 2 comments
Open

Word to the wise - live sites, high demand #4

adaddinsane opened this issue Feb 28, 2017 · 2 comments

Comments

@adaddinsane
Copy link

If this library is used in a high traffic site with lots of calls, the "Microtime" random source will cause a hang-up since it initiates garbage collection on every call. Of course it doesn't show up until the traffic reaches a certain point.

Yes, we were that site.

Luckily, being the cautious type, I had a failsafe config switch to revert to the previous method without having to redeploy (it's a big site generating pots of cash, the management don't like taking it down).

The solution is to remove it since there's no way of configuring which sources to use.

@ircmaxell
Copy link
Owner

@adaddinsane there is 100% a way of configuring which sources to use. Simply construct the object yourself instead of using the factory. If you know your runtime environment and needs (which it sounds like you do), then the factory serves no purpose other than saving a few lines of code.

$generator = new Generator(
    [...sources...],
    new Mixer
);

Additionally, the "hangup" is intentional, as it provides a non-deterministic source of entropy. I can see that being a problem, so perhaps it's worth looking into other ways (or only using that source if no higher source exists or is functional).

@adaddinsane
Copy link
Author

adaddinsane commented Feb 28, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants