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 8332731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:48:22+00:00 2026-06-09T02:48:22+00:00

I wrote some code that mass imports a high volume of users into AD.

  • 0

I wrote some code that mass imports a high volume of users into AD. To refrain from overloading the server, I put a thread.sleep() in the code, executed at every iteration.

Is this a good use of the method, or is there a better alternative (.NET 4.0 applies here)?

Does Thread.Sleep() even aid in performance? What is the cost and performance impact of sleeping a thread?

  • 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-06-09T02:48:23+00:00Added an answer on June 9, 2026 at 2:48 am

    I think that Thread.Sleep is one way to handle this; @cHao is correct that using a timer would allow you to do this in another fashion. Essentially, you’re trying to cut down number of commands sent to the AD server over a period of time.

    In using timers, you’re going to need to devise a way to detect trouble (that’s more intuitive than a try/catch). For instance, if your server starts stalling and responding slower, you’re going to continue stacking commands that the server can’t handle (which may cascade in other errors).

    When working with AD I’ve seen the Domain Controller freak out when too many commands come in (similar to a DOS attack) and bring the server to a crawl or crash. I think by using the sleep method you’re creating a manageable and measurable flow.

    In this instance, using a thread with a low priority may slow it down, but not to any controllable level. The thread priority will only be a factor on the machine sending the commands, not to the server having to process them.

    Hope this helps; cheers!

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

Sidebar

Related Questions

I wrote some code that activity starts a service to get some text from
I have some python code that I wrote to convert a python list into
I wrote some MooTools code that reads from YouTube's API in JSON and I
For my first foray into python, I wrote some parsing code that works as
I've wrote some code that will check two dates - they are split into
I wrote some html/css/javascript code that was taken verbatim from a javascript textbook. For
I wrote some C code that serializes certain values into a file that is
I wrote some code to extract data from xls and save them into csv.
I wrote some code in VHDL that is expected to look at a rotory
I've got some code that lies in a browser, and wrote C++ plugins for

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.