I've recently migrated an event subscription service called by a bash script from Ubuntu, into a Dockerised container.
The Docker image I am using is: FROM php:7.1-apache
The script itself is pretty straightforward:
#!/bin/bash
DIR="$(dirname $0)"
OUTPUT=""
while true
do
OUTPUT=""
OUTPUT=$OUTPUT$(php $DIR/../bin/cli.php bash:v1:issueEvents)
OUTPUT=$OUTPUT$(php $DIR/../bin/cli.php bash:v1:processCustomerAccountEventSubscriptions)
OUTPUT=$OUTPUT$(php $DIR/../bin/cli.php bash:v1:processProductionOrderEventSubscriptions)
OUTPUT=$OUTPUT$(php $DIR/../bin/cli.php bash:v1:processWebEnquiryEventSubscriptions)
OUTPUT=$OUTPUT$(php $DIR/../bin/cli.php bash:v1:processWebOrderEventSubscriptions)
OUTPUT=$OUTPUT$(php $DIR/../bin/cli.php bash:v1:processWebQuoteEventSubscriptions)
if [ -z "$OUTPUT" ]; then
sleep 10
fi
done
A complete round trip from event subscription to processing would take about 30 seconds on the host OS. Inside a container it is taking around 10 minutes.
My initial suspicion was that DNS was slowing things down, but I've installed dnsutils
and the lookup times are the same both inside and outside the container.
I'd like advice regarding how I'd go about investigating the cause of this slowdown.