Does concurrency happen even when only one thread is in a thread pool?

前端 未结 3 1131
失恋的感觉
失恋的感觉 2021-02-05 10:46

I\'m using Rails 5 and Ruby 2.4. How can I figure out, or can you tell by looking at the below, whether there are multiple threads running at the same time?

poo         


        
3条回答
  •  不思量自难忘°
    2021-02-05 11:40

    Since you are defining the fixed thread pool to have one thread, I would assume that you are not achieving any kind of concurrency. Looking at your error it appears that the one available thread from the pool was busy for too long and caused the connection timeout exception.

    When you altered your code implementation so that it did not contain a thread pool, the application was explicitly single threaded without the possibility of a connection timeout due to waiting on threads from a pool. Try increasing the size of your thread pool (perhaps to 3 or 5) and see if you are still getting that same exception.

提交回复
热议问题