Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #30802 > unrolled thread

Multithreaded disk access

Started byDon Y <blockedofcourse@foo.invalid>
First post2021-10-15 07:08 -0700
Last post2021-10-18 11:58 +1100
Articles 3 on this page of 23 — 6 participants

Back to article view | Back to comp.arch.embedded


Contents

  Multithreaded disk access Don Y <blockedofcourse@foo.invalid> - 2021-10-15 07:08 -0700
    Re: Multithreaded disk access Richard Damon <Richard@Damon-Family.org> - 2021-10-15 11:38 -0400
      Re: Multithreaded disk access Don Y <blockedofcourse@foo.invalid> - 2021-10-15 09:00 -0700
        Re: Multithreaded disk access Richard Damon <Richard@Damon-Family.org> - 2021-10-15 12:48 -0400
          Re: Multithreaded disk access Don Y <blockedofcourse@foo.invalid> - 2021-10-15 11:40 -0700
    Re: Multithreaded disk access Dimiter_Popoff <dp@tgi-sci.com> - 2021-10-15 18:46 +0300
      Re: Multithreaded disk access Don Y <blockedofcourse@foo.invalid> - 2021-10-15 09:19 -0700
        Re: Multithreaded disk access Dimiter_Popoff <dp@tgi-sci.com> - 2021-10-15 19:28 +0300
    Re: Multithreaded disk access Brett <ggtgp@yahoo.com> - 2021-10-17 20:27 +0000
      Re: Multithreaded disk access Don Y <blockedofcourse@foo.invalid> - 2021-10-17 14:49 -0700
        Re: Multithreaded disk access Don Y <blockedofcourse@foo.invalid> - 2021-10-17 15:01 -0700
        Re: Multithreaded disk access Dimiter_Popoff <dp@tgi-sci.com> - 2021-10-18 01:09 +0300
          Re: Multithreaded disk access Don Y <blockedofcourse@foo.invalid> - 2021-10-18 08:05 -0700
            Re: Multithreaded disk access Dimiter_Popoff <dp@tgi-sci.com> - 2021-10-18 19:25 +0300
              Re: Multithreaded disk access Don Y <blockedofcourse@foo.invalid> - 2021-10-18 13:46 -0700
                Re: Multithreaded disk access Dimiter_Popoff <dp@tgi-sci.com> - 2021-10-19 00:46 +0300
                  Re: Multithreaded disk access Don Y <blockedofcourse@foo.invalid> - 2021-10-18 16:17 -0700
                  Re: Multithreaded disk access antispam@math.uni.wroc.pl - 2021-10-31 19:21 +0000
                    Re: Multithreaded disk access Dimiter_Popoff <dp@tgi-sci.com> - 2021-10-31 21:55 +0200
                Re: Multithreaded disk access Don Y <blockedofcourse@foo.invalid> - 2021-10-25 04:19 -0700
                  Re: Multithreaded disk access Richard Damon <Richard@Damon-Family.org> - 2021-10-25 20:23 -0400
                    Re: Multithreaded disk access Don Y <blockedofcourse@foo.invalid> - 2021-10-25 22:29 -0700
        Re: Multithreaded disk access Clifford Heath <no.spam@please.net> - 2021-10-18 11:58 +1100

Page 2 of 2 — ← Prev page 1 [2]


#30872

FromRichard Damon <Richard@Damon-Family.org>
Date2021-10-25 20:23 -0400
Message-ID<2UHdJ.2$452.1@fx22.iad>
In reply to#30850
On 10/25/21 7:19 AM, Don Y wrote:
> On 10/18/2021 1:46 PM, Don Y wrote:
>>> I think this will give you plenty of an idea how to go about it.
>>> Once you know the limit you can run at some reasonable figure
>>> below it and be happy. Getting more precise figures about all
>>> that is neither easy nor will it buy you anything.
>>
>> I suspect "1" is going to end up as the "best compromise".  So,
>> I'm treating this as an exercise in *validating* that assumption.
>> I'll see if I can salvage some of the performance monitoring code
>> from the sanitizer to give me details from which I might be able
>> to ferret out "opportunities".  If I start by restricting my
>> observations to non-destructive synthetic loads, then I can
>> pull a drive and see how it fares in a different host while
>> running the same code, etc.
> 
> Actually, '2' turns out to be marginally better than '1'.
> Beyond that, its hard to generalize without controlling some
> of the other variables.
> 
> '2' wins because there is always the potential to make the
> disk busy, again, just after it satisfies the access for
> the 1st thread (which is now busy using the data, etc.)
> 
> But, if the first thread finishes up before the second thread's
> request has been satisfied, then the presence of a THIRD thread
> would just be clutter.  (i.e., the work performed correlates
> with the number of threads that can have value)

Actually, 2 might be slower than 1, because the new request from the 
second thread is apt to need a seek, while a single thread making all 
the calls is more apt to sequentially read much more of the disk.

The controller, if not given a new chained command, might choose to 
automatically start reading the next sector of the cylinder, which could 
be likely the next one asked for.

The real optimum is likely a single process doing asynchronous requests 
queuing up a series of requests, and then distributing the data as it 
comes in to processing threads to do what ever crunching needs to be done.

