This is from a
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:
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:
- 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]
- def unset_process_name_from_request
- $ 0 = request.path [0,15] + "*"
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