I have an issue with the SAP .NET Connector
I have built a web application (ASP.NET, C#) that connects to SAP BAPI procedure to fetch results fro开发者_开发百科m SAP database.
I have connected it to SAP BAPI procedure and it also fetches the results for the web application.
My issue is, during the first attempt it takes 25 to 30 seconds to fetch the results, but from the second attempt onwards the results are fetched with no time.
I don't know exactly why it is taking so long to fetch the results on the first attempt.
Can somebody help me with this?
I see this delay also, and it's definitely at the point we use the connector to establish a connection with SAP rather than anything to do with SQL.
I'm theorising it's because on the first attempt the connector has to establish the connection, authenticate and initialise its own connection pooling.
It will depend on how loaded your SAP box is and where it's located relative to your web server of course, but there doesn't seem to be any way around it completely that I've found.
Your best course of action is just to make the connection once then reuse it as much as possible.
This is common behavior and is actually caused by SAP NCo retrieving the metadata for the BAPI first time around.
Once it has retrieved the metadata, it caches it for subsequent calls, which should be quick.
I regularly see first call times to BAPI_PO_CREATE1 of ~10 seconds, subsequent calls are ~1second.
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.
精彩评论