W
W
WebDev2020-07-13 11:38:22
Node.js
WebDev, 2020-07-13 11:38:22

What determines the maximum number of asynchronous requests and is it possible to send mail in this way?

Good afternoon!
There are about 120 thousand email addresses of visitors. Once a month we send out a newsletter through the sendgrid. At first I did it in php and the whole mailing took 8-10 hours. Then I rewrote the code to nodejs and now, due to asynchrony, the entire mailing takes place in 20-30 minutes.
I have a few questions:
1) As I understand it, unlike the php implementation, the nodejs code sends requests and does not wait for a response. The response comes asynchronously. But what do you spend 30 minutes on then? To establish a connection and send a request? That is, asynchrony only in the fact that we do not wait for a response?
2) What determines the speed of sending? Here I have 120,000 sent in 30 minutes. Can it be accelerated?
3) Is it correct to send mail like this? According to the data from the personal account of the sandgrid, it follows that all the letters seem to have been sent, but I am confused by the intensity of the requests. Although I did not find any information about the limits on encumbrances from them.

Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2020-07-13
@Sanasol

How can one discuss implementation differences if neither of the two implementations is visible.
But all the same, in both cases, one process works for you and sends in turn. And it works slowly.
Google Gearman/Beanstalkd/RabbitMQ
If you raise several workers for sending, then the speed will increase by N times.
Usually by the number of processor cores/threads on the server.
If you send in batches , then it will be even faster, there you can even not raise the workers, it depends on the implementation of the mailing specifically.

V
Vitaly, 2020-07-13
@vshvydky

https://nodejs.org/api/cli.html#cli_uv_threadpool_... try to play with this parameter, in theory all network communications go on the c layer and are performed in libuv threads, by default there are only 4 of them, expands to 1024

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question