Analyze the purpose of MSSQL error without real-time data - sql

I am looking for a way how to analyze what caused this errors in a MSSQL server:
A significant part of sql server process memory has been paged out. This may result in a performance degradation. Duration: 0 seconds. Working set (KB): 499352, committed (KB): 1024012, memory utilization: 48%.
2021-12-05 18:49:42.63 spid1504 Error: 8645, Severity: 17, State: 1.
2021-12-05 18:49:42.63 spid1504 A timeout occurred while waiting for memory resources to execute the query in resource pool 'internal' (1). Rerun the query.
This is happening randomly (I didn't found a reason why or when or what can cause this) few times in a month. I already set up some monitoring counters (https://learn.microsoft.com/en-us/sql/relational-databases/performance-monitor/monitor-memory-usage?view=sql-server-ver15) in perfmon but I think this will not solve my problem.
My problem is that I don't know what is causing such SQL memory consumption. I think it is some query from IIS website which is hosted on the same server. It is even worse because it is a production MSSQL server with IIS server and always when this is happening, some admins are going to restart the whole server immediately (because it is PROD and it's need to be working). So I don't have time to look around what is happenning in the server when this occurs. In reality I don't even know (nobody knows) when this will happen again. I need to rely only on historical data. Any thoughts how can I find some reliable information what is causing this?
Server is hosted as VM with this setup:
Windows Server 2019 Datacenter
Microsoft SQL Server 2017 (Maximum server memory (in MB): 32768)
16 vcpus
64 GB RAM

Related

SQL Server response time increasing

I'm currently working on updating an ERP called Sage 1000 to a newer version. The main change occurred along the upgrade is that the ERP solution and its database became on two different server. Ever since, The response time has significantly increased.
The part related to SQL Server is the following: whenever the time response problem happens, I restart the SQL Server service and it starts working just fine, at least for a couple of days until I have to restart it again.
Within the task manager before restarting the service I can see that it consumes nearly 17 to 20 gigabytes of memory witch is an insane amount even for a server run service, after restart, the amount of memory drops to a normal 2 to 3 gigabytes.
So my question is the following: in your experience what could be the cause of such abnormal behavior? Right now I created a planned task to restart the service everyday at 3:00 am, but it's not a radical solution.
Thanks in advance for your help,

SQL Server 2016 RESERVED_MEMORY_ALLOCATION_EXT

I have a SQL Server 2016 Standard Version and often face with
RESERVED_MEMORY_ALLOCATION_EXT
SOS_SCHEDULER_YIELD
MEMORY_ALLOCATION_EXT
wait types. However my server CPU don't exceed 20% and I have always 75 GB freeable memory?
I set MAXDOP value 3 but there is no change. I didn't face with any problem when I was using Enterprise edition with same DB and same queries.
Thank you for help
We exerienced the same today and it was due to a virtualization issue.
We had another VM on the same physical host which ran at 100% CPU and due to overcommitment and missing reservation, the Database VM had to wait for CPU cycles. This is almost impossible to track down from within the Database VM.

What would cause SQL Server to stop writing to the error log?

Error logs for our SQL Server instance are gathering a large amount of data (250k records in a month) all day, then all of a sudden stop at roughly the same time of day (9:15pm), though on different days of the week and at seemingly random intervals of days.
This corresponds to other issues on the server: 1) jobs that move files to shares on the database server fail 2) I am not able to access the server via any method (tried RDP and SSMS). Once the servers are rebooted, SQL Server comes up and SQL Server error logging resumes.
Windows Event Viewer doesn't show any notable error messages for System (the other event logs have wrapped already).
The error logs are being written to the D:\ drive, which has over 100GB free currently. The error log files are in the range of tens of megabytes.
Appreciate any ideas on what might have caused this or how troubleshoot it. Thanks!
The cause appears to have been a corrupted maintenance plan. I discovered this by correlating the timing of the lock-up to the times the maintenance plan was running. The lack of logging made this difficult to confirm. Guessing that at least some parts of it ran normally, but got rolled back on restart.
The current fix was to disable the maintenance plan and replace it with a collection of jobs that do the same tasks. I will likely recreate the original maintenance plan if the server remains stable for another week or two. If we stay stable past that point, it should solidly confirm the maintenance plan as the source of the problem.

How to solve: RenderEventToBuffer failed because of insufficient memory - Windows Scheduled Task

Windows 2008 R2 server, 16G ram. MS SQL 2012, Max server mem set to 12G (not sure if the SQL info is relevant).
I have an exe that has a function which can be run manually (click the button) or via a scheduled task (passing the correct param).
When the task gets run manually, all works fine.
When the task is run as a scheduled task, I get the following error:
RenderEventToBuffer failed because of insufficient memory -122-The data area passed to a system call is too small
** The one thing that might be a hint OR could be a red herring, is that it seems after the sql server is restarted (and much less than it's 12G limit in memory) the scheduled task runs fine, but the error appears once the sql server hits the 12G memory limit.
As I write that, it really does seem red-herring-ish, but I don't know enough to know enough.
Can anyone help me understand what this means and how to solve it?
I do not know what causes this but rebooting the server has fixed this for me across multiple systems when encountered.

Limiting the RAM consumption of MS SQL SERVER

I just rolled a small web application into production on a remote host. After it ran a while, I noticed that MS SQL Server started to consume most of the RAM on the server, starving out IIS and my application.
I have tried changing the "server maximum memory" setting, but eventually the memory usage begins to creep above this setting. Using the activity monitor I have determined that I am not leaving open connections or something obvious so I am guessing its in cache, materialized views and the like.
I am beginning to believe that this setting doesn't mean what I think it means. I do note that if I simply restart the server, the process of memory consumption starts over without any adverse impact on the application - pages load without incident, all retrievals work.
There has got to be a better way to control sql or force it to release some memory back to the system????
From the MS knowledge base:
Note that the max server memory option
only limits the size of the SQL Server
buffer pool. The max server memory
option does not limit a remaining
unreserved memory area that SQL Server
leaves for allocations of other
components such as extended stored
procedures, COM objects, non-shared
DLLs, EXEs, and MAPI components.
Because of the preceding allocations,
it is normal for the SQL Server
private bytes to exceed the max server
memory configuration.
Are you using any extended stored procedures, .NET code, etc that could be leaking memory outside of SQL Server's control?
There is some more discussion on memory/address space usage here
Typically I recommend setting the max server memory to a couple of Gigs below the physical memory installed.
If you need to run IIS and an application server installed on the server then you'll want to give SQL Server less memory.