问题描述

在创建App Service服务的时候,根据定价层不同,内存使用的最大值也有不同。但在实际测试中,发现内存最大只能占用2GB左右,

而定价层中内存分配明明是大于2GB(比如B3定价层的内存为7GB), 这是一种什么情况呢?

在App Service中Kudu工具上,查看进程分配的内存大小:

问题解答

使用一段简短C#代码来进行验证,代码是一个循环,根据URL中输入的数字,循环创建多个100MB大小的对象.

var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
var app = builder.Build(); app.MapGet("/oom/{objs}", (string objs) =>
{
int objunmbers = int.Parse(objs);
try
{
byte[][] largeArray = new byte[objunmbers][];
for (int i = 0; i < objunmbers; i++)
{
largeArray[i] = new byte[1024 * 1024 * 100]; // 每个对象占用100MB
}
return "成功创建大数组对象: " + objs;
}
catch (OutOfMemoryException)
{
return "内存不足,无法创建大数组对象";
}
}); app.Run();

代码本地调试,可以看见应用占用内存直线上涨:

部署到Azure App Service后,同样通过Kudu站点Process信息,发现内存的占用的确只有2GB左右,但请求需要更多内存资源时,页面返回:内存不足,无法创建大数组对象

这是因为App Service for Windows默认使用32位操作系统,最大内存只能分配2GB。

当主动修改位64位后,App Service 内存就可以占用到定价层所允许的最大值!

如B3的定价层在Kudu中查看到w3wp.exe进程分配的内存达到了6GB

根据以上测验,当使用App Service内存没有达到预期的值,且应用异常日志出现OutOfMemory时,就需要检查Platform的设置是否位64bit。

 

参考资料

I see the message "Worker Process requested recycle due to 'Percent Memory' limit." How do I address this issue? 

https://learn.microsoft.com/en-us/troubleshoot/azure/app-service/web-apps-performance-faqs#i-see-the-message-worker-process-requested-recycle-due-to-percent-memory-limit-how-do-i-address-this-issue

The maximum available amount of memory for a 32-bit process (even on a 64-bit operating system) is 2 GB. By default, the worker process is set to 32-bit in App Service (for compatibility with legacy web applications).

Consider switching to 64-bit processes so you can take advantage of the additional memory available in your Web Worker role. This triggers a web app restart, so schedule accordingly.

Also note that a 64-bit environment requires a Basic or Standard service plan. Free and Shared plans always run in a 32-bit environment.

【Azure App Service】在App Service for Windows上验证能占用的内存最大值的更多相关文章

  1. Windows上验证过的一些乱七八糟的笔记

    1.Win10安装时报错“windows 无法安装到这个磁盘 gpt分区形式”? 答:shift+f10:  https://jingyan.baidu.com/article/08b6a591c82 ...

  2. windows上使用SecureCRT连接linux

    前言: SecureCRT是一款支持SSH(SSH1和SSH2)的终端仿真程序,简单地说是Windows下登录UNIX或Linux服务器主机的软件.这样操作的时候不必进入到linux桌面,可以更方便的 ...

  3. node-webkit教程(7)Platform Service之APP

    node-webkit教程(7)Platform Service之APP 文/玄魂 前言 几个月前,要开发一个简易的展示应用,要求支持离线播放(桌面应用)和在线播放(web应用). 当时第一想到的是f ...

  4. 【应用服务 App Service】App Service发生错误请求时,如何查看IIS Freb日志,从中得知错误所发生的模块,请求中所携带的Header信息

    问题描述 在使用Azure App Service时候,我们有时候对 一些请求发生错误毫无头绪,能从错误代码中知道请求错误,但是更多的信息呢? 当我们需要更多的信息时候,通常有以下的一些方式来查找问题 ...

  5. android如何实现开机自动启动Service或app

    第一步:首先创建一个广播接收者,重构其抽象方法 onReceive(Context context, Intent intent),在其中启动你想要启动的Service或app. import and ...

  6. [Windows Azure] What is a cloud service?

    What is a cloud service? When you create an application and run it in Windows Azure, the code and co ...

  7. 【转】android如何实现开机自动启动Service或app

    1.今天我们主要来探讨android怎么让一个service开机自动启动功能的实现.Android手机在启动的过程中会触发一个Standard Broadcast Action,名字叫android. ...

  8. 在Azure上部署IPv6的App通过IOS App Store审核

    随着中国企业出海Go Global,越来越多的用户开始在Global Azure部署自己的应用.由于对Global Azure功能和文档的不熟悉,使用过程中或多或少遇到了一些坑.事实上呢,这些并不是坑 ...

  9. 不可或缺 Windows Native (25) - C++: windows app native, android app native, ios app native

    [源码下载] 不可或缺 Windows Native (25) - C++: windows app native, android app native, ios app native 作者:web ...

  10. 004.Create a web app with ASP.NET Core MVC using Visual Studio on Windows --【在 windows上用VS创建mvc web app】

    Create a web app with ASP.NET Core MVC using Visual Studio on Windows 在 windows上用VS创建mvc web app 201 ...

随机推荐

  1. 一个能够生成 Markdown 表格的 Bash 脚本

    哈喽大家好,我是咸鱼. 今天分享一个很实用的 bash 脚本,可以通过手动提供单元格内容和列数或者将带有分隔符的文件(如 CSV.TSV 文件)转换为 Markdown 表格. 源代码在文末哦!原文链 ...

  2. zabbix资产清单inventory管理

    概述 监控的设备越来越多,有时候搞不清楚哪台服务器是什么配置,大多公司有自己的资产清单,要去专门的系统查询显得多少有点麻烦.为此,zabbix专门设置了设备资产管理功能.我们创建或者编辑主机的时候,可 ...

  3. 《HelloGitHub》第 101 期

    兴趣是最好的老师,HelloGitHub 让你对编程感兴趣! 简介 HelloGitHub 分享 GitHub 上有趣.入门级的开源项目. github.com/521xueweihan/HelloG ...

  4. Mysql table 调整table的字符集和校对规则

    ALTER TABLE `xxxx`.`xxx` CHARACTER SET = utf8mb4 , COLLATE = utf8mb4_0900_ai_ci ;

  5. 【YashanDB知识库】汇聚库23.1环境发生coredump

    [标题]汇聚库23.1环境发生coredump [问题分类]数据库错误 [关键词]YashanDB, 汇聚库, coredump [问题描述]在23.1.1.200版本数据库环境创建dblink.视图 ...

  6. face-api.js 学习笔记

    参考 Build Real Time Face Detection With JavaScript (youtube get started) face-api.js - JavaScript API ...

  7. Kubernetes ReplicaSet 控制器(十九)

    前面我们一起学习了 Pod 的原理和一些基本使用,但是在实际使用的时候并不会直接使用 Pod,而是会使用各种控制器来满足我们的需求,Kubernetes 中运行了一系列控制器来确保集群的当前状态与期望 ...

  8. std::vector 和 std::map 都支持以下比较运算符

    在 C++ 标准库中,std::vector 和 std::map 都支持以下比较运算符: ==(相等运算符) !=(不等运算符) <(小于运算符) <=(小于等于运算符) >(大于 ...

  9. 技术分享 | 徐轶韬:从MySQL5.7升级到MySQL 8.0

    在6月20日举办的[墨天轮数据库沙龙-MySQL 5.7 停服影响与应对方案]中,甲骨文MySQL解决方案首席工程师徐轶韬分享了<从MySQL5.7升级到MySQL 8.0>主题演讲,本文 ...

  10. MySQL故障诊断常用方法手册(含脚本、案例)

    当你在使用MySQL数据库时,突然遇到故障,你是否会感到迷茫? ● 数据库响应变慢.SQL慢.数据库插入出现延时-- ● 表不见了.日志出现多个断连记录-- ● 非法断电造成MySQL启动报错.同步复 ...