Failed to load test EJB using thread

I asked why 100,000 run () calls compile faster to 100000 start (), because I found out that, despite multithreading, 100000 start actually takes more than 10,000 run calls, because it controls flows.

In fact, I tried to run 100,000 threads to simulate the load on the EJB method that I want to test, and it seems like this is not possible. Is there any way I could achieve this? Or is it that I will need to have several machines to achieve this load.

Is it true that if I have a quad-core processor, I should have no more than 4 threads at a time to prevent context switching too heavy, because 4 threads will be running at any given time?

0
source share
2 answers

If you have 4 cores that support hyperthreading, you can only load 8 threads at a time. You can run more threads than this, however only 8 can be active at any given time. This is a limitation of the hardware you are using.

I highly doubt that you need to run 10K or 100K threads to test any system. Most systems can be saturated with only one thread (or a very small number), and I suspect your EJB is no exception.

You cannot verify that the method is thread safe with brute force testing. You can only determine this by reading the code.

You can find this interesting Java article : What is the limit on the number of threads you can create?

+1
source

100,000 is definitely too much. If your thread has processor intensity, then only 1 thread per processor / core should be sufficient. On the other hand, if your thread is not CPU intensified, you may have more than 1 thread per processor / core. You should do more tests to find out the optimal number of threads.

0
source

Source: https://habr.com/ru/post/893443/


All Articles