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

  • SEARCH
  • Home
  • 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 8628451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:32:50+00:00 2026-06-12T08:32:50+00:00

I’m currently writing a program which reads a short string from a (potentially large)

  • 0

I’m currently writing a program which reads a short string from a (potentially large) number of sources as frequently as every second. I need to be able to write this data to separate files, and I was hoping for some guidance on the most efficient way to do this.

My current implementation queues the data, and flushes it when the queue exceeds a certain size.

Is there a better approach? In C#, are there any IO constructs that are particularly efficient?

EDIT: By large, I believe the “reasonable” maximum would be ~100 data sources, but it could be several hundred in the worst case.

  • 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-12T08:32:51+00:00Added an answer on June 12, 2026 at 8:32 am

    You will have to define “large” to get the best answer. You don’t really need your own queue. The .NET Framework’s BufferedStream is quite efficient

    http://msdn.microsoft.com/en-us/library/3dsccbf4.aspx

    http://msdn.microsoft.com/en-us/library/system.io.bufferedstream.write.aspx

    If “large” does not approach the maximum number of file handles the OS permits, you can simply leave the files open (set sharing as needed if other processes have to access them while you are writing them). That will avoid the overhead of opening each file once per second.

    Make sure, whatever buffering approach you use, that you do not buffer more data than you are prepared to lose in the event of a power outage or other system failure.

    If you cannot accept data loss, you can immediately write each string to the file (without any buffering) and instead use a disk controller with a write cache and battery backup.

    UPDATE

    100 data sources is far below the maximum number of open files for any OS that runs .Net. You should be fine just opening the files and leaving them open until you are done with them.

    For an interesting read on the limits on the number of handles in Windows see

    http://blogs.technet.com/b/markrussinovich/archive/2009/09/29/3283844.aspx

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a text area in my form which accepts all possible characters from
I am currently running into a problem where an element is coming back from
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

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.