I develop an application, and, at a given moment, I start about 10000 threads to stress-test a database. I want to synchronize this in the following way: I want to read all data from a table in all the threads, then I want all the treads to wait for the other threads to stop reading. After all threads finished reading, I delete all records from that table, then I want all the threads to insert the data read previously. Now, how do I synchronize my threads, to wait for each other in the before mentioned order? What is the best solution?
Share
Use
CyclicBarrier:The example in the JavaDoc quoted above solves the exact same problem.
10 thousand threads? Make sure you are testing your database, not your CPU and memory (context switching overhead might be tremendous). Have you considered jmeter in distributed mode?