有什么方法可以从 Coldfusion 内部访问有关 Coldfusion 服务器负载的信息吗?
我正在编写一个我想经常运行的计划任务。
问题是,如果服务器遇到高流量负载,我不希望运行此任务。
除了从 java 获取可用/总/最大内存来尝试确定此任务是否应该继续之外,还有其他方法吗?
I am writing a scheduled task which I would like to run frequently.
The problem is that I do not want this task to be run if the server is experiencing a high traffic load.
Is there any way other then getting the free/total/max memory from java to try and figure out whether this task should continue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
GetMetricData() 将为您提供有关服务器繁忙程度的良好指示,即有多少请求正在运行、有多少请求正在排队以及其他信息。
这与您从命令行运行
cfstat
获得的信息相同(您可以在{cfroot}\bin\cfstat.exe
下找到该信息)。然而,如果您只调用该函数一次,那么了解您当前的忙碌程度可能对您没有多大用处。使用 Windows
perfmon
将性能数据记录到文件或数据库表中可能会更好。然后,您可以获得过去 5 分钟(或其他时间)内正在运行/排队的请求的平均数量,并决定是否运行任务。GetMetricData() is going to give you a very good indication of how busy your server is, i.e. how many requests are running and how many are queued as well as other info.
It's the same info that you get from running
cfstat
from the command line (you'll find that under{cfroot}\bin\cfstat.exe
).However, knowing how busy you are at the very moment might not be very useful to you if you just call that function once. It might be better for you to log performance data to file or to a database table using Windows
perfmon
. You can then get the average number of running/queued requests over the past 5 minutes (or whatever) and make your decision on whether to run your task.有一种简单的方法可以检索内存使用信息。
http://misterdai.wordpress.com/2009/11 /25/retriving-coldfusion-memory-usage/
对于 CPU 负载,我认为你可以从 getMetricData() 获取它,但也有其他方法,但由于这是我的第一篇 stackoverflow 帖子,我只允许一个链接:P 但它在我的博客上,所以当您查看上面的链接时只需进行 CPU 搜索即可。
您可能会发现深入了解 getMetricData() 以获取性能监控统计数据很有用。这是通过运行和排队请求的数量来了解服务器繁忙程度的好方法。
希望这有帮助,
戴夫(又名戴先生)
There's an easy way to retrieve the memory usage information.
http://misterdai.wordpress.com/2009/11/25/retrieving-coldfusion-memory-usage/
For CPU load I think you can get it from getMetricData() but there are other methods too, but since this is my first stackoverflow post I'm only allowed one link :P But it's on my blog so just do a CPU search when you look at the link above.
You might find it useful to dig into getMetricData() for the performance monitoring stats. It's a good way of telling how busy your server is by the number of running and queued requests.
Hope this helps,
Dave (aka Mister Dai)
使用 ColdFusion AdminApi。在浏览器中调用 http://servername/CFIDE/adminapi/servermonitor.cfc 获取组件的 cfcdocs。如果为您提供了许多方法来获取 CF 服务器实例的运行状况。
Use the ColdFusion AdminApi. Call http://servername/CFIDE/adminapi/servermonitor.cfc in your browser to get the cfcdocs of the component. If gives you many methods to get the health of you CF server instance.