Friday, October 17, 2014

Follow up: Executors and Cache Locality Experiment

Thanks to Jean Philippe Bempel who challenged my results (for a reason), I discovered an issue in last post: Code-completion let me accidentally choose Executors.newSingleThreadScheduledExecutor() instead of Executors.newSingleThreadExecutor(), so the pinned-to-thread-actor results are actually even better than reported previously. The big picture has not changed that much, but its still worthwhile reporting.

On a second note: There are many other aspects to concurrent scheduling such as queue implementations etc.. Especially if there is no "beef" inside the message processing, these differences become more dominant compared to cache misses, but this is another problem that has been covered extensively by other people in depth (e.g. Nitsan Wakart).

Focus of this experiment is locality/cache misses, keep in mind different queueing implementations of executors for sure add dirt/bias.

As requested, I add results from the linux "perf" tool to prove there are significant differences in cache misses caused by random assignment of Thread - to Actor as done by ThreadPoolExecutor and WorkStealingExecutor.

Check out my recent post for a description of the test case.

Results with adjusted SingleThreadExecutor (XEON 2 socket, each 6 cores, no HT)


As in previous post, "dedicated" actor-pinned-to-thread performs best. For very small local state, there are only few cache misses so differences are small, but widen once a bigger chunk of memory is accessed by each actor. Note that ThreadPool is hampered by its internal scheduling/queuing mechanics, regardless of locality, it performs weak.


When increasing number of Actors to 8000 (so 1000 actors per thread), "Workstealing" and "Dedicated" perform similar. Reason: executing 8000 actors round robin creates cache misses for both executors. Note that in a real world server its likely that there are active and inactive actors, so I'd expect "Dedicated" to perform slightly better than in this synthetic test.

"perf stat -e" and "perf stat -cs" results

(only 2000, 4000, 8000 local size tests where run)

Dedicated/actor-pinned-to-thread:
333,669,424 cache-misses                                                
19.996366007 seconds time elapsed
185,440 context-switches                                            
20.230098005 seconds time elapsed
=> 9,300 context switches per second

workstealing:
2,524,777,488 cache-misses                                                
39.610565607 seconds time elapsed
381,385 context-switches                                            
39.831169694 seconds time elapsed
=> 9,500 context switches per second

fixedthreadpool:
3,213,889,492 cache-misses                                                
92.141264115 seconds time elapsed
25,387,972 context-switches                                            
87.547306379 seconds time elapsed
=>290,000 context switches per second








A quick test with a more realistic test method

In order to get a more realistic impression I replaced the synthetic int-iteration by some dirty "real world" dummy stuff (do some allocation and HashMap put/get). Instead of increasing the size of the "localstate" int array, I increase the HashMap size  (should also have negative impact on locality).


Note that this is rather short processing, so queue implementations and executor internal implementation might dominate locality here. This test is run on Opteron 8c16t * 2Sockets, a processor with 8kb L1 cache size only. (BTW: impl is extra dirty, so no performance optimization comments pls, thx)


As ThreadPoolExecutor is abnormous bad in this Test/Processor combination, plain numbers:

64 HMap entries256 HMapentries2000 HMapentries4000 HMapentries32k HMapentries320k HMapentries
WorkStealing107010711097112912381284
Dedicated656646661649721798
ThreadPool83148751941294921026910602

Conclusions basically stay same as in original post. Remember cache misses are only one factor of overall runtime performance, so there are workloads where results might look different. Quality/specialization of queue implementation will have huge impact in case processing consists of only some lines of code.

Finally, my result: 
Pinning actors to threads created lowest cache miss rates in any case tested.




