How Spring Reactive Event loop Works internally with single core processor

Viewed 34

Let say, I have single core machine. I'm using java , springboot,reactive core framework, reactive-mongodb.

My Application:

  1. My Java application will receive Rest Request(locahost:8080/getAllStudents)
  2. My Java app will connect to mongo db and get all students from the db and return (flux) the response back in async using reactive..

Questions:(Assume single core machine)

  1. Internally ,How many event loops will be there if 1000 requests is sent to my application parallely.

  2. How many threads will be created if 1000 requests sent to my application.

  3. let say, Once request arrives in my application, this request is handled by reactive-thread1 , while doing DB call what will happen? I mean reactive-thread1 will call the db and internally it register callback to execute. But once DB done its job, how same reactive-thread1 takes charge and send the response back????? and what if reactive-thread1 is busy with doing some other job???

  4. What if im doing CPU intensive tasks(assume it takes 5 minutes to complete) in each request. On this case, if I send 1000 requests in reactive application, what will happen?

Simply, im bit confused about event loops internal mechanism in specific to java-springboot-netty. Can anyone explain crystal clear?

0 Answers
Related