运行存储Proc (ASP.NET)时的高内存使用

时间:2022-09-20 23:22:03

I seem to have some sort of memory/RAM issue on an ASP.NET 3.5 website I am working on. Currently we are running a 2 server web farm with Windows 2012, both on virtual servers. When more users log on and start using the application, especially running intensive database work, the memory usage on that w3wp.exe process will shoot up very high (up to 2.5-3 GB).

我似乎在ASP上有一些内存/RAM问题。我正在做的网站3.5。目前,我们在虚拟服务器上运行一个2服务器的web farm,其中包括Windows 2012。当更多的用户登录并开始使用应用程序时,特别是运行密集的数据库工作时,在w3wp上的内存使用情况。exe过程将会非常高(高达2.5-3 GB)。

I've tried a number of things already to help solve this issue:

我已经尝试了很多事情来帮助解决这个问题:

  • Request for increase of RAM on the virtual servers
  • 请求在虚拟服务器上增加RAM。
  • Ensure all database connections and readers are in "using" statements
  • 确保所有数据库连接和读者都使用“using”语句。
  • Adjusted any parts in the code where datasets where being saved into Session variables, various other Session variable cleanups
  • 调整代码中的任何部分,其中数据集被保存到会话变量中,其他的会话变量清理。
  • Tried analyzing memory dumps using WinDbg and the like, with no real significant issue that jumped out at me on the logs
  • 尝试使用WinDbg和类似的方法分析内存转储,但没有真正意义重大的问题在日志中跳出来。

What I have noticed however, is that the memory seems to shoot up really high when intensive database work is being done. I have a button on the website that when clicked, all it does is call a stored procedure (FYI - this is an Informix, not SQL database).

然而,我注意到的是,当密集的数据库工作正在完成时,内存似乎会非常高。我在网站上有一个按钮,当点击时,它所做的就是调用一个存储过程(FYI -这是一个Informix,而不是SQL数据库)。

From the ASP.NET page -

从ASP。网络页面,

Dim SWS As New PurchaseOrders

Protected Sub btnFunction_Click (ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFunction.Click

        SWS.MyFunctionCall()

End Sub

In an App_Code file's method call -

在App_Code文件的方法调用中。

Using Conn As New IfxConnection(ConnectToInformix())
            Conn.Open()

            Dim cmd As New IBM.Data.Informix.IfxCommand()
            cmd.Connection = Conn
            cmd.CommandTimeout = 0
            cmd.CommandText = "auto_order"
            cmd.CommandType = CommandType.StoredProcedure

            cmd.Parameters.Add("@storeID", IfxType.Integer)

            cmd.Parameters("@storeID").Value = store_id

            Dim value As String
            value = cmd.ExecuteScalar()

            If (value = "1") Then
                Return True
            Else
                Return False
            End If
    End Using

The stored procedure runs fine, but users will continuously run this in succession. Meanwhile there are other database functions being run by other users anyway. So when this is happening, the memory jumps high to 2.5-3 GB. I have resorted to adding memory limit thresholds in IIS because if it gets past about 3.5 GB memory usage everything on the website will return Object Reference errors. So once it reaches memory limit, it will recycle and of course log users out.

存储过程运行良好,但用户将连续不断地运行这个过程。与此同时,其他用户也在运行其他数据库功能。因此,当这种情况发生时,内存跳升至2.5-3 GB。我在IIS中添加了内存限制阈值,因为如果它超过了3.5 GB内存,那么网站上的所有内容都会返回对象引用错误。一旦它达到内存限制,它就会回收,当然也会把用户注销。

Anyone got any ideas? Any insight is greatly appreciated. Thanks.

任何人有任何想法吗?我非常感激你的洞察力。谢谢。

1 个解决方案

#1


0  

It sounds like a memory leak issue possibly in the informix driver. Can you try profiling with some memory profiler? You can use some good memory profiler fewdays free in trials.

这听起来像是informix驱动程序中的内存泄漏问题。您可以尝试使用一些内存分析器吗?你可以在试用期间免费使用一些很好的内存分析器。

#1


0  

It sounds like a memory leak issue possibly in the informix driver. Can you try profiling with some memory profiler? You can use some good memory profiler fewdays free in trials.

这听起来像是informix驱动程序中的内存泄漏问题。您可以尝试使用一些内存分析器吗?你可以在试用期间免费使用一些很好的内存分析器。