It's been a long time since this one was opened, but it can be solved (it's even pretty easy if you know what to to).
We've had the very same problem, above 10 seconds delay till a connection was established. Within the targeted servers SM21 transaction, the connection wasn't visible till the client got the answer.
I've captured a network trace and saw that it's indeed the gateway taking it's time between request and response.
In the servers dev_rd log file (gateway debug log) appeared (after the initial delay) a pretty obvious entry:
Fri Aug 3 07:55:20:963 2018
NiHLGetHostName: to get [private-ip] failed in 12004ms (tl=2000ms; MT; UC)
*** ERROR => NiHLGetHostName: NiPGetHostByAddr failed (rc=-1) [nixxhl.cpp 514]
Trying to get a DNS answer for that IP failed through the nslookup tool as well.
The following requests are way faster as the gateway seems to cache the negative-hits, but as soon as the entry times out, you'll experience the delay again.
Therefore:
- Configure your DNS server (add the private zones with in-addr.arpa for successful reverse lookup), so that the gateway doesn't have to run into a timeout.
or (worse, as the reverse lookup zones should be set-up anyway)
- follow sap note 1055602, to permanently deactivate the reverse lookup via the rdisp/reverse_name_lookup parameter.