简体   繁体   English

Asp.net中的内存缓存最大限制

[英]Memory Cache Maximum limit in Asp.net

I am developing an asp.net application which needs to search a record from around 5 million records(of around 4GB data). 我正在开发一个asp.net应用程序,该应用程序需要从大约500万条记录(大约4GB数据)中搜索一条记录。 Client is looking for higher performance and decided to memory cache. 客户端正在寻求更高的性能,并决定使用内存缓存。 But I m facing issue while uploading data into memory cache from asp.net. 但是当我从asp.net将数据上传到内存缓存时遇到了问题。 I tried changing application pool settings and made virtual memory as 0, private memory as 0.. Nothing worked out. 我尝试更改应用程序池设置,并将虚拟内存设置为0,将私有内存设置为0。 It is uploading fine till around 1.5GB and throwing out of memory exceptions. 它可以正常上载到1.5GB左右,并抛出内存不足异常。 There is no issue when I pushed data using console application by unchecking " 32 bit" in build settings in application properties. 通过取消选中应用程序属性的构建设置中的“ 32位”来使用控制台应用程序推送数据时,没有问题。 My Issue with asp.net. 我的问题与asp.net。 I am using .net frame work 4.0 with 4 core server , the memory available in the server is around 49GB. 我正在使用带有4核心服务器的.net frame work 4.0,服务器中可用的内存约为49GB。 I also tried with enabling 32 bit run on 64 mode in application pool. 我还尝试在应用程序池中启用在64位模式下运行的32位。 But nothing changed. 但是什么都没有改变。 Could please suggest me if there is any solution. 请问我有什么解决办法。

As already mentioned by John: Querying 5.000.000 records is the job of a DB and NOT your code. 正如约翰已经提到的:查询5.000.000记录是数据库的工作,而不是您的代码。 If you configure the DB correctly (let the DB use the memory as a cache, correct indexes, performant SQL-query) I would say with a 99.9% chance the DB will be MUCH faster then anything you can create in ASP.NET. 如果您正确配置了数据库(让数据库使用内存作为缓存,正确的索引,高效的SQL查询),那么我说数据库有99.9%的机会比您可以在ASP.NET中创建的任何东西都要快。

Anyhow if you REALLY want to do it the other way around, you need to create a 64-bit process. 无论如何,如果您真的想反过来做,则需要创建一个64位进程。
Checklist for doing that (out of my head - no guarantee for completeness): 这样做的清单(在我脑海中-不能保证完整性):

  • compile (all parts) of the solution as "Any CPU" or "x64" 将解决方案的所有部分编译为“任何CPU”或“ x64”
  • run IIS on a 64-bit CPU an OS (which should be the case with 49 GB RAM available) 在操作系统的64位CPU上运行IIS(可用49 GB RAM的情况应如此)
  • Set the Application-Pool to run as a 64-bit process with no memory limit: 将Application-Pool设置为无内存限制的64位进程运行:
    • Application Pools -> "Your Pool" -> Advanced Settings... 应用程序池->“您的池”->高级设置...
      -> Enable 32-bit Application -> False ->启用32位应用程序->否
      -> Private Memory Limit (KB) -> 0 ->专用内存限制(KB)-> 0
      -> Virtual Memory Limit (KB) -> 0 ->虚拟内存限制(KB)-> 0

Thank you guys. 感谢大伙们。 I agree that i can do it in my DB. 我同意我可以在数据库中执行此操作。 I am handling a huge volume of requests per sec. 我每秒处理大量的请求。 My DB query is like : select a,b,c,d,e from table1 where id = primary key... It is very simple and efficient query.. although this is efficient.. it is not giving the required performance. 我的数据库查询就像:从table1中选择a,b,c,d,e,其中id =主键...这是一个非常简单有效的查询..尽管这是有效的..它没有提供所需的性能。 So we decided to use cache. 因此,我们决定使用缓存。 Now we resolved the issue by creating a windows service ( which creates a proxy and hosts cache) and web application separately. 现在,我们通过分别创建Windows服务(用于创建代理和主机缓存)和Web应用程序来解决该问题。 web application internally call this windows service.. It is working now. Web应用程序内部调用此Windows服务。 Thank you for all suggestions. 感谢您的所有建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM