SQL Server DB Engine Memory Leakage - sql-server

We have a Windows Form Application and the back-end of the application is SQL Server Express 2005/2008. Our application can be installed on Windows XP SP3/ Windows Vista/ Windows 7.
We have observed huge memory leakage in SQL Server Express.
Normally, there are two process running even if the application is not used by the user:
A polling process to check the availability of files. (If files are not available then, only one query is fired to check some configuration setting)
A Scheduling process. (This process fires a query every minute to check for any scheduled task)
We have observed that the memory usage of the SQL Server (sqlsrvr.exe) keeps on increasing. In around an hour, the memory usage reaches upto 1GB and it never comes down.
We have also noticed that, if the interval of the polling process is increased, then the memory usage increases gradually but, it does increase.
The higher memory usage by SQL server downgrades the machine performance and the performance of all other applications running on the machine.
Please provide suggestions to control the memory usage of SQL server in this case.
PFB the details:
Software causing issue :SQL Server 2005/2008 Express editions (named instance)
Operating Systems on which issue can be simulated : Windows XP SP3/ Windows Vista/ Windows 7
Regards,
Abhineet

SQL Server is designed to take all the memory on the system and use it for its internal cache. You should never run anything else on the same machine as SQL Server. This is not a leak, is the intended and desired behavior. By design. See Memory Manager Architecture
As a special case SQL Server Express edition limits its internal buffer pool size to 1Gb. The buffer pool is not the only memory consumed by SQL Server though. You can further limit the SQL Server buffer pool size by specifying a value for max server memory.

Related

SSIS Server Maintenance Job ends up using all of server memory

For some reason the SSIS Server Maintenance Job ends up having the SQL Server instance use all available server memory after a few runs (it runs every midnight). When that happens, my SSIS packages no longer have memory to run in and start swapping on disk which leads to unacceptable execution times or at worst a total hang.
So far I've been resetting the SQL Server service through Configuration Manager every morning, but that's not a viable long term solution. I have not set maximum memory limit for the SQL Server instance. Would that help? If not, what can I do?
Server information: Azure VM, 32 GB ram, no other purpose for the server than running SSIS.
You should always set a maximum memory limit for SQL Server instances.
A simple rule of thumb is to leave 4GB or 10% of total memory free, whichever is larger, and tweak as necessary.
If your SQL Server instance is running as a VM, then you also need to set a memory reservation at the host for your VM. Otherwise, the host's 'balloon memory manager' might kick in and steal memory back from your instance.
Ref:
Server memory configuration options
Understanding Memory Resource Management in VMware

Resource Monitor Shows sqlserver.exe using c:\pagefile.sys

I've got a SQL Server 2008 server that will frequently (multiple times throughout the day) reports
"SQL Server has encountered 64357 occurrence(s) of I/O requests taking
longer than 15 seconds to complete on file..."
.
I've noticed that in resource monitor when filtering to the sqlserver.exe process c:\pagefile.sys is showing up fairly often.
The server currently has 40MB of memory free and 260mb available. SQL Server is set to unlimited for ram and is using most of the 32GB on the server. It's a production server I've inherited where there isn't much downtime, so I haven't been able to change that.
I assume SQL is running out of memory and going to the page file?
SQL Server has encountered 64357 occurrence(s) of I/O requests taking longer than 15 seconds
Does not indicate a memory problem. It indicates a problem with the disks used to store your databases.
It seems so. Add more ram to the server and it will be fixed

SQL Server error: the paging file is too small for this operation

