Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Programming / SQL / December 2008

Tip: Looking for answers? Try searching our database.

High memory usage of sqlservr.exe

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sudhir - 20 Mar 2007 10:27 GMT
Hi,
Can anyone please tell me why sqlservr.exe uses very high memory usage?
In one of our application, we found that the system becoming too slow
because of this SQLSERVR.exe. The momory usage sometimes crossing>1 GB. Can
you please tell me
What is the function of SQLSERVR?
How to release the momory used by SQLSERVR?
Why the memory usage of SQLSERVR keep on increasing?

Thanks and Regards
Sudhir
Uri Dimant - 20 Mar 2007 11:35 GMT
sudir
It is by design.SQL Server allocates as much memory as it needs and realeses
it ifOS or another application needs the memory

Do you have MAX memory set up?

> Hi,
> Can anyone please tell me why sqlservr.exe uses very high memory usage?
[quoted text clipped - 8 lines]
> Thanks and Regards
> Sudhir
sudhir - 20 Mar 2007 12:27 GMT
Hi,
But why this is taking > 1 GB memory? Yes the max server memory is set to
2147483647 MB. But once it crosses the 1 GB memory the system becomes too
slow. Can you please let me know how we can improve the performance? Or how
to release the memory?

Regards
Sudhir

> sudir
> It is by design.SQL Server allocates as much memory as it needs and realeses
[quoted text clipped - 14 lines]
> > Thanks and Regards
> > Sudhir
Uri Dimant - 20 Mar 2007 13:22 GMT
How much memory does the server have?

> Hi,
> But why this is taking > 1 GB memory? Yes the max server memory is set to
[quoted text clipped - 25 lines]
>> > Thanks and Regards
>> > Sudhir
WiredUK - 20 Mar 2007 15:32 GMT
Are you running other services on the server?

Is it SQL Server that is becoming slow or the other services?

If it is the other services, then you need to restrict the amount of memory
that SQL Server uses by using the aforementioned MAX memory.

> Hi,
> But why this is taking > 1 GB memory? Yes the max server memory is set to
[quoted text clipped - 25 lines]
>> > Thanks and Regards
>> > Sudhir
dhiren shah - 29 Dec 2008 05:52 GMT
we have server with 2 GB RAM.Once we switch ON server,the sqlservr.exe increases drastically above 1.7 GB & inturn server becomes extremely slow.can you please suggest how we can restrict sqlservr.exe to a some specified limit or how we can clamp SQl memory.
Please do reply.
Erland Sommarskog - 29 Dec 2008 08:38 GMT
> we have server with 2 GB RAM.Once we switch ON server,the sqlservr.exe
> increases drastically above 1.7 GB & inturn server becomes extremely
> slow.can you please suggest how we can restrict sqlservr.exe to a some
> specified limit or how we can clamp SQl memory.

You can use sp_configure to set the max server memory:

  sp_configure 'max server memory', 100
  reconfigure

This will set the server to use at most 100 MB for the buffer cache.

However, you should not do this, because it's perfectly normal for SQL
Server to all memory it can if it needs it. This is because it thinks it
good to have data in cache rather than on disk.

Apparently, you SQL Server instance gets to do some heavy work already on
startup, and that is your real problem. You need to find out what that is.

Signature

Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

Eric Russell - 30 Dec 2008 22:27 GMT
The following script, will list every user, system, and tempdb table
contained in SQL Server's buffer memory. It is based on a much simpler script
I originally found in a blog somewhere years ago, but I made modifications to
resolve the actual object names and span across all databases. It's pretty
rough, so if you discover something is amiss, like not calculating the
storage MB accurately, then reply back with bug fixes.

-- SQL Server stores its data in 8KB data pages.  As these pages are read
off disk they are stored in memory.  
-- This is referred to as buffer memory.  A list of all the data pages in
memory is stored in the dynamic management
-- view sys.dm_os_buffer_descriptors. Remember that keeping a clustered
index in the buffer (or memory) is the same
-- as keeping the table in memory.
-- NOTE: For performance reasons, I am first inserting the result of the
DMVs to table variables and then joining them.  
declare @sys_allocation_units table
(
    database_id            int,
    allocation_unit_id    bigint,
    type                tinyint,
    type_desc            varchar(20),
    container_id        bigint,
    data_space_id        tinyint,
    total_pages            int,
    used_pages            int,
    data_pages            int
)

