By default, the swap file is created on the boot volume at OS X startup.
It it is possible to get OS X to place the swap file on another drive,
however. I placed instructions for doing this on my site a while back,
based on direct feedback from Jim Magee, a fellow on the OS X team at
Apple:
http://www.blakespot.com/swap/
So right now I have two internal drives in my dual G4 800. They are
spec'ed as such:
- IBM Deskstar 60GXP
- 7200 RPM
- 2MB cache
- My OS X boot volume
- IBM Deskstar 40GV
- 5400 RPM
- 512K cache
- OS 9 boot volume / data drive
I presently have a 2GB partition on the slower drive set aside only for
swap. OS X is presently configured to write its swap files there. It
is a slower drive, to be sure, than the 60GXP, but it is a separate
physical drive from the OS X install. I realize under SCSI, there would
more advantage to a setup like this -- but I wonder, is this the way to
go?
Would swapping be faster done on the internal, faster drive, even though
it is the same volume as OS X itself, or am I indeed gaining overall
effiicency using a separate, albeit slower, drive for swap?
I ask because my machine is in for service (CD drive issues) and when I
bring it back and re-setup the machine, it is a good time to decide if
it's wise to switch my config.
Thanks!
bp
> Would swapping be faster done on the internal, faster drive, even though
> it is the same volume as OS X itself, or am I indeed gaining overall
> effiicency using a separate, albeit slower, drive for swap?
Imo you're in the noise here. Once the system starts paging, the
performance will be unpleasant regardless of where the swap files are
located. Moving them to an unfragmented volume will only buy you a
tiny improvement. I doubt you'll even notice the difference.
Buying more memory, otoh, will make a huge difference. Given the cost
of memory, this is really the way to go if your system is paging (of
course if it's not paging, the location of the swap files makes no
difference at all).
--
d f-d
As you say, with SCSI, there may be an advantage to having swap on a
separate spindle - utilising the extended SCSI commands implemented in
hardware on the host controller chip to "load-spread" may (at least in
theory) be advantageous.
With ATA (espcially if the 2 drives are on the same IDE channel) I
suspect you're better off just using the fastest drive. IDE/ATA is
"fast" but also "dumb" - uses more CPU cycles - but issues such as L2
CPU cache, drive cache complicate the matter and make it pretty hard to
"calculate". Well - for me anyway :-)
> I've had a hard time figuring out the best place for the Mac OS X swap
> file.
> I presently have a 2GB partition on the slower drive set aside only for
> swap. OS X is presently configured to write its swap files there.
OK, how much I/O do you do to this partition?
> It
> is a slower drive, to be sure, than the 60GXP, but it is a separate
> physical drive from the OS X install. I realize under SCSI, there would
> more advantage to a setup like this -- but I wonder, is this the way to
> go?
The "way to go" is to use the default method of allocating swap, in
conjunction with adequate memory.
> Would swapping be faster done on the internal, faster drive, even though
> it is the same volume as OS X itself, or am I indeed gaining overall
> effiicency using a separate, albeit slower, drive for swap?
Which is more "efficient" - 0 megabytes at X MB/sec or 0 megabytes at
Y MB/sec?
> I ask because my machine is in for service (CD drive issues) and when I
> bring it back and re-setup the machine, it is a good time to decide if
> it's wise to switch my config.
Hey, you're the expert - you've got a web page telling people how to do
this. Posters here have generally held that moving the swap partition is
a bad idea - it's not supported, offers non-trivial risk of data loss
(both during the initial reconfig and later, if the /dev/ devices change),
is likely to break when the OS is upgraded, and offers no measurable
improvement in performance.
But apparently your experience is different.
It seems to me that you are the ideal candidate (given that you plan
on reinstalling anyway) to test whether any performance gains can be
achieved by moving swap. Do let us know which of these two configurations
is faster, and how their performance compares to the default swap
mechanism...
--
Jim Glidewell
My opinions only
> I've had a hard time figuring out the best place for the Mac OS X swap
> file.
>
Run "top" from the console. If you have pageouts, that's bad. Buy more
memory. Devoting time and energy to clever rationalizations of where to
put the swap file, is like trying to figure out where on your car you
should put the flat tire. If you have one, you need to eliminate it,
not move it around.
>> I've had a hard time figuring out the best place for the Mac OS X swap
>> file.
>
>> I presently have a 2GB partition on the slower drive set aside only for
>> swap. OS X is presently configured to write its swap files there.
Well here's my two pence worth in the form of a question.
In an ideal world the swop file should not be fragmented which it will
become on the one spindle, so is there an advantage to having it on the
same fast spindle but on a seperate partition to prevent fragmentation?
Robin
> Run "top" from the console. If you have pageouts, that's bad. Buy more
> memory. Devoting time and energy to clever rationalizations of where to
> put the swap file, is like trying to figure out where on your car you
> should put the flat tire. If you have one, you need to eliminate it, not
> move it around.
I think you've spent too much time around Windows systems. Many BSD
variants don't act this way at all. FreeBSD, in particular, has an
extremely well-regarded virtual memory subsystem that begins swapping out
pages that haven't been accessed in a while whenever the system is sitting
idle. The logic is that by taking advantage of those still times for
routine housekeeping, the system maintains a large pool of physical RAM
ready for use if a task suddenly needs it.
As a real-world example, suppose that you haven't used the spell-check of
your word processor in 4 hours, and you're currently hacking around on some
very large images in Photoshop. Doesn't it make sense for the VM system to
swap out the blocks of memory holding your spell-checker in case Photoshop
suddenly allocates a huge chunk for a buffer?
Paging doesn't have quite the same stigma on Unix systems as it does on
other less well designed OSes.
--
Kirk Strauser
The Strauser Group - http://www.strausergroup.com/
What does fragmentation have to do with it? Do you think that the OS
swaps a group of pages in sequential fashion? Of course not. A large
fraction of page ins come directly from the application file's object
code file, those are never written out. Page outs occur pretty much as
a last resort -- when there are no read-only page candidates that could
be reclaimed. The bottom line is that I/O to the swap file(s) occurs to
random positions within the file and having a non-fragmented file won't
buy you a thing.
--
Tom Stiller
PGP fingerprint = 5108 DDB2 9761 EDE5 E7E3 7BDA 71ED 6496 99C0 C7CF
I seem to remember reading that same diatribe before.
And while I mostly agree with the upshot (Apple doesn't support
a swap partition, so I don't have one), I don't think all this is
as clearcut as you paint it, and Apple engineers certainly seem to
have a more balanced view of the reasons they set things up this way.
E.g.:
Having a swap partition makes sense at a technical level,
subject to the issues Dean mentioned, but there are product
and customer issues to consider as well. I don't think we
want to include "select a partition for your swap file" in
the setup instructions, at least at this juncture.
http://lists.apple.com/archives/darwin-development/2000/Sep/24/macosxbetakernelexceptio.004.txt
> Jim Glidewell wrote:
> > In article <blake-8ECAB5....@news.bellatlantic.net>, Blake Patterson <bl...@blakespot.com> wrote:
> >
> >
> >>I've had a hard time figuring out the best place for the Mac OS X swap
> >>file.
> >
> >
> > Hey, you're the expert - you've got a web page telling people how to do
> > this. Posters here have generally held that moving the swap partition is
> > a bad idea - it's not supported, offers non-trivial risk of data loss
> > (both during the initial reconfig and later, if the /dev/ devices change),
> > is likely to break when the OS is upgraded, and offers no measurable
> > improvement in performance.
> >
> > But apparently your experience is different.
>
>
> I seem to remember reading that same diatribe before.
Yeah, well I have little patience for people who advise others to
"tweak" their system in a way that invites disaster for a non-
existent performance boost.
> And while I mostly agree with the upshot (Apple doesn't support
> a swap partition, so I don't have one), I don't think all this is
> as clearcut as you paint it, and Apple engineers certainly seem to
> have a more balanced view of the reasons they set things up this way.
> E.g.:
>
> Having a swap partition makes sense at a technical level,
> subject to the issues Dean mentioned, but there are product
> and customer issues to consider as well. I don't think we
> want to include "select a partition for your swap file" in
> the setup instructions, at least at this juncture.
>
> http://lists.apple.com/archives/darwin-development/2000/Sep/24/macosxbetakernelexceptio.004.txt
The context in that thread has nothing to do with performance and
everything to do with where to (safely) put a system core dump or
similar debugging info in case of a kernel panic. *If* Apple chose
to implement such a scheme, then having a swap partition might make
some sense, at least for developers or others who would expect to
encounter multiple kernel panics.
If anybody can find a reference to anybody at Apple who actually
claims better OSX performance by establishing a separate swap
partition, I'll be glad to withdraw my previous comments.
A swap file is already so internally fragmented that the difference
caused by fragmentation at the file system level probably isn't going to
be measurable.
--
"My trip to Asia begins here in Japan for an important reason. It begins
here because for a century and a half now, America and Japan have formed
one of the great and enduring alliances of modern times. From that
alliance has come an era of peace in the Pacific."
- George W. Bush
>> Having a swap partition makes sense at a technical level,
>> subject to the issues Dean mentioned, but there are product
>> and customer issues to consider as well. I don't think we
>> want to include "select a partition for your swap file" in
>> the setup instructions, at least at this juncture.
>>
>>http://lists.apple.com/archives/darwin-development/2000/Sep/24/macosxbetakernelexceptio.004.txt
>
>
> The context in that thread has nothing to do with performance and
> everything to do with where to (safely) put a system core dump or
> similar debugging info in case of a kernel panic. <snip>
>
> If anybody can find a reference to anybody at Apple who actually
> claims better OSX performance by establishing a separate swap
> partition, I'll be glad to withdraw my previous comments.
The `context in that thread' is irrelevant to the above excerpt, which
is a *general remark* where the engineer tells you that 1) Apple's
reasons for not having a swapfile partition are *not* technical, and
2) there *are* legitimate reasons one might want to have one. And note
that nobody said that `performance' was the only possible reason. There
are others.
(Then he goes on to say that the contemplated dump scheme is not
among those reasons, under the current swap implementation, because
(unlike other *BSDs) it uses files and thus requires a still working
filesystem on the partition you'd use for swap. *That* is unrelated.)
> > In an ideal world the swop file should not be fragmented which it will
> > become on the one spindle, so is there an advantage to having it on the
> > same fast spindle but on a seperate partition to prevent fragmentation?
>
> A swap file is already so internally fragmented that the difference
> caused by fragmentation at the file system level probably isn't going to
> be measurable.
Actually, that's not true. If the swapfile is contguous,
then it exists on a very few tracks, all located very near
each other, so any portion of the file is accessible within
a very short seek, taking just a ms or so (plus a
half-rotation on average).
But if the swapfile is spread across several extents
on the disk, the seek may be full-stroke, implying
tens of ms. And (going out on a Unix limb here) if
the file is way fragmented, it may require an access
to file system metadata before accessing the actual
swapfile dat. *THAT* really stinks!
Atlant
> Jim Glidewell wrote:
>
> >> Having a swap partition makes sense at a technical level,
> >> subject to the issues Dean mentioned, but there are product
> >> and customer issues to consider as well. I don't think we
> >> want to include "select a partition for your swap file" in
> >> the setup instructions, at least at this juncture.
> >>
> >>http://lists.apple.com/archives/darwin-development/2000/Sep/24/macosxbetakernelexceptio.004.txt
> >
> >
> > The context in that thread has nothing to do with performance and
> > everything to do with where to (safely) put a system core dump or
> > similar debugging info in case of a kernel panic. <snip>
> >
> > If anybody can find a reference to anybody at Apple who actually
> > claims better OSX performance by establishing a separate swap
> > partition, I'll be glad to withdraw my previous comments.
>
>
> The `context in that thread' is irrelevant to the above excerpt, which
> is a *general remark* where the engineer tells you that 1) Apple's
> reasons for not having a swapfile partition are *not* technical, and
> 2) there *are* legitimate reasons one might want to have one. And note
> that nobody said that `performance' was the only possible reason. There
> are others.
I honestly don't attach the gravity that you do to that quote. What "makes
sense" for a Darwin developer doesn't necessary make sense for a shrink-
wrapped product. IMHO, the *primary* reason that OSX does not use a
swap partition is because it would require anyone with an existing
single-disk OS9 Mac to dump, repartition, and reload everything to
get to OSX. Once they had an implementation that didn't _require_
a swap partition, there was little reason to implement it as an
option, as the benefits it brings are minimal to the average user.
Is avoiding a dump, repartition, and reload for your customers
a "technical" reason? I wouldn't hazard a guess as to what your
answer might be...
The original poster in *this* thread specifically asked about the
relative performance of one swap partition scheme over another. I
have no particular reason to dislike swap partitions, and if Apple
*supported* them (for dump/debug info, etc.) I would probably use one.
There is nothing wrong with having a swap partition - *if* it is
a supported configuration.
My only contentions are that 1) swap partitions do not provide
better performance (though if someone provided a reasonable
benchmark indicating the opposite I would certainly reconsider
my position - and no, "bouncemarks" are not a reasonable
benchmark) and 2) swap partitions are not supported by
Apple _at_the_current_time_ for _some_reason_or_another_, and
therefore it is A Bad Idea(tm) for the typical Mac user to
mess with them.
> (Then he goes on to say that the contemplated dump scheme is not
> among those reasons, under the current swap implementation, because
> (unlike other *BSDs) it uses files and thus requires a still working
> filesystem on the partition you'd use for swap. *That* is unrelated.)
My reading is: they have already decided to not have a swap partition,
therefore they cannot use the swap partition as a place to put a dump.
The chosen swap implementation precludes the suggested dump option.
if (no swap_partition) then (no core_dump_to_swap_partition)
Seems the two are pretty related to me... but I'll freely admit that
the email-list discussion that you referenced is anything but clear,
as folks are flinging multiple ideas and responses around in a single
post.
> My only contentions are that 1) swap partitions do not provide
> better performance (though if someone provided a reasonable
> benchmark indicating the opposite I would certainly reconsider
> my position - and no, "bouncemarks" are not a reasonable
> benchmark) ...
Doesn't that translate more directly into:
"I don't think swap partitions provide better performance, but I could
be wrong."
?
bp
--
Heisenberg may have slept here.
Having looked at your web page and at what follows, my suggestion is
that you have way too much free time. I'd guess that the number of
Mac users who do lots of disk I/O AND lots of page I/O AND who have
the maximum amount of RAM installed in their computers and who would
thus benefit from moving the swap file is, to within several decimal
places, zero.
And if it's an issue it would be FAR easier to move files and
applications to the other disk and leave the swap file on the boot
disk.
But by all means, tinker away. I too enjoyed playing with the innards
of computers. Have fun!
--
Ray Fischer Most people, sometime in their lives, stumble across truth.
rfis...@sonic.net Most jump up, brush themselves off, and hurry on about
their business as if nothing had happened. -- Churchill
> In an ideal world the swop file should not be fragmented which it will
> become on the one spindle, so is there an advantage to having it on the
> same fast spindle but on a seperate partition to prevent fragmentation?
In an ideal world, your HDA wouldn't have to move the heads too far between a
paging operation and application/data access.
I'd bet the milliseconds you save by having a dedicated, contiguous swap
space would easily be overcome by the milliseconds required to seek to that
area.
By definition, the swap space would be farther away from your primary point
of access (application/system/data) than an embedded swapfile would be.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
I have 768MB of RAM. 1.5GB is the max, and maybe I'll go there one
day.
But it might not make much difference.
I spent a good chunk of the weekend making DVD's and as such was
flying between iMovie, iDVD 2, iPhoto, iTunes and Photoshop 7. The
machine was starting to stall out, swapping and I took a look in my
swap dir. (I've moved swap back to the way Apple has it by default,
as the compatibility / future OS upgrade issues argued here make
sense.) I had 29 80MB swap files. That's over 2.3GB of swap.
Sure...the extra 768MB would've nocked that down to around 1.5GB swap,
but still...
And no -- I don't want to close any of the aforementioned apps as the
DVD creation process involves moving constantly between all of these
apps.
Happily I've got a dual G4 800, so at least on the CPU side of things
I'm being pretty well taken care of, but it did get slow. It's a
good thing I moved my swap back to the main drive, as my swap
partition was 2GB in size... I'm not sure what happens when you run
out of swap under OS X. Hopefully it's more graceful than I remember
OS/2 being in this situation.
bp
> Ron Goodman <rgoo...@taconic.net> wrote in message
> news:<170820020858568729%rgoo...@taconic.net>...
> > Memory is still cheap--if you're not paging to disk, it doesn't matter
> > all that much where the swap file is.
> >
> >
>
> I have 768MB of RAM. 1.5GB is the max, and maybe I'll go there one
> day.
>
<SNIP>
> Happily I've got a dual G4 800, so at least on the CPU side of things
> I'm being pretty well taken care of, but it did get slow. It's a
> good thing I moved my swap back to the main drive, as my swap
> partition was 2GB in size... I'm not sure what happens when you run
> out of swap under OS X. Hopefully it's more graceful than I remember
> OS/2 being in this situation.
Just to shed some light on that point, I made my swap partition only
349MB ages ago (before I realised that swap files are only created in
80MB allotments!) with 448MB built-in RAM.
On occasion (sometimes I have Classic, Project Builder, Virtual PC, as
well as the 8 or 9 apps which I open and forget, open) the partition
will not have a full 80MB free. The worst scenario this has put me in
was the few times the Finder presents a dialog along the lines of "Your
swap drive has run out of disk space to use as memory. Close windows or
applications immediately to avoid problems". I generally take the advice
with a little bit of urgency, but have never seen it cause problems. I
imagine things get pretty hairy under the hood when such a VM system
runs out of VM!
--
Heath
________________________________________________________
| *Nothing is foolproof to a sufficiently talented fool* |
| _\|/_ |
|________________________________________m(. .)m_________|