In our previous post where we showed how we hooked up our blog’s WordPress application with the new Compuware APMaaS offering. Since WordPress is a PHP application we use PurePath for PHP to monitor it. We highlighted that we got an alert about a response time violation on some of our blog posts – which is shown on the following screenshot.
In this follow-up post I want to show you how we get to the root cause of this problem which turns out to be a 3rd-party WordPress PHP plugin that detects Bad Requests including requests from Bots that try to put spam messages in blog comments.
Step 1: See PHP Performance Hotspots
For the selected timeframe, we open the Response Time Hotspot dashboard. This shows which layer of the PHP Application has the highest performance contribution.
Step 2: Pinpoint the problematic method
A click on the PHP layer shows us that the Sleep function is the biggest contributor to this performance hotspot:
Step 3: Identify the actual request
Let’s have a look at one of the transactions where we get to see where the sleep method is actually called:
We also get access to the web request details such as IP Address, User Agent or actual URL and Query String:
Analysis: Lots of Bad Requests reduces WordPress performance
The Bad Behavior Plugin does a good job in preventing these bots to post spam messages. What’s interesting though is their approach of putting the request to sleep for 2 seconds. If we have a lot of parallel bad requests we have a lot of threads that are blocked in wait. This will impact “real” users that want to access the blog as the web server might not have any available active threads. A different approach would help. If you have a suggestion for a better way to handle bad requests to avoid the blocked threads issue, let us know in the comments.
If you want to know more about performance management for PHP check out the blog from Klaus on Exploring the PHP World with PurePath Technology. If you are an existing Dynatrace Customer check out our dynaLearn Webinar on First Steps with PurePath for PHP.