insert into @sys_allocation_units
EXEC sp_MSforeachDB @command1='use ?; select db_id(''?'') as database_id, *
from sys.allocation_units'

declare @sys_partitions table
(
    database_id            int,
    objname                varchar(255),
    partition_id        bigint,
    object_id            bigint,
    index_id            int,
    partition_number    int,
    hobt_id                bigint,
    rows                bigint
)

insert into @sys_partitions
EXEC sp_MSforeachDB @command1='use ?; select db_id(''?'') as database_id,
object_name(object_id) as objname, * from sys.partitions;'

declare @allocation table
(
    database_id            int,
    objname                varchar(255),
    index_id            tinyint,
    allocation_unit_id    bigint,
    object_id            bigint
)

insert into @allocation
SELECT au.database_id, objname, index_id ,allocation_unit_id, object_id
FROM @sys_allocation_units AS au
   INNER JOIN @sys_partitions AS p
       ON p.database_id = au.database_id and
            au.container_id = p.hobt_id and
            (au.type = 1 OR au.type = 3)
UNION ALL
SELECT au.database_id, objname, index_id, allocation_unit_id, object_id
FROM @sys_allocation_units AS au
   INNER JOIN @sys_partitions AS p
       ON p.database_id = au.database_id and
            au.container_id = p.hobt_id and
           au.type = 2

declare @bd table
(
    database_id            int,
    allocation_unit_id    bigint,
    Buffered_Page_Count    int,
    row_count            int
)

insert into @bd
SELECT
    bd.database_id,
    bd.allocation_unit_id,
    count(*)AS Buffered_Page_Count ,
    sum(bd.row_count) as row_count
FROM
    sys.dm_os_buffer_descriptors AS bd
GROUP BY
    bd.database_id,
    bd.allocation_unit_id

SELECT --distinct
    db_name(bd.database_id) as DBName,
    obj.ObjName,
    sum(bd.Buffered_Page_Count) as Buffered_Page_Count,
    sum(bd.row_count) as row_count,
    convert(numeric(9,2),sum(bd.Buffered_Page_Count) * 8192.0 / (1024.0 *
1024.0)) as Buffer_MB
FROM
    @bd as bd
   INNER JOIN @allocation AS obj
       ON bd.allocation_unit_id = obj.allocation_unit_id and
            bd.database_id = obj.database_id
group by
    db_name(bd.database_id),
    obj.ObjName
order by
    convert(numeric(9,2),sum(bd.Buffered_Page_Count) * 8192.0 / (1024.0 *
1024.0)) desc
    --db_name(bd.database_id),
    --obj.ObjName

> we have server with 2 GB RAM.Once we switch ON server,the sqlservr.exe increases drastically above 1.7 GB & inturn server becomes extremely slow.can you please suggest how we can restrict sqlservr.exe to a some specified limit or how we can clamp SQl memory.
> Please do reply.
dhiren shah - 29 Dec 2008 05:55 GMT
we have server with 2 GB RAM.Once we switch ON server,the sqlservr.exe increases drastically above 1.7 GB & inturn server becomes extremely slow.can you please suggest how we can restrict sqlservr.exe to a some specified limit or how we can clamp SQl memory.
Please do reply.
Jeffrey Williams - 29 Dec 2008 06:03 GMT
Because your server only has 2GB of memory, and by default SQL Server will
take 2GB of memory - it is taking all of the servers memory.  You need to
set the max memory to something less than 1.25GB of memory which will leave
enough memory for the OS and other SQL Server operations.

Do not set the min memory setting to anything at all - that way the OS can
manage all of the memory that is available.

Jeff

> we have server with 2 GB RAM.Once we switch ON server,the sqlservr.exe
> increases drastically above 1.7 GB & inturn server becomes extremely
> slow.can you please suggest how we can restrict sqlservr.exe to a some
> specified limit or how we can clamp SQl memory.
> Please do reply.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.