tag:help.beatunes.com,2009-07-24:/discussions/problems/43224-empty-task-queue-but-still-sending-commands-to-itunesbeaTunes: Discussion 2015-03-02T20:59:04Ztag:help.beatunes.com,2009-07-24:Comment/361494052015-02-27T07:18:02Z2015-02-27T07:18:02ZEmpty task queue but still sending commands to iTunes<div><blockquote>
<p>I've a Mac Pro with 6 cores (12 threads) with 4 parallel tasks
set I saw no more that 33% on one core being used but the GUI was
very laggy. I set the value to 10 the task queue reflected this,
the CPU usage was OK, no where near pushing the MacPro but the
beaTunes GUI was painfully slow.</p>
<p>Maybe it's time to detach the GUI from the rest of the
application.</p>
</blockquote>
<p>Unfortunately, beaTunes still has to obey <a href=
"http://en.wikipedia.org/wiki/Amdahl's_law">Amdahl's law</a>.</p>
<p>While large parts of the analysis can be detached from the GUI,
both analysis and GUI share some resources—and that limits
how much both can be decoupled.</p>
<p>The central resources they share is the database and indirectly
the file system. Most UI operations require loading data from the
database, which is shared. The database in turn has to load from
the filesystem. During analysis, tasks are taken from the database,
then the filesystem is accessed (a lot) to load the audio data, and
then the results still have to be written to the database and
communicated to iTunes, which in turn accesses the filesystem to
write results. So overtime we are accessing the database or the
filesystem, we run into a bottleneck, because beaTunes has to use
shared resources.</p>
<blockquote>
<p>Q. Visually the app has finished (no Dock counter, empty task
queue) but I can see in the console, beaTunes4 is still sending
script commands to iTunes. This means beaTunes has not finished, so
why does the app give the impression it is done!!!</p>
</blockquote>
<p>In order to decouple UI, database, etc. beaTunes communicates
changes to iTunes asynchronously as much as possible. The same is
true for changing something in files, if <a href=
"http://blog.beatunes.com/2013/10/so-where-exactly-does-beatunes-store.html">
embedding is on</a>. The reason for this is that communicating with
iTunes is slow and <em>must</em> only happen on the main thread
(the underlying OS X code for AppleScript is not thread safe). So
beaTunes serializes the calls and runs them in the background.</p>
<p>I'm sure you have seen the <em>recommended</em> number of
parallel threads in the UI somewhere and it's probably something
like 3 (even though you have more cores and hyper threading claims
to do even more for you). The reason why I recommend a rather low
number of parallel tasks is that you may be able to
<em>analyze</em> more files in parallel (if your hard drive can
keep up), but writing the data and keeping the UI usable becomes
harder and harder the more parallel tasks you run, because there's
always some code paths that require serialization. Also, each
additional thread requires more memory. With more threads you may
run out of memory eventually (<a href=
"http://help.beatunes.com/kb/troubleshooting/manually-changing-the-beatunes-memory-configuration-on-os-x">which
can be adjusted</a>).</p>
<p>Another reason not to increase parallel tasks too much has to do
with analysis options. If you check an analysis option that uses
<em>online resources</em> or the Internet in any way, you
introduced another limiting factor. More about options <a href=
"http://blog.beatunes.com/2015/01/audio-analysis-options-explained.html">
here</a>. Then more threads won't help at all.</p>
<blockquote>
<p>What I imagined is, "Leave beaTunes running in the background, I
can continue with what ever else I have to do and when it finishes
I will continue to use beaTunes."</p>
<p>Right now it's been just over 90mins since beaTunes finished
everything in the task list, but it continues to talk with iTunes
and the application is unusable due to GIU lag.</p>
</blockquote>
<p>This was with 4 parallel tasks?<br>
How much of the CPU and file I/O was iTunes using at that time?<br>
Were other applications responsive?</p>
<blockquote>
<p>As I said maybe it's time to detach the GUI from the rest of the
application.</p>
</blockquote>
<p>It is to a large degree.</p>
<p>Out of interest:<br>
How many songs are in your library?<br>
Where are they stored? Internal SSD?</p>
<p>Anyhow—hope I explained to a degree what's happening.</p>
<p>Cheers,</p>
<p>-hendrik</p></div>hendriktag:help.beatunes.com,2009-07-24:Comment/361494052015-02-28T16:08:57Z2015-02-28T16:08:57ZEmpty task queue but still sending commands to iTunes<div><p>Hi,</p>
<p>Thanks for the details.</p>
<p>My iTunes library of just over 5,000 tracks is on a NAS on the
end of a point-to-point full duplex Gigabyte Ethernet connection.
There is ample bandwidth and looking at the traffic at the time it
was not using much at all. In the near future I will move the
library onto a SAS RAID directly attached to my MacPro that will
average around 180 Megabytes per second. But no right now as I have
plenty of work that needs to be done.</p>
<p>The first Analysis of my whole library took a while and did not
seem to push both my CPUs and network at all. But after since the
initial run, CPU usage has increased dramatically. I would have
thought this would not have been the case but I will get used to
beaTunes. I returned the number of 'Parallel Tasks’ to 4, and
I’ll not fiddle with that one again.</p>
<p>I think most of my questions was from a first-time-user
perspective, and I’ve started to get used to how your
application works.</p>
<p>I have to say it’s the most comprehensive iTunes
application I’ve found with some real deep thought in the
work behind the GUI.</p>
<p>1) A more accurate progress bar or status of what’s going
on in the background. So users are not left wondering why the GIU
is no responsive.<br>
2) Fix the issue where the application insists displaying the art
work of the first album in the iTunes Library, and eventually
showing the normal window.</p>
<p>Tim,</p></div>molestranglertag:help.beatunes.com,2009-07-24:Comment/361494052015-03-02T20:59:03Z2015-03-02T20:59:03ZEmpty task queue but still sending commands to iTunes<div><p>Hey Tim,</p>
<blockquote>
<p>I have to say it’s the most comprehensive iTunes
application I’ve found with some real deep thought in the
work behind the GUI.</p>
</blockquote>
<p>Thank you.</p>
<blockquote>
<p>Fix the issue where the application insists displaying the art
work of the first album in the iTunes Library, and eventually
showing the normal window.</p>
</blockquote>
<p>I'm nut sure I fully understand. Can you please describe the
problem in detail?</p>
<p>Thanks,</p>
<p>-hendrik</p></div>hendrik