0

I'm reading Ignite documentation and now I'm at the section about performance. Here is what it's written (emphasized mine):

By default, Ignite has it's main thread pool size set to 2 times the available CPU count. In most cases, keeping 2 threads per core will result in faster application performance, since there will be less context switching and CPU caches will work better.

I don't understand why is it less context switching if we have 2 threads per core? I thought if all threads are busy with some job there will be pretty much of context-switch because we cannot run jobs twice as the number of cores. Which will hurt performance.

What did they mean by that?

5
  • Maybe they count in virtual CPU cores and hyper-threading? Commented Apr 19, 2017 at 10:45
  • What did they mean by that? Without more context, it's impossible to say. Commented Apr 19, 2017 at 10:46
  • @AndrewHenle But this is what it was in the documentation. Commented Apr 19, 2017 at 11:27
  • 1
    @St.Antario Well, they have to have some default value, and this appears to be their reasoning. It might even be true. Commented Apr 19, 2017 at 11:29
  • the only person that can explain the reasoning is the person that wrote that documentation, anything else is just guessing. Commented Dec 27, 2017 at 19:43

1 Answer 1

0

The answer is an interpretation of the statement - hence assumes what the writer may be thinking and provides my view.

The statement may be right if we were to assume each core is hyper threaded, & each thread maximizes use of the CPU time it is allocated, and threads remain bound to the CPU core.

Or

core is single threaded and each of the threads maximizes the usage of available CPU time by minimizing the number of context switches (when one is blocked, other does computation)

For cache related mention to hold true the process threads must remain bound to the same core for considerable period of time.


A nice thought on why right number of threads is important than more number of threads with good example is here: https://blogs.mulesoft.com/biz/news/chasing-the-bottleneck-true-story-about-fighting-thread-contention-in-your-code/

Beyond that what is context switch overhead at processor level: though dated - gives good idea - http://blog.tsunanet.net/2010/11/how-long-does-it-take-to-make-context.html

Sign up to request clarification or add additional context in comments.

1 Comment

guesses are not answers, they are guesses, Please read How do I write a good answer? before attempting to answer more questions.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.