99 comments:

  1. Hi Rudiger
    Small typo at the beginning
    "Code-completion let me accidentally choose Executors.newSingleThreadScheduledExecutor() instead of Executors.newSingleThreadScheduledExecutor()"
    Again you selected the Scheduled one :)
    Thanks for sharing
    Georges

    ReplyDelete
  2. Argh .. poor me .. I am considering to fork openjdk and delete this method :-) Thx

    ReplyDelete
  3. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this
    Digital Marketing Training in rajajinagar

    ReplyDelete
  4. This blog is the general information for the feature. You got a good work for these blog.We have a developing our creative content of this mind.Thank you for this blog. This for very interesting and useful.
    Click here:
    python training in Bangalore
    Click here:
    python training in Bangalore

    ReplyDelete
  5. I read this post two times, I like it so much, please try to keep posting & Let me introduce other material that may be good for our community.
    Blue Prism Training in Pune

    Blueprism training in tambaram

    Blueprism training in annanagar

    ReplyDelete
  6. This is most informative and also this post most user friendly and super navigation to all posts... Thank you so much for giving this information to me.. 
    python training in pune | python training institute in chennai | python training in Bangalore

    ReplyDelete
  7. It would have been the happiest moment for you,I mean if we have been waiting for something to happen and when it happens we forgot all hardwork and wait for getting that happened.

    Microsoft Azure online training
    Selenium online training
    Java online training
    Java Script online training
    Share Point online training

    ReplyDelete
  8. Attend The Python training in bangalore From ExcelR. Practical Python training in bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Python training in bangalore.
    python training in bangalore

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. I learned World's Trending Technology from certified experts for free of cost. I Got a job in decent Top MNC Company with handsome 14 LPA salary, I have learned the World's Trending Technology from Data science training in btm layout experts who know advanced concepts which can help to solve any type of Real-time issues in the field of Python. Really worth trying hkbk group of institutions

    ReplyDelete
  11. Thank you for sharing. Machine Learning Training in Bangalore from Indian Cyber Security Solutions design the course to provide a broad introduction to machine learning, data-mining, and statistical pattern recognition. Machine learning is the science of getting computers to act without being explicitly programmed. In the past decade, machine learning has given us self-driving cars, practical speech recognition, effective web search, and a vastly improved understanding of the human genome. Machine learning is so pervasive today that you probably use it dozens of times a day without knowing it. Machine Learning Course done by ICSS in Kolkata. ICSS is the Best Machine Learning Institute in Bangalore.

    ReplyDelete
  12. If you are stuck with your online management assignment then in this case you can opt for our Database Management Assignment help. we provide the best assignment assignment help online.
    We also provide Advanced Database Management System help. for students across the globe.
    for more information contact us +16692714848

    ReplyDelete
  13. Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.

    arttificial intelligence course in faridabad

    ReplyDelete
  14. Thanks for sharing this article
    Leanpitch provides online training in Scrum during this lockdown period everyone can use it wisely.
    Scrum Values

    ReplyDelete
  15. You might comment on the order system of the blog. You should chat it's splendid. Your blog audit would swell up your visitors. I was very pleased to find this site.I wanted to thank you for this great read!!
    Data Analyst Course

    ReplyDelete
  16. "I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it. data science courses
    "

    ReplyDelete

  17. You completed certain reliable points there. I did a search on the subject and found nearly all persons will agree with your blog.
    data scientist courses

    ReplyDelete
  18. Your way of telling the whole thing in this paragraph is truly fastidious, every one can effortlessly be aware of it,Thanks a lot.
    Disk Drill Crack

    ReplyDelete
  19. Your post is very awesome. And I think the admin in this site work very hard. Because the material use in this site is very informative for me and many others peoples. Thanks sharing this amazing post.
    IBM SPSS Statistics Crack

    ReplyDelete
  20. Very informative blog and very easy to understand. Keep posting, will be returning back for updates. Thank you
    https://www.clariwell.in/
    Best Java Training

    ReplyDelete
  21. Great information, I got a lot of new information from this blog.

    Oracle Apex Training In Bangalore

    ReplyDelete
  22. Due to the rising demand for Data Scientists, there are many educational platforms that are coming up with programs in Data Science, you may never find the best, but you can always find the one that is suitable for you.

    Data Science Training in Gurgaon

    ReplyDelete
  23. This comment has been removed by the author.

    ReplyDelete
  24. need to thank you for this particularly fantastic article. I definitely really liked every part of it.Educational Institute in Visakhapatnam

    ReplyDelete
  25. Digital Marketing Course
    in Telugu

    ReplyDelete
  26. I was just examining through the web looking for certain information and ran over your blog.It shows how well you understand this subject. Bookmarked this page, will return for extra.
    data scientist training and placement

    ReplyDelete
  27. thanks for sharing i have a resource related python if you read this amazing content then you would like mine too.

    ReplyDelete
  28. Excellent blog. I am waiting for more blogs from you. Thank you.
    Python Training in Hyderabad

    ReplyDelete
  29. Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.

    ReplyDelete
  30. Thank you for the information.
    Java

    ReplyDelete
  31. I didn't understand why the customer service officials awarded my order to a rookie R programmer. The lady was fast but not accurate. She didn't fail but got me only 51 marks. I don't want to complain a lot because this is the first time you've done this to me. However, I must let Statistics Homework Help know that I'll choose my favorite R Homework Help expert next time. Meanwhile, thanks for the assistance.

    ReplyDelete
  32. You actually make it look so easy with your performance but I find this matter to be actually something which I think I would never comprehend. It seems too complicated and extremely broad for me. I'm looking forward for your next post, I’ll try to get the hang of it!
    data scientist training in hyderabad
    You actually make it look so easy with your performance but I find this matter to be actually something which I think I would never comprehend. It seems too complicated and extremely broad for me. I'm looking forward for your next post, I’ll try to get the hang of it!
    data scientist training in hyderabad

    ReplyDelete
  33. Adobe Character Animator Crack is a versatile application that allows users to create animated characters professionally easily. This will enable users to Adobe Character Animator Crack key to express and movement to their animated character, making it easy to create an engaging animated character. adobe character animator crack

    ReplyDelete
  34. I get pleasure from, cause I found just what I used to be having a look for. You’ve ended my four day long hunt! God Bless you man. Have a nice day. Feel free to visit my website; 온라인카지노사이트

    ReplyDelete
  35. Good web site! I truly love how it is simple on my eyes and the data are well written. I am wondering how I might be notified when a new post has been made. Feel free to visit my website; 카지노사이트링크

    ReplyDelete
  36. Its an amazing website, really enjoy your articles. Helpful and interesting too. Keep doing this in future. I will support you.Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. Feel free to visit my website; 온라인카지노사이트넷

    ReplyDelete
  37. just like to say thank for a tremendous post and all round interesting website. Please do keep up the great work. your blog. Feel free to visit my website; 바카라사이트닷컴

    ReplyDelete
  38. A very good and informative article indeed . It helps me a lot to enhance my knowledge. I really like the way the writer presented his views. I hope to see more informative and useful articles in future.Get best Mobile App Development Dubai service of app development you visit here site to get more info.

    ReplyDelete
  39. Google Adwords Certification Course
    Google Ads certification adds value to your resume. It increases the chance of getting employed in top MNC companies

    ReplyDelete
  40. Wonderful illustrated information. I thank you for that. No doubt it will be very useful for my future projects. Would like to see some other posts on the same subject!
    data scientist training in hyderabad

    ReplyDelete
  41. I think this is definitely an amazing project here. So much good will be coming from this project. The ideas and the work behind this will pay off so much. I am very happy to see your blog. You did a great job and thanks for sharing. Get best Mobile App Development Dubaiservice you visit here site for more info.

    ReplyDelete
  42. Nice blog and absolutely outstanding. You can do something much better but i still say this perfect.Keep trying for the best.
    data analytics courses in hyderabad with placements

    ReplyDelete
  43. Extremely overall quite fascinating post. I was searching for this sort of data and delighted in perusing this one. Continue posting. A debt of gratitude is in order for sharing.business analytics course in warangal

    ReplyDelete
  44. The concepts covered in each section of the Inventateq digital marketing course in Bangalore are expected to be fully grasped and achieved in each subsequent lesson. The growth hacking training program is designed by online businessmen and millionaires based on the most successful methods and practices.
    Inventateq digital marketing course in Bangalore

    ReplyDelete
  45. Everything is very open with a clear clarification of the issues. It was truly informative. Your site is useful. Thank you for sharing!data analytics course in jodhpur

    ReplyDelete
  46. I am another customer of this site so here I saw various articles and posts posted by this site,I curious more energy for some of them trust you will give more information further.

    ReplyDelete
  47. 360DigiTMG, the top-rated organisation among the most prestigious industries around the world, is an educational destination for those looking to pursue their dreams around the globe. The company is changing careers of many people through constant improvement, 360DigiTMG provides an outstanding learning experience and distinguishes itself from the pack. 360DigiTMG is a prominent global presence by offering world-class training. Its main office is in India and subsidiaries across Malaysia, USA, East Asia, Australia, Uk, Netherlands, and the Middle East.

    ReplyDelete
  48. You really make it look so natural with your exhibition however I see this issue as really something which I figure I could never understand. It appears to be excessively entangled and incredibly expansive for me.
    business analytics training in hyderabad

    ReplyDelete
  49. We are grateful for your blog post. You will find a lot of approaches after visiting your post. Great work
    data science course in malaysia

    ReplyDelete
  50. I see some amazingly important and kept up to a length of your strength searching for in your on the site
    cyber security course malaysia

    ReplyDelete
  51. I just couldn't leave your website before telling you that I truly enjoyed the top quality info you present to your visitors? Will be back again frequently to check up on new posts.Data Science Course in Mohali

    ReplyDelete
  52. Wonderful blog post. This is absolute magic from you! I have never seen a more wonderful post than this one. You've really made my day today with this. I hope you keep this up! data science course in Shimla

    ReplyDelete
  53. A data science is a researcher who prepares huge volumes of bog data for analysis, build complex quantitative algorithms to organize and synthesize the information
    http://360digitmg.com/india/data-science-using-python-and-programming-banglore

    ReplyDelete
  54. It is the superset of data mining in which data is collected. It is then cleansed with the help of statistical algorithms to transform it into a model that can efficiently represent data.

    ReplyDelete
  55. You completed certain reliable points there. I did a search on the subject and found nearly all persons will agree with your blog.data science training in jabalpur

    ReplyDelete
  56. I am really happy to say it’s an interesting post to read. I learn new information from your article, you are doing a great job. Keep it up
    Software Testing Tools Training in Hyderabad

    ReplyDelete
  57. Greetings to everyone i am olivia, Have you ever heard people saying that Physics is one of the most difficult subject? well i thought that same untill i found new assignment help australia, i am really satisfied with their Physics Assignment Help services which they provided me and because of them i archieved A+ grades in my exams, If you are looking for the best assignment help services you should definitely go with them !!!

    ReplyDelete
  58. We are associated with six hundred and seventy-six full-time and nine hundred and eighty-two part-time online skilled experts, each specializing in a different subject. Each of them is selected separately after a series of thorough screen tests, which include license checks. Not only this, but these tests also include detailed analysis of work history, writing online Java programming assignments, and interviews on a one-on-one basis.

    ReplyDelete
  59. For the past couple of years Java has introduced many adjustments and posed a hard challenge for developers to preserve up to date with new Java variations each 6 months. The release of popular frameworks like Spring 5, Spring safety 5, and Spring Boot 2 are simply some of the updates which had been introduced to life closing yr and the ultra-modern version of Java changed into released March 2020, Java 14. Builders will want to live on their feet as extra Java updates are introduced within the following few years.

    Java classes in Pune

    ReplyDelete
  60. I like your blog. If anyone want make career in Java so, Java Course in Greater Noida is best career opportunity.

    ReplyDelete
  61. Very interesting blog. Many blogs I see these days do not really provide anything that attracts others, but believe me the way you interact is literally awesome. also visit for : top cheque printing software , top digital signage software.

    ReplyDelete