KB Article #177178
Log Message Payload causes parallel transactions to stall when set to log to file
Problem
* A Log Message Payload set to log payloads to a file can cause parallel requests to stall until a long-running request completes.
Resolution
-- The reason for this is that the API Gateway attempts to write requests to the log as soon as they arrive. Because there is no way to share access to the same file across threads, a long-running transaction will block parallel requests from completing until the first one is done.
There are two ways to go about fixing this. The first is to insert an HTTP Parser filter before Log Message Payload. This filter will not complete until the entire message has been received, so Log Message Payload will not lock access to the file until that time, so it will be able to complete relatively quickly and it will not block other invocations of the filter from completing.
The other approach is to change the target of the Log Message Payload filter to a database or syslog, which allow shared access without blocking. This will allow parallel requests to be served without having to buffer them via an HTTP Parser filter.
The use of Log Message Payload with the log target set to a file should be discouraged in production environments due to the fact that the HTTP Parser approach requires the API Gateway to buffer every request.