Report
I know cache system and sql/db query optimisation but apart from these two, what else did you do to speed up response time of your APIs? Please share your experiences.
It will be helpful for all of us. ๐
Forget about changing framework or language. Consider using New Relic or something like this to track every time consuming activity on your application. Also I would consider using db indexes, and compare queue against async/await flows, what works better in each situation. Algorithm optimization takes bigger place than language and framework in terms of time consuming.
Hi @SpecterSpy, DB indexes helped me a lot to make a difference. I will surely look into optimising algorithm. Any links to share if you have? Thanks
@nitin_k The book Refactoring, by Martin Fowler.
This comment was deleted 2 years ago.
The biggest method for me is to "do everything at the same time".
Suppose you want to handle signing up and you want to do the following:
Most people do them in order. I would (I use nodejs) use -> await Promise.all().
I would simply pass the array of all promises into Promise.all so everything is done at the same time instead of awaiting each one.
That is the way I speed things up.
Hi @Virock,
I tried so many things at other major changes like db, those were working but impact was in code.
Your suggestion really helped me as i am doing all the operations parallelly, god bless you!
Hi @Virock thanks this seems to be good!
Can you share any example/github so i can check the implementation?
Some ideas that come to my mind:
Hope this helps!
Hey @eyalzh thanks for writing.
Yes it will surely help.
I will surely check for point 3 & 4.
There are a couple of tips for reducing the API response time.
Response time also depends on hosting/cloud plan and location of user.
Usually not caching, missing database indexes, and/or calling external APIs are the top bottlenecks for most applications.
For me, it's always using a faster language. Golang to be precise. Between 50 - 500x.
What stack are you using? Do you know where your bottle neck is? Are you doing some processing before returning the data? I'd start with these questions to be able to give you a direction of where to look
Hi @0xconstantin, thanks for responding.
stack: node js + mongodb
Yes i am making smtp connections.
Most time consuming part for my api is SMTP connection.
I am trying to figure out how to speed up this.
Is there no possibility to run that connection in a background task?
I have been thinking of handling it in multiple smtp connections to distribute load. Will it work?
It is a possibility, could you describe a little bit the flux of this API and SMTP connection? I feel like a doctor asking questions to get a diagnostic ๐
Outbound, or inbound?
Outbound..
This comment was deleted 2 years ago.