Improving the email notification system in ScholarX platform

When the Current system needs to send email notifications it waits until all emails deliver then send’s the response to the front-end, the problem is it takes at least 5 seconds to send an email to one email account and get a response if there are 500 accounts to send it will take at least 41 minutes to get a response from the server.

These are the possible alternatives I found to overcome the above problem.

  1. Sendgrid or another email service that provides an API (instead of SMTP)
  2. Multi-threading

Using an email service like Sendgrid will reduce this problem and improve server performance because it uses API calls instead of SMTP. However, there is a daily threshold in most of the services (in free versions). It’s 500 per day in Send grid. There’s a possibility that we might exceed that limit because ScholarX sends bulk emails when there’s a state change. Therefore, it might not a good solution to address the problem.

If we use multi-threading it will improve the response speed of the same implementation. I’ve implemented a thread into a single state as a proof of concept. Here are the results,

The current response speed of the current implementation,

If we use Threads,

I tested these with three accounts registered as mentors for both scenarios, it took around 17.87 seconds to get a response from the server, after I added a separate thread to send emails, it only took 40.1ms to get repones from the server, according to these results, if we use multithreading in the current implementation, it will improve the response speed of the current implementation by 97.6471%.

7 Likes

This is impressive!!

+500 from me!

Hey, @EngTeam look at this! :partying_face:

OMG! This is quite impressive.

WOW, This is amazing @Dilshan_Naveen
:heart_eyes:
Waiting for the PR, Itching to test the app with these performances

This is wonderful @Dilshan_Naveen Good job! :raised_hands:

@DevTeam, thanks everyone

2 Likes

Thanks for getting this done, @Dilshan_Naveen! Could you please point the PR to the “development” branch?

sure @jaye, can you check now

Excellent work, Dilshan! We’re fortunate to have an innovator and creative such as you in our midst. I believe your work will bring joy to many people in the future through ScholarX! :hugs:

Thanks, @jaye :grinning::grinning::grinning:

Welcome, Dilshan!

Make sure to write a blog on what you have done.

already working on that ! :grinning::grinning::grinning::grinning:

1 Like