How many thread available for event parallel processing

I have zero knowledge on how threads/cores work, but the document was written pretty well so even I can setup saga configuration for parallel processing properly. Here’s what I did.

@Configuration
class SagaParallelConfiguration {
  private val processingGroup = "cloud-creation"
  private val cloudCreationThreadCount = 5
  private val cloudCreationSegmentCount = 5

  @Autowired
  fun configureProcessor(configurer: Configurer) {
    configurer.eventProcessing()
      .registerTrackingEventProcessor(processingGroup, { config -> config.eventStore() }) {
        TrackingEventProcessorConfiguration.forParallelProcessing(cloudCreationThreadCount)
          .andInitialSegmentsCount(cloudCreationSegmentCount)
      }
   }
}

I have one more question how do I check maximum number of thread that can config to TrackingEventProcessorConfiguration. I deploy this project using kubernetes/docker on my linux server which has 16 cores/32 threads. Does that mean the maximum number of thread that can use is 32.

That’s a good way, if there’s only once instance all the segments are covered. You can have almost as many threads as you want, like thousands, depending on the machine, OS and such. However as soon as you use more threads than there are vcpu’s (vcpu is a virtual cpu, if you have 14 cores, of which 6 have hypertheading, you have 20 vcpu’s) the threads have to ‘fight’ for resources.

This means sometimes a thread is paused from the OS for a bit of time, before continuing. If this becomes real bad you could run into problems. For example, a tracking event processor thread, might not respond in time to a new event, which might mean on other thread can claim the token and pick it up. If this will indeed occur, will depend a lot on what you are doing in the Saga, and the computing power of the vcpu’s.