At top monitor window displays the status of ongoing Rails request URL

http://robbin.javaeye.com/blog/283992

This is from a PragDave's blog Above to learn skills, very useful, very cool!

Saying in a Rails site running the above, we can use Linux's top command to monitor the Rails application instances running condition, occupied by memory, the CPU consumption and so on, for example, a moment JavaEye site screenshot:

At top monitor window displays the status of ongoing Rails request URL

In this screenshot inside, we can know the process of Rails instances running state, but we can not know the exact, a current consumption of CPU time high exactly fcgi process the request in the implementation of which, if this be able to know exact information, the search performance bottlenecks have great help, so we look to change the following months the Magic:

At your Rails application's app / controllers / application.rb inside two additional filter, as follows:

Ruby code

  1. before_filter: set_process_name_from_request
  2. after_filter: unset_process_name_from_request
  3. def set_process_name_from_request
  4. $ 0 = request.path [0,16]
  5. end
  6. def unset_process_name_from_request
  7. $ 0 = request.path [0,15] + "*"
  8. end

before_filter :set_process_name_from_request
after_filter :unset_process_name_from_request

def set_process_name_from_request
  $0 = request.path[0,16]
end   

def unset_process_name_from_request
  $0 = request.path[0,15] + "*"
end  

Ruby language at $ 0 is the command-line applications, because we fcgi way to start Rails, so the default display for dispatch.fcgi, but we are now to change the $ 0, put URI forced assignment to $ 0, then top will be deceived us :

Come give me show me the current handling of the request URI is / blog/283416, in fact, this is my blog: The domain model implementation of the concluding point of view.

Are not cool! Rails application if the request is being processed, then the top display / blog/283416, if the Rails application has processed the request, then the top display / blog/283416 *, then a full point, and give everyone had fun

At top monitor window displays the status of ongoing Rails request URL

分类:Ruby 时间:2009-03-15 人气:1242
分享到:
blog comments powered by Disqus

相关文章

  • Beauty of Mathematics Series 1 - Statistical Language Model 2010-03-26

    Author: Wu Jun, Google Fellow Preface Perhaps we do not believe that mathematics is to solve information retrieval and natural language processing of the best tools. It is very clear description of the real problems in these areas and gives elegant s ...

  • RUBY Design Model Builder Model Builder (simplified object creation) 2010-03-18

    Builder class is responsible for all the components bottled in a complex object. Construction of a complex object from its representation separation, so that the same construction process can create different representations. 14.2 UML class diagram g ...

  • Domain model (conceptual model) physical model of the logical model 2010-12-31

    Domain model Domain model (domain model), also known as conceptual models, domain object model, object model analysis, we analyzed the project in time, tend to create a corresponding domain model. Quote Java development of three treasures: Domain Model do

  • 1, blood loss model 2, model 3 anemia, congestive model 4, swelling and blood model 2010-03-25

    In order to fill everyone's regret, to sum up the domain model under ROBBIN some of the points and we complement the site and speeches, robbin the initial domain model will be divided into four broad categories: 1, blood loss model 2, anemia model 3,

  • Star model with the snow model 2011-09-24

    Star schema vs snow model multidimensional data modeling in an intuitive way to organize data, and supports high-performance data access. Each multidimensional data model by a number of multi-dimensional data model, said multi-dimensional data model

  • "rails outside the ruby language web development" Speech-related information 2009-04-26

    The purpose of the Speech by rails 2.3 Introduction and other ruby web framework for generic modular rack, come out of lightweight ruby language web development portfolio. At last, through the metal in the rails 2.3 features a combination of the two ...

  • Ruby Language Tutorial 2010-02-02

    Getting Started with Ruby language tutorial is a beginner tutorial, download the address, see Annex

  • Easy to write Ruby language web spider 2010-12-01

    Once there was a Hpricot, but only for use in Linux, then there is a Nokogiri, is Hpricot a good substitute, and there is Windows, the Gem, is an indispensable tool for the preparation of the spider. The following code is red kids online mall crawl the co

  • Web 2.0 application client ten causes of performance problems 2010-08-27

    Web 2.0 applications for the users to promote a new experience, while giving developers more attention to client performance issues. Recently, senior Web performance diagnosis expert and founder of the Tools dynatrace Andreas Grabner according to the

  • Waterfall initial diagnosis using the Web site performance bottlenecks .. 2011-06-16

    Core Tip: In general, the speed of opening a web page will be the following effects: 1) The server took too long to be dynamic page content into html. 2) dynamic pages took too long to send content from the server to the client. 3) page <! - News text

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.356 (s). 12 q(s)