Replies: 9 comments
-
Are you sharing anything on the database side between the parallel runs, like same database connection/tables? |
Beta Was this translation helpful? Give feedback.
-
As far as I know, in PHP the user (as well as this library) can't handle processes nor CPU threads, the engine does it all. By the way there's something fundamentally wrong in your setup if you get those results. In many mainstream computers I've worked with, going above 12 or 16 processes in Paratest the result doesn't scale anymore, because the bootstrap operations become too dominant. But in every well coded test suite, and with With |
Beta Was this translation helpful? Give feedback.
-
@Slamdunk: I don't think it's a DB setup, even if it's the case with multi-threading the time must decrease when we run a lot of thread 50 or 100. This is how my test works: For each test :-
The problem here is why paratest is limited to process not thread |
Beta Was this translation helpful? Give feedback.
-
If going from Creating and deleting a db is extremely time consuming, try a table-truncation-teardown |
Beta Was this translation helpful? Give feedback.
-
+1 on this, the culprit is totally your database: creating/deleting a schema is not an operation built for concurrency, so it probably has a lot of locks that make the execution of your tests nearly sequential, even when using Paratest. It also forces the DB to flush to the disk, so you're an order of magnitude slower. |
Beta Was this translation helpful? Give feedback.
-
@Jean85 and @Slamdunk : thank you for your response i will do a search in mysql create/delete schema and concurrency. |
Beta Was this translation helpful? Give feedback.
-
What we're saying is that from within PHP, we cannot directly govern how the CPU is consumed: Paratest just launches multiple PHPUnit processes, and leaves to the OS the job of actually leveraging all the available CPUs. So, if your tests aren't constrained by something else, you should see your CPU consumption increase with direct correlation to the number of parallel tests running. In a normal situation, you should see a 100% CPU consumption; in your case, we just suspect that the DB is acting as a bottleneck, stopping tests from proceeding at full speed. |
Beta Was this translation helpful? Give feedback.
-
@Jean85 : thank you, yes the issue of my test is a lot of create delete schemas for each test and not related to paratest. Thank you all. |
Beta Was this translation helpful? Give feedback.
-
Ok found a solution before each create/delete:
and after: |
Beta Was this translation helpful? Give feedback.
-
Summary
I have a lot of unit tests that use a real database for testing each test is isolated and can run in a separate thread, the sequential run takes 30 minutes, and with the option : -f -p32 it take 20-18 minutes.
My configuration is like that:
Current behavior
Knowing that one processor can run a lot of threads, it will be better if paratest use thread in place of processor, I don't know if it's a limitation of paratest or PHP language, but what I know is in other programation language we can run a lot of thread even if we have just one processor.
Expected behavior
Run each test in separate thread not a processor
Beta Was this translation helpful? Give feedback.
All reactions