32

If I have 8GB of RAM in a server and I run 4 instances of SQL Server Express, will the total memory limit used by SQL Server be 1GB or 4GB?

Would it be advisable to run multiple instances like this to enable each database to make better use of resources (assuming that the server has plenty of resources)?

migrated from stackoverflow.com Dec 3 '12 at 16:28

This question came from our site for professional and enthusiast programmers.

27

If I have 8GB of RAM in a server and I run 4 instances of SQL Express, will the total memory limit used by SQL Server be 1GB or 4GB?

Each instance can use up to 1GB of memory for the buffer pool. Each instance can use a bit more than 1GB in total because not all memory allocations go via the buffer pool. In your case, the maximum memory used by the four instances for buffer pool would be 4GB.

BOL extract

To confirm, I started two instances of the SQL Server 2008 Express Database Engine, performed some activity to load up the (separate) buffer pools, and then looked at per-instance memory utilization in a number of ways, for example using DBCC MEMORYSTATUS or by counting the number of buffers using the sys.dm_os_buffer_descriptors DMV.

The physical memory usage numbers below were obtained using simultaneous queries against the system DMV sys.dm_os_process_memory on each instance of the database engine:

SELECT 
    dopm.physical_memory_in_use_kb 
FROM sys.dm_os_process_memory AS dopm;

Output:

╔═══════════╦═══════════╗
║ Instance1 ║ Instance2 ║
╠═══════════╬═══════════╣
║   1102872 ║   1059812 ║
╚═══════════╩═══════════╝

Each of these is slightly in excess of 1GB as total physical memory usage includes more than just buffer pool usage, as mentioned previously.

Would it be advisable to run multiple instances like this to enable each database to make better use of resources (assuming that the server has plenty of resources)?

If the databases on each instance are functionally independent then it is at least workable to run multiple instances of Express in this way, though you would need to pay careful attention to configuration and maintenance may be made more complex.

You might be be better served using another edition, such as the fully-featured (and very cheap) Developer Edition, if the intended usage matches the licence). You would need to say much more about the circumstances to get a clear answer on this point.

  • 3
    Also of note, for the astute reader: SQL Server Database Engine means A Single Instance. Everytime you have to change the connection dialog server that you're connecting to (eg localhost\dev vs localhost\test) that's a new "Instance" or a new "Engine". Just thought I would clear that up. – jcolebrand Dec 3 '12 at 17:20
7

Every Instance counts separate as it has a separate process.

  • 1
    I assume that you are certain that the limiter isn't applied across all processes then? – wizzardmr42 Dec 3 '12 at 14:27
-8

In SQL Express, the database engine can only consume 1 GB RAM, and any DB cannot be larger than 10 GB.

So, 4 instances would still have to share that 1 GB RAM.

You can find out much more at http://msdn.microsoft.com/en-us/library/cc645993(v=SQL.110).aspx.

A similar discussion here on Stack Overflow says this is the right answer BTW, so no need to downvote: https://stackoverflow.com/questions/1169634/limitations-of-sql-server-express

This page says the same, even though it is about SQL Server Express 2005: http://www.edugeek.net/forums/windows-server-2000-2003/55183-sql-server-express-2005-memory-limit-per-instance.html

  • 3
    Doesn't necessarily follow - is it 1 engine per server or per instance? – wizzardmr42 Dec 3 '12 at 14:28
  • 1
    OK, that does imply it, but it is also possible that they missed it out on the memory limit line. – wizzardmr42 Dec 3 '12 at 15:19
  • 1
    Just because it's on the internet, it has to be true. They would never let something wrong be on the internet. ~ Saying that to say that the issue here is that there has to be a management process or something baked into the OS for the sole purpose of restricting all SQL Express forever. I really don't think that has happened (AKA it absolutely didn't happen, based on the fact that I breathe oxygen and can follow logic really well) so the fact of the matter is that the process itself manages the amount of RAM being used. – jcolebrand Dec 3 '12 at 15:37
  • 2
    Begging people to remove downvotes on what is naturally a bad answer is unlikely to get you upvotes, regardless of what source you cite. If you really want to cite source, go load up several instances and show their actual load in memory. That's the only way to know for sure. Either that, or show us the Microsoft code that governs the behavior of SQL Express. It's always per instance management, because each service is self-contained from top to bottom. All the management services work over ports. – jcolebrand Dec 3 '12 at 15:39
  • 2
    Maximum memory utilized (SQL Server Database Engine) Notice how they use the same terminology there as they do on the line: Maximum Compute Capacity Used by a Single Instance (SQL Server Database Engine)1 (for those playing at home, the point of that is that they are the same measurement) msdn.microsoft.com/en-us/library/… and I also love how the answer on SO that was linked to is WRONG WRONG WRONG. Start with "1 core or 4 sockets", the editors can't even copy-paste correctly. – jcolebrand Dec 3 '12 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.