Use persistent HTTP requests by default.#109
Conversation
Using persistent HTTP requests (Connection: Keep-Alive) allows to send messages four to five times faster.
There was a problem hiding this comment.
Why do we want to ignore timeout for persistent requests?
There was a problem hiding this comment.
I'm launching a non-persistent call as a fall-back when the persistent call fails (timeout).
That's why I'm ignoring the error.
But I agree that it looks a bit odd...
There was a problem hiding this comment.
Perhaps the comment could be Timeout on persistent request, falling back to non-persistent request.
Btw, will falling back to non-persistent requests going to help?
|
I updated the comment. About the fall-back, I don't really know how Sendgrid servers react when there are too much hanging (persistent) requests at the same time. The servers could refuse new persistent requests and still accept the non-persistent ones, knowing that non-persistent requests usually release server resources faster. |
|
Hello @yoeo! Thank you very much for this update! We will not be adding this to the core library; however, we suggest you create a helper once we get that feature up, you can track progress here: #169 That said, we love the fact you took the time to create this and we want to swag you out. Please shoot us an email at [email protected] :) For now, I'd suggest creating a sub-class and perhaps writing up your implementation. I'd be happy to support that blog post with some Twitter love. Thanks again! |
Using persistent HTTP requests (Connection: Keep-Alive) allows to send messages four to five times faster.
Benchmark result with 10 000 mails sent with a persistent connections (Connection: Keep-Alive), and 10 000 other mails sent with "normal" connections:
$ python test_benchmark_10k_mails.py
persistent . . . . . . . . . .
nonpersistent . . . . . . . . . .
duration_persistent = 242.951007 sec
duration_nonpersistent = 1227.724485 sec
messages sent 5.053383 times faster with persistence
Benchmark code here: http://pastebin.com/5mSu452V