Hi, Currently, JMeter uses Thread.sleep to implement a delay (e.g. think time). This requires lots of execution threads even though most of them will be idle waiting on .sleep.
I wonder what if JMeter would offload .sleep() operations to a queue and just switch the context to another operation? That is it could disassociate JMeterTread from java.lang.Thread, and reuse the thread for another task. For instance, we could put "sleep tasks" to java.util.concurrent.DelayQueue, then JMeter threads could fetch tasks from the queue. Any thoughts? Was this ever attempted? Of course, it might break the uses of ThreadLocal<...>, however, it would enable to have lots of virtual users with less number of threads provided there are think times (which should be a quite common case in my opinion). The implementation might confine the use of "context switch" only in case the delay exceeds a pre-defined limit. Then small delays could be served as usual (with little to no overhead), and big delays would not cause thread starvation. Vladimir
