0

Here we have a project where we providing flight booking service building using .netcore 3.1. And Microsoft.Tools.ServiceModel.Svcutil is used to generate Reference.cs model where we store the metadata from the third party API service.

Our third party API Requests and Responses are in XML file format. And we Saving each Request and Response (Before sending the request and after getting the response) to 3 place, Local Logs, AWS RDS - PostgreSQL and AWS s3 buckets. - after all savings then only we send the response to Our main back-end via our private api and then website receives the response from our main back-end via the our public API..

So in summary we runs 3 APIs here,

  • Public API - client request and response.
  • Private API - (Saving response to 3 places - logs, database and AWS s3)
  • Service Provider API

And the issue is sometimes our private API gets slow, nealy for 56 sec. Is there any way we can improve our API performance, in this manner.

  • Are you collecting timings to figure out which dependency behind the private API is causing the slowdown? Is it the logging, the database, or AWS S3? You can't fix something if you don't know what is actually going wrong. – keithwill Jul 31 '22 at 14:45
  • Hello @keithwill-the-upvoter I get the time values for the operations mentioned above. The request to 3rd party API takes approximately 6s, and database saving takes 4/5 s According to this Third party API and DB savings are the drawbacks. – Chathurangika Aug 19 '22 at 04:22

1 Answers1

0

I think that the better way to solve the optimization problem is to put the logging and saving process in a SQS queue. You put the logic into a Lambda that its gonna be trigger from the queue with (n) request and response pairs to save and log. That will make the process async. If in any case you are trying to avoid extra request to the 3 third party API service I advice you to add a distributed memory like Redis to the mix and only searching the data in the RDS database when is not in the memory. That will allow you to increase the response time even in the public api