Timeline for Using multithreading to send multiple emails
Current License: CC BY-SA 4.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 9, 2021 at 15:31 | comment | added | glenebob | I did some simple bench marking. OP's approach does not scale linearly with larger numbers of recipients, where as mine appears to be very linear. However, I was only able to make this comparison in a reasonable amount of time by using millions of recipients and by completely removing the delay. In the real world, performance will be affected overwhelmingly by email sending elapsed time. It would take hours to benchmark. With 10000 recipients and 50ms delay, performance is identical. | |
Jul 9, 2021 at 1:30 | comment | added | Jonathan Wood | @aepot: That comment mentioned you but was not directed at you, as evidenced by the fact that I marked your answer as the accepted answer. | |
Jul 8, 2021 at 23:30 | comment | added | aepot | Ok, but I'm not sure that avoiding the semaphore makes the code more efficient. Anyway I like the solution. Will make some benchmarks to ensure. | |
Jul 8, 2021 at 23:27 | comment | added | Jonathan Wood | Thanks for the example. I created a project from it and tested it out. In the end (and aside from the queue concurrency issue), it felt a little complex. With @aepot's approach, it seems to be working right by changing only one keyword. | |
Jul 8, 2021 at 23:20 | comment | added | glenebob | @aepot it probly doesn't matter. The queue is just there to support the task concurrency example I threw together. OP may not go that route. The important part is how to limit the number pf tasks without using a SemaphoreSlim. | |
Jul 8, 2021 at 23:17 | history | edited | glenebob | CC BY-SA 4.0 |
added 108 characters in body
|
Jul 8, 2021 at 23:16 | comment | added | aepot |
ConcurrentQueue may be faster than lock . Also you may update the text.
|
|
Jul 8, 2021 at 23:12 | history | edited | glenebob | CC BY-SA 4.0 |
Add lock { } in case of cross-threaded continuations.
|
Jul 8, 2021 at 23:08 | comment | added | glenebob | @aepot good point. Everything happens in one thread in this example, but you are correct that continuations may be scheduled on different threads depending on how the API was implemented. I'll edit to add a lock. | |
Jul 8, 2021 at 23:01 | comment | added | aepot |
Queue<string> isn't thread-safe and might be damaged if async calls performed not on single-threaded SynchronizationContext . everything happens on one thread I'm not sure if that's true.
|
|
Jul 8, 2021 at 22:40 | review | First posts | |||
Jul 9, 2021 at 3:36 | |||||
Jul 8, 2021 at 22:40 | history | answered | glenebob | CC BY-SA 4.0 |