Request ASPs to use static HTTP Client for calling REST API.

64 views
Skip to first unread message

Chartered Information Systems Pvt. Ltd.

unread,
Feb 3, 2021, 4:36:32 AM2/3/21
to TaxPro GSP

Dear Sir/Madam,

Greetings from TaxPro GSP Team!


Highly Recommended (Mandatory) Change for High Volume API Users.


Summary: Mandate to Push API Traffic through single HTTP Client Session. (or at max couple of HTTP Session.)

 

Impact: Performance improvement and scalability on Client’s server and TaxProGSP Server.

 

Nature of Discussion: Technical  (Target audience: Developers)

 

Down Time: NONE for this change.

 

Dear ASPs,

We are observing high number of HTTP Sessions form some clients (ASPs).  This is happening owing to very high number http client connections, since some of the ASPs might be creating NEW HttpClient for every request.  (This is like opening new browser tab for every API call.)


Irrespective of OS, framework and httpClient (like .NET HttpClient, OKHttp in Java, RestSharp in .NET, HttpWebRequest, anything else…) you are using, to consume REST APIs, we request ASPs to use single or at max couple of HTTP connection to TaxProGSP server. 


This can be achieved by creating static instance of thread safe HttpClient (refer to documentation of your HTTPClient, most of them are thread safe and re-entrant..!!)

 As we have written last week, we have already scaled our servers and more servers at Other Data Centres Locations would get added any time after 20 FEB, 2021; but using new instance of HttpClient for every request is like opening new Browser Tab for every page..!! and tens or hundreds of such per seconds per user, if your API traffic is high.  This is not only destabilizing TaxProGSP Server (by depleting available sockets) but also making your server sluggish and even may cause socket depletion at your server under heavy traffic..!  You may search for ‘time_wait connections’ in google and would understand that it takes few minutes to close unused http connection (4 minutes in Windows), but hundreds of new connections get opened every second.

 For users of TaxPro GST/EWB/eInvoice libraries, we are considering migration from RestSharp to HttpClient and would be providing you updates soon. The change would be transparent to users of Libraries.

RestSharp RestClient is still not using singleton HttpClient as per this link and update would not be available anytime soon: https://github.com/restsharp/RestSharp/issues/1322


 Also, as remedial action, last month we had called and talked to some of the ASPs.  We would keep on monitoring Http Sessions during pick hours and would get in touch with respective ASPs, one to one basis, to guide them correct use of http sessions from client end.


Thanks and Regards

TaxPro GSP

 

Reply all
Reply to author
Forward
0 new messages