Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7634511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:11:45+00:00 2026-05-31T07:11:45+00:00

We are currently sending emails to users asynchronoulsy using the ThreadPool. Essentially, we have

  • 0

We are currently sending emails to users asynchronoulsy using the ThreadPool. Essentially, we have logic that comes down to this:

for (int i=0 < i < numUsers; i++) 
{

   //Pre email processing unrelated to sending email

   string subject = GetSubject();
   string message = GetMessage();
   string emailAddress = GetEmailAddress();

   EmailObj emailObj = new EmailObj { subject = subject, message = message, emailAddress = emailAddress };

   bool sent = ThreadPool.QueueUserWorkItem(new WaitCallback(SendEmail), emailObj);

   //Post email processing unrelated to sending email
}

public void SendEmail(object emailObj)
{
    //Create SMTP client object
    SmtpClient client = new SmtpClient(Configuration.ConfigManager.SmtpServer);

    //Logic to set the subject, message etc
    client.Send(mail);
}

The logic works great so far with a low number of users. We are trying to scale this to be able to send a million or so emails.

Per MSDN, the maximum number of thread pool threads is based on memory and according to this SO answer, for a 64 bit architecture, it appears that the maximum number of thread pool threads is 32768.

Does this mean, that as long as the number of emails we send out at a time is < 32768, we should be fine? What happens when this number is exceeded? What happens when the SMTP service is turned off or there’s a delay in sending an email, will the thread pool thread wait until the email is sent?

When the number of threads exceed the threshold, does the section marked //Post email processsing unrelated to sending email get executed at all?

Any explanations are really appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:11:47+00:00Added an answer on May 31, 2026 at 7:11 am

    Threads have overhead – 1MB of thread local storage. You would never want to have 32K threads in your thread pool. A thread pool is used to gate and share threads because they have overhead. If the thread pool gets saturated, future calls are queued and wait for an available thread in the pool.

    Another thing to consider is SMTP servers are asynchronous (drop in outbound folder). Also, as someone above mentioned, it can be a bottle neck.

    One option is to increase the throughput by increasing the number of ‘agents’ sending mails and increase the number of SMTP servers to scale out the solution. Being able to independently scale out the agents and the SMTP servers allows you to address the bottleneck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have users sending emails with some text I need to extract. Each user's
I'm currently running a web-app that will send emails to users when they sign-up,
A have ASP.NET 2.0 web application that should allow sending emails. I have a
I have a web application that currently sends emails. At the time my web
I currently have a Palm WebOS application that uses an Ajax.Request to connect to
I currently have a client website on the Grid server on MediaTemple that will
The project that I'm currently working on, is large scale. I'm using email activation
Currently I'm using the Java mail library at http://www.jondev.net/articles/Sending_Emails_without_User_Intervention_(no_Intents)_in_Android to accomplish this; however I
I'm trying to send email to my site users (ASP.NET, VS2010), currently I'm using
I have currently written code to send an email in C# using the usual

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.