These threads then send the data to a single thread that does 
asynchronous writes of the results.

You can easily tell if the input or output processes are I/O bound or 
not and use that to adjust the number of crunching threads in the middle.

[toc] | [prev] | [next] | [standalone]


#30874

FromDon Y <blockedofcourse@foo.invalid>
Date2021-10-25 22:29 -0700
Message-ID<sl83op$per$1@dont-email.me>
In reply to#30872
On 10/25/2021 5:23 PM, Richard Damon wrote:
> On 10/25/21 7:19 AM, Don Y wrote:
>> On 10/18/2021 1:46 PM, Don Y wrote:
>>>> I think this will give you plenty of an idea how to go about it.
>>>> Once you know the limit you can run at some reasonable figure
>>>> below it and be happy. Getting more precise figures about all
>>>> that is neither easy nor will it buy you anything.
>>>
>>> I suspect "1" is going to end up as the "best compromise".  So,
>>> I'm treating this as an exercise in *validating* that assumption.
>>> I'll see if I can salvage some of the performance monitoring code
>>> from the sanitizer to give me details from which I might be able
>>> to ferret out "opportunities".  If I start by restricting my
>>> observations to non-destructive synthetic loads, then I can
>>> pull a drive and see how it fares in a different host while
>>> running the same code, etc.
>>
>> Actually, '2' turns out to be marginally better than '1'.
>> Beyond that, its hard to generalize without controlling some
>> of the other variables.
>>
>> '2' wins because there is always the potential to make the
>> disk busy, again, just after it satisfies the access for
>> the 1st thread (which is now busy using the data, etc.)
>>
>> But, if the first thread finishes up before the second thread's
>> request has been satisfied, then the presence of a THIRD thread
>> would just be clutter.  (i.e., the work performed correlates
>> with the number of threads that can have value)
> 
> Actually, 2 might be slower than 1, because the new request from the second 
> thread is apt to need a seek, while a single thread making all the calls is 
> more apt to sequentially read much more of the disk.

Second thread is another instance of first thread; same code, same data.
So, it is just "looking ahead" -- i.e., it WILL do what the first thread
WOULD do if the second thread hadn't gotten to it, first!  The strategy
is predicated on tightly coupled actors so they each can see what
the other has done/is doing.

If the layout of the object that thread 1 is processing calls for
a seek, then thread 2 will perform that seek as if thread 1 were to
do it "when done chewing on the past data".

If the disk caches data, then thread 2 will reap the benefits of
that cache AS IF it was thread 1 acting later.

Etc.

A second thread just hides the cost of the data processing.

> The controller, if not given a new chained command, might choose to 
> automatically start reading the next sector of the cylinder, which could be 
> likely the next one asked for.
> 
> The real optimum is likely a single process doing asynchronous requests queuing 
> up a series of requests, and then distributing the data as it comes in to 
> processing threads to do what ever crunching needs to be done.
> 
> These threads then send the data to a single thread that does asynchronous 
> writes of the results.
> 
> You can easily tell if the input or output processes are I/O bound or not and 
> use that to adjust the number of crunching threads in the middle.
> 

[toc] | [prev] | [next] | [standalone]


#30814

FromClifford Heath <no.spam@please.net>
Date2021-10-18 11:58 +1100
Message-ID<16aefa205d03a2f0$1$3155485$e8dde262@news.thecubenet.com>
In reply to#30811
On 18/10/21 8:49 am, Don Y wrote:
> On 10/17/2021 1:27 PM, Brett wrote:
>> Don Y <blockedofcourse@foo.invalid> wrote:
>>> As a *rough* figure, what would you expect the bandwidth of
>>> a disk drive (spinning rust) to do as a function of number of
>>> discrete files being accessed, concurrently?
>>>
>>> E.g., if you can monitor the rough throughput of each
>>> stream and sum them, will they sum to 100% of the drive's
>>> bandwidth?  90%?  110?  etc.
>>>
>>> [Note that drives have read-ahead and write caches so
>>> the speed of the media might not bleed through to the
>>> application layer.  And, filesystem code also throws
>>> a wrench in the works.  Assume caching in the system
>>> is disabled/ineffective.]
>>>
>>> Said another way, what's a reasonably reliable way of
>>> determining when you are I/O bound by the hardware
>>> and when more threads won't result in more performance?
>>
>> Roughly speaking a drive spinning at 7500 rpm divided by 60 Is 125
>> revolutions a second and a seek takes half a revolution and the next file
>> is another half a revolution away on average

> For a 7200 rpm (some are as slow as 5400, some as fast as 15K) drive,
> AVERAGE rotational delay is 8.3+ ms/2 = ~4ms.
> I.e., looking at the disk's specs is largely useless unless you know how
> the data on it is laid out.

> And, for writes, shingled drives throw all of that down the toilet.

Modern drives do so much caching and bad-sector reassignment that your 
physical intuition isn't likely to be of much help in any case. 
Typically there will be many full-track caches and a full RTOS running 
I/O scheduling using head kinematics. It is incredibly sophisticated and 
unlikely to yield to any trivial rotational analysis.

Clifford Heath

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.arch.embedded


csiph-web