简体   繁体   English

监视过程性能影响?

[英]Monitoring of a process performance implications?

I have 3 servers with processes that require all the CPU they can get. 我有3台服务器,它们的进程需要它们可以获得的所有CPU。 I let these processes write their standard output to a file 我让这些进程将其标准输出写入文件

./run.sh > run.log

Would this writing slow down the process? 这段文字会减慢这个过程吗? (the ./run.sh script starts eg. a Java program and sometimes a Ruby program) (./run.sh脚本启动,例如,Java程序,有时甚至是Ruby程序)

Now I want to create a web-interface that would display the output from the script while it is running. 现在,我想创建一个Web界面,该界面在脚本运行时显示其输出。 I can imagine writing a php script which refreshes every 5 seconds, creates a SSH connection to the server does and gets the run.log file. 我可以想象编写一个php脚本,该脚本每5秒刷新一次,创建与服务器的SSH连接并获取run.log文件。

But wouldn't that interfere with the process or slow it down? 但是,这不会干扰该过程还是减慢它的速度? It is really crutial that the server is able to use as much of it's power as possible. 服务器必须能够使用尽可能多的功能,这一点至关重要。 Or are there better ways to handle this? 还是有更好的方法来解决这个问题? Instead of creating an SSH connection every 5 seconds, maby a persistent connection and update with Ajax? 而不是每5秒创建SSH连接,而是通过持久连接并使用Ajax更新吗? (security is not a requirement) (安全不是必需的)

Would this writing slow down the process? 这段文字会减慢这个过程吗? (the ./run.sh script starts eg. a Java program and sometimes a Ruby program) (./run.sh脚本启动,例如,Java程序,有时甚至是Ruby程序)

Maybe; 也许; if the process writes a lot of data, it can easily slowdown the process, because likely the process will be writing synchronously to the disk. 如果该进程写入大量数据,则很容易使该进程变慢,因为该进程很可能将同步写入磁盘。 Otherwise, you don't have to worry. 否则,您不必担心。

An alternative would be having a setup where the script sends the output to the machine with the web application via some kind of message service. 另一种选择是进行设置,其中脚本通过某种消息服务将输出发送到带有Web应用程序的计算机。 This would avoid polling the server; 这样可以避免轮询服务器。 whether it would be more efficient depends on the details. 是否更有效取决于细节。

A simple an efficient mechanism would be forwarding stdout to a UDP socket and have the web application listen and store temporarily those messages in a circular buffer. 一种简单有效的机制是将stdout转发到UDP套接字,并使Web应用程序侦听并将这些消息临时存储在循环缓冲区中。

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

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