Re: Ideal Swap Partition Size



On Tue, 2009-01-20 at 20:06 -0800, Gordon Messmer wrote:
Rick Stevens wrote:

Reserving a swap area and its size is rather dependent on what the
machine is doing. We have database servers that, on occasion, get
hammered and revert to using swap for a brief time. We use a 2X swap
size and we've come close to using it all, so it's still valid. You
will have to watch it---as soon as you start really whacking swap,
system performance is going to start suffering quite badly.

It's also important to bear in mind that under the standard
configuration, you must have at least as much "free" memory as the
largest application in your server, or else that application won't be
able to call external programs.

If you don't have enough memory (RAM+Swap) for the largest app you need
to run, then that app won't be able to run. And if you don't have enough
for the worst case combination of apps, then that combination won't be
able to run. It has nothing to do with the largest app calling external
programs or not.

Let's imagine that you have a server with 2GB of RAM, and just 512MB of
swap (maybe based on the idea that swapping will cause the system to
behave badly). Let's also imagine that you've tuned your SQL server to
keep as much data in memory as possible, so it's 1.5GB resident. Now,
if you SQL server has helper applications that it wants to call, it has
to fork() and then exec() to start them. When it does a fork(), the
system doesn't actually copy all of its pages for the new process, but
it does require that the memory be available (the extent to which that
is true depends on your overcommit settings).

This was true in older systems (actually the system just allocated space
for data and stack, since the code segment was shared) but Linux uses a
copy-on-write policy so I don't think it's true any more.

Of course the process can change its requirements at runtime, so it
might start running and then fail later, not because it's executing an
external program but simply through trying to allocate memory that the
system doesn't have.

However, since you don't
have 1.5GB of memory available, the fork() will probably fail, and the
SQL server process can't execute its helper script.

I don't think so (see above).

This situation would be much harder to diagnose if you had 1GB of swap
and your SQL server were something like 1.3 GB. In that case, it might
sometimes work and sometimes fail depending on how many other processes
were using memory.

And on how much the SQL process is using for a specific run.

So, even if you expect to never *use* swap space, you should have at
least as much swap as physical RAM.

There is no "reasonable" amount of swap that will stop you from running
out of memory in *every* conceivable circumstance. You need to know the
behaviour of your system to make an educated guess.

poc

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines



Relevant Pages

  • Re: Memory issues with 64-bit SQL Server 2005 on 64-bit Win 2003 C
    ... I also checked the individual patch levels for the .NET drivers, SQL Server ... The SQL Server is fully patched, however Windows Update reported that the OS ... Lock pages in memory -- I guess you might have taken care of it as well. ...
    (microsoft.public.sqlserver.clustering)
  • Re: FTS Performance in SQL 2005
    ... I don't think you have left enough memory for the OS and MSSearch. ... Looking for a SQL Server replication book? ... Looking for a FAQ on Indexing Services/SQL FTS ...
    (microsoft.public.sqlserver.fulltext)
  • RE: Insufficient memory Available
    ... Insufficient memory available. ... within the scope of SQL Server. ... "MemToLeave" area. ...
    (microsoft.public.sqlserver.server)
  • RE: server problems
    ... This newsgroup only focuses on SBS technical issues. ... >Thread-Topic: server problems ... >> web proxy service or SQL Server will normally use large memory. ...
    (microsoft.public.windows.server.sbs)
  • RE: server problems
    ... > web proxy service or SQL Server will normally use large memory. ... > the SBS server and sends the alert when the value reaches the threshold. ...
    (microsoft.public.windows.server.sbs)