• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Async writing to lots of files at the same time ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Async writing to lots of files at the same time ?


  • Subject: Re: Async writing to lots of files at the same time ?
  • From: Jeff Moore <email@hidden>
  • Date: Mon, 5 Dec 2005 15:34:20 -0800

I don't know that using asynchronous disk IO calls is necessarily going to help you. Presumably, you are already issuing the write calls from some work thread in your app (at least, you're not doing it from the IO thread). So your disk IO is _already_ asynchronous from the audio hardware's point of view. Using a different API that shuffles the work off to yet another work thread is probably not going to get you back any performance.

Also, consider that if all 128 files live on the same disk, you are necessarily going to bottleneck everything through that disk's driver. Most disk controllers can only handle one transaction at a time, so even with asynch IO, it all gets single threaded eventually no matter what API you use.

Here are some things to look at that don't involve calling FSWriteAsynch():
- Is the disk IO thread's priority high enough to get time but not so high as to cause starvation on other important threads? For example, if you are using a normal priority thread, there's a good chance that excessive work on it might disrupt the main thread and your app's event handling.


- Are you doing cached writes and if so, can you you get away with uncached writes? Needless to say, if you aren't going to look at the recorded data again immediately after putting it on disk, there's no reason to push the data through the cache.

- Are your disk writes all page aligned in both size and offset in the file? Even if you are using uncached writes, you can still end up going through the cache if your writes are totally page aligned (that is, 4096 bytes). For maximum performance, both the amount of data being written and the offset in the file being written to need to be page aligned. Non-aligned writes end up getting cached.

- Are your disk writes too small or too large? Writes that are too small end up adding lots of overhead. Writes that are too large can either overflow the disk mechanism's memory or just take a really long time. Both situations can be detrimental to app performance.

Hope this helps.


On Dec 5, 2005, at 3:00 PM, Mark Gilbert wrote:

Folks.

I need to continuously write data into 128 open files at the same time.

Currently I write one after the other, but I wonder if its worth putting in code to make each write Asynchronous.

Currently the storage aspect is pulling my app down, and so I want to 'smoothen' out the impact disk writing has on the overall operation of my app.

Is Async disk writing a good idea ? Some people have suggested putting the disk writes into another thread (currently on my main thread). I am keen to avoid it impacting on my Core Audio IO Proc which is running on another thread, and can sometimes be pulled down by the disk access.

How would the system deal with 128 async writes. Is this likely to cause problems, or make things better ?


--

Jeff Moore
Core Audio
Apple


_______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Async writing to lots of files at the same time ? (From: Mark Gilbert <email@hidden>)

  • Prev by Date: Re: Async writing to lots of files at the same time ?
  • Next by Date: Re: Help: About Input Volume
  • Previous by thread: Re: Async writing to lots of files at the same time ?
  • Next by thread: ReflectorDriver
  • Index(es):
    • Date
    • Thread