Code behavior depends on many factors, including server load. Understanding the impact of server load will prove useful when trying to optimize the performance of a codebase. Simulating load can be done via specialized Open-Source tools like JMeter or Gatling and by online services that can quickly provision huge numbers of virtual machines that simulate a high number of users.
Load-testing tools work by simulating user sessions browsing your application for a period of time. These statistics can provide some insight, but they cannot explain why your code becomes slower when it is under stress. One way to get more information is to run some Blackfire scenarios (via Blackfire player) while the load is high and compare these profiles with ones generated under negligible load. The comparison graph should highlight which parts of the code degrade under stress.
Instead of using the JMeter GUI to create scenarios, use a recorder like the one provided by Blazemeter.