Layer7 API Management

  • 1.  Service calling another service on the same gateway

    Posted Sep 06, 2017 10:00 AM
      |   view attached

    On our API Gateway 'mygw01' we have two services, A and B which expose very similar functions to our users. To minimise the amount of duplicated code, A and B transform their incoming requests into a standard format, which is then routed to service C, also on 'mygw01'.

     

    A and B route to C via the standard "Route via HTTP to" assertion with the internal server name of the API gateway the address parameter: http://mygw01:8080/serviceC

     

    We have recently had problems on our API Gateway with lots of connections stuck in a CLOSE_WAIT state, and have a suspicion that the fact that an invocation of A or B contributes to this problem by effectively using two sockets instead of one (one socket to handle the initial request, a second to handle the call to service C). A slight increase in the number of external calls, or the time taken by the backend to process the request seems to be enough to cause an often-fatal increase in the number of concurrent invocations which eventually block because, we assume, the Services A and B are waiting to call Service C, which is in turn unavailable because it too is waiting to get a socket to connect to our backend.

     

    Assuming that this is contributing to our problems, is there a way to indicate to the API Gateway to not use a TCP Socket but rather simply to invoke Service C directly? I assume this is a good use case for a fragment, but we are probably a bit stuck for the time being.

     

    Are there other approaches/modifications we can take to minimise the impact while we develop a more reliable solution?



  • 2.  Re: Service calling another service on the same gateway

    Broadcom Employee
    Posted Sep 06, 2017 01:31 PM

    Are all connections Meaning inbound to serviceA, outbound to ServiceC in close wait?

    Or is it the inbound or outbound connection(s)? Which also gets a little confusing since you are  routing to yourself?

    And are you using, ClusterWideProperty? If not can you try it?

    io.httpConnectionIdleTimeout = 5s

     

    It will require a restart of ssg.

     



  • 3.  Re: Service calling another service on the same gateway

    Broadcom Employee
    Posted Sep 06, 2017 01:36 PM

    You may also find this helpful:

     

    Large Number Of Sockets In Close_Wait State 

     

    Regards,

    Joe



  • 4.  Re: Service calling another service on the same gateway
    Best Answer

    Posted Sep 06, 2017 01:37 PM

    If the goal is to prevent duplicating code, why not simply use an Included policy fragment (containing whatever the API C does) and reference it in both API A and B? That would prevent duplication.



  • 5.  Re: Service calling another service on the same gateway

    Broadcom Employee
    Posted Sep 07, 2017 05:49 AM

    And costly (in terms of perf) routing actions



  • 6.  Re: Service calling another service on the same gateway

    Broadcom Employee
    Posted Sep 13, 2017 02:14 AM

    exactly, if API C only for internal use, policy fragment should be the best choice of code re-use