-
Notifications
You must be signed in to change notification settings - Fork 200
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
Benchmark in section 10.1 returning strange values #16
Comments
I just checked on my machine, and I get similar results as you. Likely it happens because maps are more efficient than HashDict (since with HashDict, I still get the same degradation). That said, the point of the text still stands - the throughput increase is not as dramatical as we'd expect it to be. Once maps are replaced with ETS tables, you should see a larger increase as you add concurrency to the story. I'm currently working on the update for Elixir in Action, so I'll revise these numbers. |
Beware: the book in its current edition refers to a decrease in throughput as concurrency raises ... "The third parameter to Profiler.run specifies the concurrency level. Here, you’re starting 100 processes, each one issuing 100,000 requests to the single page-cache process. Somewhat surprisingly, the measured throughput is significantly smaller." (page 249) but, on the contrary to the book, the above results show that the measured throughput is raising, and it is not clear why ... |
Yes, I understand that. As I mentioned, the throughput is still decreasing with HashDict. I'll probably need to make the example a bit more involved to reach the throughput decrease with maps. The thing is that we cache only one item, and maps are now much more efficient than HashDict (which wasn't the case when the book has been published). If we cached more items, and things were being constantly added to and deleted from the cache, the throughput would ultimately degrade, even with maps. ETS tables would have much more stable behaviour in such cases. Also, even in this simple case, you can notice that the throughput is not increasing as you'd expect it to. In your tests, you do get some increase, but certainly not 2x which one would expect to reach on a two-core machine. In contrast, with ETS-based cache you will notice a more significant increase as you start adding cores. |
@sasa1977 What OS did you use for the book? I am seeing really bad results on Windows 10 Pro (i7-5820K 3.30GHz, 6 cores) Non ETS:
ETS:
|
My main OS is macos. I've just tried it out on Windows 10 (quad core), the non ETS:
ETS:
|
Sorry, it was my mistake. Reporting was not taking into account the number of concurrent clients. |
Hi,
the benchmark in elixir_in_action_code_samples/ch10/profile_cache is returning the following results
Here are some more data:
These are strange as instead of decreasing as in the book, the throughput is increasing?!
What am I doing wrong here?
I am with a Macbook Pro, 2.6 GHz Intel Core i5, 16 GB 1600 MHz DDR3, macOS Sierra 10.12.6, Erlang 20.2 and Elixir 1.5.2.
I had to change the code of the example to use Map instead of HashDict and to depend on Elixir 1.5.2 in mix.exs.
Thanks
The text was updated successfully, but these errors were encountered: