简体   繁体   English

MONO 4.6.2服务器上的CPU高使用率

[英]MONO 4.6.2 High CPU Usage on Server

I have updated my: 我已经更新了:

  • Ubuntu server to 16.04.1 LTS and Ubuntu服务器到16.04.1 LTS
  • MONO to v4.6.2 MONOv4.6.2

...from official repository. ...来自官方资料库

Since the update, the websites are still running fine, but after about a day or two, some of the MONO processes go crazy and take 100% of the CPU . 自更新以来,网站仍然可以正常运行,但是大约一两天后,一些MONO进程变得疯狂,占用了100%CPU I have different websites; 我有不同的网站; mostly plain HTML with just a little bit of code. 大部分是纯HTML,只包含少量代码。 It happens randomly, and on different websites each time. 它随机发生,并且每次都在不同的网站上发生。 It's totally random. 这是完全随机的。

I then receive an email alert of high CPU usage, connect via SSH, type "htop", and kill the process and it's back to normal ... for a day or two. 然后,我收到一封有关CPU使用率过高的电子邮件警报,通过SSH进行连接,键入“ htop”,然后终止该进程,然后恢复正常……一两天。

This definitely looks like a bug in this version of MONO. 这肯定看起来像是此MONO版本中的错误。 Any way to fix it? 有什么办法解决吗? Anyone else had this problem? 还有其他人有这个问题吗? Or perhaps I should switch to a different version that doesn't have this corruption? 还是我应该切换到没有此损坏的其他版本?

Thanks 谢谢

Edit: After 2 days, EVERY MONO process is taking up the full CPU. 编辑:2天后, 每个 MONO进程都占用了整个CPU。

Looking into the Apache2 log file, I could find this related to MONO 查看Apache2日志文件,我可以找到与MONO相关的内容

WARNING: WebConfigurationManager's LRUcache evictions count reached its max size
Cache Size: 100 (overridable via MONO_ASPNET_WEBCONFIG_CACHESIZE)

Also, "service apache2 restart" does not solve the problem. 另外,“服务apache2重新启动”不能解决问题。 I must manually kill the processes, or reboot. 我必须手动终止进程或重新启动。

I have played around with various MONO versions, and typing "service apache2 reload" to reproduce the high CPU usage problem. 我玩过各种MONO版本,然后键入“ service apache2 reload”以重现CPU使用率过高的问题。

In MONO 4.8, it seems to happen to happen a bit less often but the problem is still there. 在MONO 4.8中,这种情况似乎很少发生,但问题仍然存在。

In MONO 4.2.3.4, the problem is also there. 在MONO 4.2.3.4中,问题也存在。

In MONO 4.2.1 that comes by default on Ubuntu, this problem doesn't happen. 在Ubuntu上默认提供的MONO 4.2.1中,不会发生此问题。

As for .NET Core, some have tried it and highly recommended me to avoid it until it becomes more stable. 至于.NET Core,有人尝试过,强烈建议我避免使用它,直到它变得更稳定为止。

So for now, the only solution is to stick to MONO 4.2.1 因此,目前唯一的解决方案是坚持使用MONO 4.2.1

This also confirms that this is related to MONO and not to my code or the server configuration. 这也确认这与MONO有关,与我的代码或服务器配置无关。

After trying all options, it seems MONO just doesn't work well with Apache2 with mod_mono. 在尝试了所有选项之后,似乎MONO不能与带有mod_mono的Apache2配合使用。 The only solution I found is to switch Apache2 from prefork to worker mode, where the MONO server needs to be started manually and Apache2 simply forwards the requests to it -- and thus Apache2 doesn't directly touch MONO at all. 我发现的唯一解决方案是将Apache2从prefork切换到worker模式,在该模式下,需要手动启动MONO服务器,而Apache2只是将请求转发给它-因此Apache2根本不直接接触MONO。 There is very little documentation on how to do this, but since NGINX works in that mode, you can find instructions on how to set it up for NGINX and translate the app config file for Apache2. 关于如何执行此操作的文档很少,但是由于NGINX在该模式下工作,因此您可以找到有关如何为NGINX进行设置以及为Apache2转换应用程序配置文件的说明。

These are good places to start 这些是开始的好地方

http://www.mono-project.com/docs/web/fastcgi/nginx/ http://www.mono-project.com/docs/web/fastcgi/nginx/

http://epmjunkie.com/mono-fastcgi-startup-script/ http://epmjunkie.com/mono-fastcgi-startup-script/

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

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