I'm running SQL Server 2012 Express (v 11.0.3000) on a virtual server running Windows Server 2008 R2. Over the past couple of weeks, the SQL Server has been randomly crashing or hanging. Looking at the SQL server log, it seems that right before the crashes I'm getting an error saying "Could not load the DLL dbghelp.dll or one of the DLLs it references. Reason: 1455(The paging file is too small for this operation..."
I'm confused as to whether this is referencing the SQL Server paging file or the Windows paging file. Because this is a virtual server, Virtual Memory is disabled in Windows system configuration. When I go to the task manager, it shows I have 94,089 MB of free physical memory. I found an article stating that in a virtual server, all the memory is virtual anyway, so to the virtualized instance of Windows, it all looks like physical memory. So if the server has this much memory available, I don't understand why SQL Server's paging file would be too small.
When I search for this 1455 error message, I found this article (http://www.sqlservercentral.com/Forums/Topic1487760-5-1.aspx) which suggests reducing the max server memory. I assume it means reducing the maximum server memory setting in the Server Properties in SQL Server. Currently this is set to 1024 MB. This seems counterintuitive to reduce the server memory in this situation. Plus, 1GB doesn't seem like a lot.
When I go to the General tab of SQL Server properties, the value for Memory is 4096 (MB).
Below is a screenshot of the SQL Server log:
enter image description here
thanks!
The DLL error is just a consequence of a low memory condition. SQL Server is not able to allocate dinamically more memory to processes.
Maximum Server Memory is a parameter used to define the maximum amount of memory sql server can allocate.
You have to raise it: 1024MB is a very low value for a producton database.
See more details here: https://msdn.microsoft.com/en-us/library/ms178067(v=sql.110).aspx
SQL Server Express is free but has limitations like maximum usable memory: https://msdn.microsoft.com/en-us/library/ms143685(v=sql.105).aspx
...and it's 1GB. I'm sorry but probably you have to upgrade to Standard. :(

SQL Server - Does it really release memory when another process needs it?

We have an 8 Core, 16GB RAM server that has SQL Server 2008 running on it. When we perform large queries on millions of rows the RAM usage goes up to 15.7GB and then even file browsing, opening excel etc gets really slow.
So does SQL Server really release memory when another process needs it or am I having another issue? We don't have any other major programs running on this server.
We've set a max memory usage of 14GB for SQL Server.
Thanks all for any enlightenment or trouble shooting ideas.
Yes it does. See SQLOS's memory manager: responding to memory pressure for details how this works. But what exactly means to have 'memory pressure' it depends from machine to machine and from OS version to OS version, see Q & A: Does SQL Server always respond to memory pressure?. If you want to reserve more memory for applications (I'm not even bother to ask why you browse files and use Excel on a machine dedicated to SQL Server....) then you should lower the mas server memory until it leaves enough for your entertainment.
SQL server does NOT release memory. It takes all the memory it can get up to the MaxMemory setting and it stays there.

Limited memory usage of sql server 2008 express?

I want to install sql server 2008 express on my laptop that has 1 GB memory, but my database contains lots of binary data that I don't want spending all my RAM. I would much rather sacrifice sql performance (make it page) in favor of other applications.
Is it possible to limit the memory footprint of sql server?
look here and here
essentially sp_configure 'max server memory' I think
I've only got SQL Server 2005 Express, not 2008, but from SQL Server Management Studio Express, if I right-click on the root node in the tree (the server node) and select Properties, there's a "Memory" page with both minimum and maximum amounts of memory available to be set.
From the docs for these options:
Minimum server memory (in MB)
Specifies that SQL Server should start
with at least the minimum amount of
allocated memory and not release
memory below this value. Set this
value based on the size and activity
of your instance of SQL Server. Always
set the option to a reasonable value
to ensure that the operating system
does not request too much memory from
SQL Server and inhibit Windows
performance.
Maximum server memory (in MB)
Specifies the maximum amount of memory
SQL Server can allocate when it starts
and while it runs. This configuration
option can be set to a specific value
if you know there are multiple
applications running at the same time
as SQL Server and you want to
guarantee that these applications have
sufficient memory to run. If these
other applications, such as Web or
e-mail servers, request memory only as
needed, then do not set the option,
because SQL Server will release memory
to them as needed. However,
applications often use whatever memory
is available when they start and do
not request more if needed. If an
application that behaves in this
manner runs on the same computer at
the same time as SQL Server, set the
option to a value that guarantees that
the memory required by the application
is not allocated by SQL Server.
I'd be surprised if these options weren't in 2008, but you could always just install it and try.
You can do it w/ osql:
http://kb.hs-lab.com/content/7/113/en/how-to-limit-ram-usage-for-sql-2005-express-database.html
osql -E -S YOURSERVERNAME\PRINTLOGGER
sp_configure 'show advanced options',1
RECONFIGURE WITH OVERRIDE
GO
then
sp_configure 'max server memory',70?
RECONFIGURE WITH OVERRIDE
GO
You might also try giving cpu priority to your favored applications and letting SQL manage memory dynamically. It will release memory as needed by other apps, regardless of priority.
Hopefully you're not trying to run visual studio on that machine. It won't be much fun.

Resources