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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:11:48+00:00 2026-05-28T06:11:48+00:00

I have some 2TB read only (no writing once created) files on a RAID

  • 0

I have some 2TB read only (no writing once created) files on a RAID 5 (4 x 7.2k @ 3TB) system.

Now I have some threads that wants to read portions of that file.
Every thread has an array of chunks it needs.
Every chunk is addressed by file offset (position) and size (mostly about 300 bytes) to read from.

What is the fastest way to read this data.
I don’t care about CPU cycles, (disk) latency is what counts.
So if possible I want take advantage of NCQ of the hard disks.

As the files are highly compressed and will accessed randomly and I know exactly the position, I have no other way to optimize it.

  • Should I pool the file reading to one thread?
  • Should I keep the file open?
  • Should every thread (maybe about 30) keep every file open simultaneously, what is with new threads that are coming (from web server)?
  • Will it help if I wait 100ms and sort my readings by file offsets (lowest first)?

What is the best way to read the data? Do you have experiences, tips, hints?

  • 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-28T06:11:48+00:00Added an answer on May 28, 2026 at 6:11 am

    The optimum number of parallel requests depends highly on factors outside your app (e.g. Disk count=4, NCQ depth=?, driver queue depth=? …), so you might want to use a system, that can adapt or be adapted. My recommendation is:

    • Write all your read requests into a queue together with some metadata that allows to notify the requesting thread
    • have N threads dequeue from that queue, synchronously read the chunk, notify the requesting thread
    • Make N runtime-changeable
    • Since CPU is not your concern, your worker threads can calculate a floating latency average (and/or maximum, depending on your needs)
    • Slide N up and down, until you hit the sweet point

    Why sync reads? They have lower latency than ascync reads.
    Why waste latency on a queue? A good lockless queue implementation starts at less than 10ns latency, much less than two thread switches

    Update: Some Q/A

    Should the read threads keep the files open? Yes, definitly so.

    Would you use a FileStream with FileOptions.RandomAccess? Yes

    You write “synchronously read the chunk”. Does this mean every single read thread should start reading a chunk from disk as soon as it dequeues an order to read a chunk? Yes, that’s what I meant. The queue depth of read requests is managed by the thread count.

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

Sidebar

Related Questions

I have some external Javascript files in my GWT app that I only want
We have some files on our website that users of our software can download.
Have some audio and video files that users are to download, however depending on
I have some UI in VB 2005 that looks great in XP Style, but
We have some input data that sometimes appears with &nbsp characters on the end.
I have some code like this in a winforms app I was writing to
Have some data in a sybase image type column that I want to use
I have some code that can convert a single color in a template image
I have some intl characters in a field that django is returning as a
Have some users in Liferay 4.4.2 that are currently active, all having valid passwords.

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.